DOM Node Constants (shared/constants.js)

linkedom · esm/shared/constants.js · javascript · ISC
dev-tools, ui, lang:html, tag:constants

Provides standard DOM node types, element categories, and tree traversal constants for DOM-like parsing. Use this when implementing custom HTML or XML tree manipulation logic.

// Source: https://github.com/WebReflection/linkedom | License: ISC | Copyright 2021, Andrea Giammarchi, @WebReflection
// Provided via justclaw.it.com; keep this notice with the code.
// Internal
export const NODE_END = -1;

// Node
export const ELEMENT_NODE = 1;
export const ATTRIBUTE_NODE = 2;
export const TEXT_NODE = 3;
export const CDATA_SECTION_NODE = 4;
export const COMMENT_NODE = 8;
export const DOCUMENT_NODE = 9;
export const DOCUMENT_TYPE_NODE = 10;
export const DOCUMENT_FRAGMENT_NODE = 11;

// Elements
export const BLOCK_ELEMENTS = new Set(['ARTICLE', 'ASIDE', 'BLOCKQUOTE', 'BODY', 'BR', 'BUTTON', 'CANVAS', 'CAPTION', 'COL', 'COLGROUP', 'DD', 'DIV', 'DL', 'DT', 'EMBED', 'FIELDSET', 'FIGCAPTION', 'FIGURE', 'FOOTER', 'FORM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'LI', 'UL', 'OL', 'P

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key