1.0.0 • Published 8 years ago

is-in-page v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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')
}

js-standard-style