New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-nest

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

html-nest

Apply the HTML5 Tree Construction algorithm to a stream of html-tokenize tokens

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

html-nest

Apply the HTML5 Tree Construction algorithm to a stream of html-tokenize tokens

build status

Example

Simply pipe the output of html-tokenize into an html-nest stream.

var tokenize = require('html-tokenize');
var nest = require('html-nest');

htmlStream
  .pipe(tokenize())
  .pipe(nest())
  ..

Specification

The whatwg detailed specification of the Tree Construction algorithm can be found on https://html.spec.whatwg.org/multipage/syntax.html#tree-construction

Philosophy

The goal is to have something that works well with html-tokenize and that matches as much as possible of the HTML5 Tree Construction algorithm, while keeping the benefits of streaming.

Status

Currenly only a subset of the Tree Construction algorithm is implemented. The architecture of the code tries to follow the sections of the specification so it should hopefully be easy to add missing parts in a progressive fashion.

Feel free to send PRs, either for new tests or for implementation of missing parts.

Notes regarding the implementation

There are some aspects of the Tree Construction algorithm to do not fit well with the streaming approach taken by html-tokenize and html-nest. We will try and express these limitations here:

  • There will always be an html element in the tree. The specification states that if several html opening tags are found, their respective attributes should extend the attributes of the first html element. It is currently not possible to do this in html-nest since it would basically mean that we need to refrain from emitting any tokens before the whole document has been analyzed by html-nest. We would loose all the benefits of streaming.

Keywords

FAQs

Package last updated on 02 Dec 2014

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