https://github.com/nrkn/nodetype-enum
An enum of HTML DOM node types
https://github.com/nrkn/nodetype-enum
Last synced: 4 days ago
JSON representation
An enum of HTML DOM node types
- Host: GitHub
- URL: https://github.com/nrkn/nodetype-enum
- Owner: nrkn
- Created: 2016-07-05T07:28:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-05T07:51:10.000Z (almost 9 years ago)
- Last Synced: 2024-11-06T17:50:34.514Z (6 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# nodetype-enum
## An enum of HTML DOM node types
```javascript
{
1: 'element',
3: 'text',
7: 'processingInstruction',
8: 'comment',
9: 'document',
10: 'documentType',
11: 'documentFragment',
element: 1,
text: 3,
processingInstruction: 7,
comment: 8,
document: 9,
documentType: 10,
documentFragment: 11
}
```See [Node.nodeType at MDN](https://developer.mozilla.org/en/docs/Web/API/Node/nodeType)
### Install
`npm install nodetype-enum`
### Usage
```javascript
const nodeType = require( 'nodetype-enum' )console.log( nodeType.element ) // 1
console.log( nodeType[ 1 ] ) // 'element'//get a fresh instance
const fresh = nodeType()console.log( fresh.element ) // 1
delete fresh.element
console.log( fresh.element ) // undefined
console.log( nodeType.element ) // 1
```