@laserware/dominator
    Preparing search index...

    Function hasSomeAttributes

    • Checks if the target has some of the attributes that match the search criteria.

      Type Parameters

      Parameters

      • target: null | Target

        Element, EventTarget, or CSS selector.

      • search: AttributesSearch<E>

        Array of attribute names or attributes filter object to check for.

      Returns boolean

      true if the target matches some search criteria.

      elements!InvalidElementError if the specified target wasn't found.

      HTML

      <div id="example" aria-hidden="true" inert>Example</div>
      

      Code

      Note that the aria-label attribute isn't present on the div above, but the function still returns true:

      const element = findElement("#example")!;

      hasSomeAttributes(element, ["aria-hidden", "aria-label"]);
      // true

      hasSomeAttributes(element, {
      inert: null,
      "aria-hidden": true,
      "aria-label": "Click Me",
      });
      // true