Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oozcitak/dom

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oozcitak/dom

A modern DOM implementation

  • 1.14.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
510K
decreased by-57.15%
Maintainers
1
Weekly downloads
 
Created

What is @oozcitak/dom?

@oozcitak/dom is a lightweight, standards-compliant DOM implementation for Node.js. It allows you to create, manipulate, and traverse DOM trees in a server-side environment, similar to how you would in a browser.

What are @oozcitak/dom's main functionalities?

Creating a DOM Document

This feature allows you to create a new DOM document. The code sample demonstrates how to create a new document with a root element and serialize it to a string.

const { DOMImplementation, XMLSerializer } = require('@oozcitak/dom');
const impl = new DOMImplementation();
const doc = impl.createDocument(null, 'root', null);
const serializer = new XMLSerializer();
console.log(serializer.serializeToString(doc));

Manipulating DOM Elements

This feature allows you to manipulate DOM elements. The code sample demonstrates how to create a new element, set its text content, and append it to the root element.

const { DOMImplementation, XMLSerializer } = require('@oozcitak/dom');
const impl = new DOMImplementation();
const doc = impl.createDocument(null, 'root', null);
const root = doc.documentElement;
const child = doc.createElement('child');
child.textContent = 'Hello, World!';
root.appendChild(child);
const serializer = new XMLSerializer();
console.log(serializer.serializeToString(doc));

Traversing the DOM

This feature allows you to traverse the DOM tree. The code sample demonstrates how to create multiple child elements, append them to the root, and then traverse the children to log their text content.

const { DOMImplementation, XMLSerializer } = require('@oozcitak/dom');
const impl = new DOMImplementation();
const doc = impl.createDocument(null, 'root', null);
const root = doc.documentElement;
const child1 = doc.createElement('child');
child1.textContent = 'Child 1';
const child2 = doc.createElement('child');
child2.textContent = 'Child 2';
root.appendChild(child1);
root.appendChild(child2);
const children = root.getElementsByTagName('child');
for (let i = 0; i < children.length; i++) {
  console.log(children[i].textContent);
}

Other packages similar to @oozcitak/dom

Keywords

FAQs

Package last updated on 05 Feb 2020

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc