html-element is a server-side shim providing a partial implementation of `HTMLElement` for Node.js environments. It enables client-side templating libraries, such as Hyperscript, to execute server-side without a full browser DOM. The current stable version is 2.3.1, released in August 2016. The project appears to be in an abandoned state with no significant updates since 2017, making its release cadence non-existent. Its primary differentiation is its lightweight nature, offering just enough DOM API to render templates without the overhead of a headless browser, focusing on core element creation, manipulation, and serialization methods like `createElement`, `appendChild`, `setAttribute`, and `toString()`. It supports Node.js versions 4.2 and higher.
npm install html-elementVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `html-element` to create a document, elements, set attributes and text content, then render to HTML string.
If you rely on global objects, change `require('html-element')` to `require('html-element/global-shim')`. For non-global usage, import objects directly: `const { document } = require('html-element');` or `import { Element } from 'html-element';`Review code that sets properties expecting them to always reflect as HTML attributes. Use `setAttribute()` for explicit HTML attributes.
Ensure your Node.js environment is version 4.2 or newer.
No fix needed, but be aware of this behavior change if your code previously relied on `insertBefore(newNode, null)` *not* appending.
No fix needed, but be aware that setting `textContent` will overwrite existing child nodes.
Update any code that previously tried to infer the tag name from other properties or lacked this capability.
If you need a global `document` object, change your import to `require('html-element/global-shim');`. Otherwise, import `document` explicitly: `const { document } = require('html-element');`Ensure you are accessing `document` correctly: `const { document } = require('html-element');` or `const document = require('html-element').document;`.No dependency data recorded yet.