Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakeburden/is-in-page
https://github.com/jakeburden/is-in-page
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jakeburden/is-in-page
- Owner: jakeburden
- Created: 2016-01-07T22:16:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-07T22:31:19.000Z (about 9 years ago)
- Last Synced: 2024-11-20T13:20:10.686Z (2 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
### isInPage ([from MDN](https://developer.mozilla.org/en-US/docs/Web/API/Node/contains))
npm install is-in-page --save
#### 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.
```js
function isInPage (node) {
return (node === document.body) ? false : document.body.contains(node)
}
```#### npm usage
```js
var isInPage = require('is-in-page')
if (isInPage(document.getElementById('wow'))) {
console.log('cool')
}```
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)