12 lines
621 B
JavaScript
12 lines
621 B
JavaScript
import { findElementRecursive } from './findElementRecursive';
|
|
/**
|
|
* Determines if an element, or any of its ancestors, contain the given attribute
|
|
* @param element - element to start searching at
|
|
* @param attribute - the attribute to search for
|
|
* @returns the value of the first instance found
|
|
*/
|
|
export function elementContainsAttribute(element, attribute, doc) {
|
|
var elementMatch = findElementRecursive(element, function (testElement) { return testElement.hasAttribute(attribute); }, doc);
|
|
return elementMatch && elementMatch.getAttribute(attribute);
|
|
}
|
|
//# sourceMappingURL=elementContainsAttribute.js.map
|