Socket
Socket
Sign inDemoInstall

min-document

Package Overview
Dependencies
1
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    min-document

A minimal DOM implementation


Version published
Weekly downloads
5M
decreased by-1.85%
Maintainers
2
Install size
57.8 kB
Created
Weekly downloads
 

Package description

What is min-document?

The min-document npm package is a minimal DOM Document implementation for use in server-side rendering, testing, or other environments where a full DOM is not necessary. It provides a lightweight way to construct a DOM-like structure without the overhead of a full browser environment.

What are min-document's main functionalities?

Creating elements

This feature allows you to create new DOM elements, similar to how you would in a browser environment.

var Document = require('min-document');
var doc = new Document();
var div = doc.createElement('div');

Creating text nodes

This feature enables you to create text nodes and append them to elements, allowing you to build a text content structure.

var text = doc.createTextNode('Hello, World!');
div.appendChild(text);

Querying elements

This feature provides methods to query elements in the document, similar to the `getElementsByTagName` method in the browser DOM API.

var p = doc.createElement('p');
doc.body.appendChild(p);
var paragraphs = doc.getElementsByTagName('p');

Other packages similar to min-document

Readme

Source

min-document

build status dependency status

A minimal DOM implementation

Example

var document = require("min-document")

var div = document.createElement("div")
div.className = "foo bar"

var span = document.createElement("span")
div.appendChild(span)
span.textContent = "Hello!"

/*  <div class="foo bar">
        <span>Hello!</span>
    </div>
*/
var html = String(div)

Installation

npm install min-document

Contributors

  • Raynos

MIT Licenced

FAQs

Last updated on 21 Sep 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc