*** Backup Mirror *** The web interface and JSON api for the ConnectedHumber Air Quality Monitoring Project. https://github.com/ConnectedHumber/Air-Quality-Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Air-Quality-Web/client_src/js/Helpers/GetContainingElement.mjs

16 lines
492 B

"use strict";
/**
* Gets the first containing parent element of a given type for a given child element.
* @param {HTMLElement} element The child element to find the parent of.
* @param {string} type The name of the element containing parent to search for.
*/
function GetContainingElement(element, type)
{
while(element !== null && element.tagName.toLowerCase() !== type.toLowerCase()) {
element = element.parentNode;
}
return element;
}
export default GetContainingElement;