Element representation of target.
Element, EventTarget, or CSS selector.
Array of attribute names or attributes filter object to check for.
true if the target matches all search criteria.
elements!InvalidElementError if the specified target wasn't found.
HTML
<div id="example" aria-hidden="true" inert>
Example
</div>
Code
const element = findElement("#example")!;
hasAllAttributes(element, ["aria-hidden"]);
// true
hasAllAttributes(element, ["aria-hidden", "missing"]);
// false ("missing" does not exist)
hasAllAttributes(element, {
"aria-hidden": true,
inert: null,
});
// true
Checks if the
targethas all of the attributes that match thesearchcriteria.