is-in-page

1.0.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i is-in-page

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jekrb