dom-node-types

Exports the name/value pairs of DOM Node types

Usage no npm install needed!

<script type="module">
  import domNodeTypes from 'https://cdn.skypack.dev/dom-node-types';
</script>

README

dom-node-types

This module just exports the name/value pairs of DOM Node types. It's trivial, but I find myself needing it regularly and including a dependency on a complete DOM implementation is overkill. I got tired of pasting this around, so it's here.

Installation

npm install dom-node-types

API

ES6:

import { ELEMENT_NODE, TEXT_NODE } from 'dom-node-types';
// or
import * as nodeTypes from 'dom-node-types';

In olden days:

var ELEMENT_NODE = require('dom-node-types').ELEMENT_NODE;
// or
var nodeTypes - require('dom-node-types');

Types

The available types are:

  • ELEMENT_NODE
  • ATTRIBUTE_NODE
  • TEXT_NODE
  • CDATA_SECTION_NODE
  • ENTITY_REFERENCE_NODE
  • ENTITY_NODE
  • PROCESSING_INSTRUCTION_NODE
  • COMMENT_NODE
  • DOCUMENT_NODE
  • DOCUMENT_TYPE_NODE
  • DOCUMENT_FRAGMENT_NODE
  • NOTATION_NODE