
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Apply the HTML5 Tree Construction algorithm to a stream of html-tokenize tokens
Apply the HTML5 Tree Construction algorithm to a stream of html-tokenize
tokens
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())
..
The whatwg detailed specification of the Tree Construction algorithm can be found on https://html.spec.whatwg.org/multipage/syntax.html#tree-construction
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.
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.
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:
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.FAQs
Apply the HTML5 Tree Construction algorithm to a stream of html-tokenize tokens
The npm package html-nest receives a total of 0 weekly downloads. As such, html-nest popularity was classified as not popular.
We found that html-nest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.