Created
June 10, 2021 07:26
-
-
Save droid001/9325a9edafd0b2e7b3f5eac49588fca0 to your computer and use it in GitHub Desktop.
Checks if the argument is an instance of Element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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