Socket
Book a DemoInstallSign in
Socket

dom-exist

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-exist

check a document element is exist

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

dom-exist Build Status

Check an element is exist in document.body

Install

  • npm
$ npm install dom-exist

Usage

const domExist = require('dom-exist')
const ret = domExist(document.getElementById('domId'))

// ret = {result: false, code: -1, msg: 'xxxx'}

Api

domExist(el)

el

Type: string(css selector) or HTMLElement

ret

Type: object

ret.result

Type: boolean: return true if exist, false if not exist

ret.code

Type: number: return 0 if element is in document.body, -1 if element not found, -2 if element not in document.body

License

MIT

Keywords

document

FAQs

Package last updated on 18 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts