@laserware/dominator
    Preparing search index...

    Function areElementsSame

    • Returns true if the Element(s), EventTarget(s), or CSS selector(s) specified as left and the Element, EventTarget, or CSS selector specified as right do match.

      Parameters

      • left: OneOrManyOf<null | Target>

        One or many Element, EventTarget, or CSS selectors to check; if an array, returns true if one of the elements matches the target element input.

      • right: null | Target

        Element, EventTarget, or CSS selector to compare against.

      Returns boolean

      This function doesn't throw if the specified left and/or right elements don't exist. Rather, it just returns false. This was a deliberate choice.

      HTML

      <ul>
      <li id="item-1">Item 1</li>
      <li id="item-2">Item 2</li>
      </ul>

      Code

      const item1 = findElement("#item-1")!;
      const item2 = findElement("#item-2")!;

      areElementsSame(item1, item2);
      // false

      areElementsSame(item1, "#item-1");
      // true

      areElementsSame(item1, null);
      // false