New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dom-slim

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-slim

Slim Document Object Model Implementation

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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: DOMImplementation interface, entirely
  • Add: document.URL, document.documentURI, document.origin, document.compatMode, document.characterSet, document.charset, document.inputEncoding, document.contentType properties
  • Add: document.implementation property
  • Add: document.doctype property
  • Add: document.documentElement property
  • Add: document.createElementNS() method

See full changelog here

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
 */

Keywords

dom

FAQs

Package last updated on 21 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts