@laserware/dominator
    Preparing search index...

    Function hasAllAttributes

    • Checks if the target has all 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 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