UNPKG

@fluentui/dom-utilities

Version:

DOM utilities for use within Fluent web components

12 lines 621 B
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