All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.esm.dom-utils.instanceOf.js Maven / Gradle / Ivy

There is a newer version: 2.11.8
Show newest version
import getWindow from "./getWindow.js";

function isElement(node) {
  var OwnElement = getWindow(node).Element;
  return node instanceof OwnElement || node instanceof Element;
}

function isHTMLElement(node) {
  var OwnElement = getWindow(node).HTMLElement;
  return node instanceof OwnElement || node instanceof HTMLElement;
}

function isShadowRoot(node) {
  // IE 11 has no ShadowRoot
  if (typeof ShadowRoot === 'undefined') {
    return false;
  }

  var OwnElement = getWindow(node).ShadowRoot;
  return node instanceof OwnElement || node instanceof ShadowRoot;
}

export { isElement, isHTMLElement, isShadowRoot };




© 2015 - 2024 Weber Informatics LLC | Privacy Policy