is-in-page
v1.0.0
Published
From MDN: This function checks to see if an element is in the page's body. As contains is inclusive and determining if the body contains itself isn't the intention of isInPage this case explicitly returns false.
Downloads
2
Maintainers
Readme
isInPage (from MDN)
Example
This function checks to see if an element is in the page's body. As contains is inclusive and determining if the body contains itself isn't the intention of isInPage this case explicitly returns false.
function isInPage (node) {
return (node === document.body) ? false : document.body.contains(node)
}
npm usage
var isInPage = require('is-in-page')
if (isInPage(document.getElementById('wow'))) {
console.log('cool')
}