1.1.0 • Published 7 years ago
dom-slim v1.1.0
dom-slim
Lightweight Node.js library implementing the DOM Living Standard.
The purpose of this library is to provide a basic implementation of the DOM. It excludes the HTML elements (e.g. body, audio) and several interfaces. Provides the minimum necessary for creating and handling nodes and elements.
Latest version: v1.1.0
Notable changes: (over v1.0.0-beta)
Provides missing Document properties and DOMImplementation interface
- Implement:
DOMImplementationinterface, entirely - Add:
document.URL,document.documentURI,document.origin,document.compatMode,document.characterSet,document.charset,document.inputEncoding,document.contentTypeproperties - Add:
document.implementationproperty - Add:
document.doctypeproperty - Add:
document.documentElementproperty - Add:
document.createElementNS()method
Note: This version is not production ready, due to missing tests!
Major features that are not included:
- Shadow DOM
- Events and Mutation Observers
- Custom Elements and custom element steps
- CSS and related methods/properties (e.g. the Element widths, positioning)
- Scripts
- Window (replaced by Context)
- querySelector() / querySelectorAll()
See here the full list of what is implemented and what is missing.
How to use
Install via npm:
npm install dom-slim
Usage example
const DOM = require('dom-slim');
// Create a Document
const document = DOM.createDocument();
// Create some Element nodes
const html = document.createElement('html');
const head = document.createElement('head');
html.appendChild(head);
const body = document.createElement('body');
html.appendChild(body);
/**
* Resulting DOM:
*
* html
* - head
* - body
*/1.1.0
7 years ago
1.0.0-beta
7 years ago