UNPKG

@fluentui/dom-utilities

Version:

DOM utilities for use within Fluent web components

17 lines 931 B
define(["require", "exports", "./findElementRecursive"], function (require, exports, findElementRecursive_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.elementContainsAttribute = void 0; /** * 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