Have ideas to improve npm?Join in the discussion! »

    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

    Install

    npm i is-in-page

    DownloadsWeekly Downloads

    3

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar