Skip to content

Instantly share code, notes, and snippets.

@droid001
Created June 10, 2021 07:26
Show Gist options
  • Save droid001/9325a9edafd0b2e7b3f5eac49588fca0 to your computer and use it in GitHub Desktop.
Save droid001/9325a9edafd0b2e7b3f5eac49588fca0 to your computer and use it in GitHub Desktop.
Checks if the argument is an instance of Element
/**
* isElement - Checks if the argument is a DOM element. from https://stackoverflow.com/a/36894871/7197027
*
* @param {object} element Argument to be tested
*
* @returns {Boolean} Result if the argument is a DOM element or not.
*/
export const isElement = element=> element instanceof Element || element instanceof HTMLDocument;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment