UNPKG

@fluentui/dom-utilities

Version:

DOM utilities for use within Fluent web components

16 lines 824 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.elementContainsAttribute = void 0; var findElementRecursive_1 = require("./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 */ function elementContainsAttribute(element, attribute, doc) { var elementMatch = (0, findElementRecursive_1.findElementRecursive)(element, function (testElement) { return testElement.hasAttribute(attribute); }, doc); return elementMatch && elementMatch.getAttribute(attribute); } exports.elementContainsAttribute = elementContainsAttribute; //# sourceMappingURL=elementContainsAttribute.js.map