Stream HTML into element or ShadowRoot - #12758
Open
noamr wants to merge 5 commits into
Open
Conversation
noamr
force-pushed
the
noamr/stream-html
branch
from
August 5, 2026 09:32
df24ea2 to
e416732
Compare
5 tasks
noamr
force-pushed
the
noamr/stream-html
branch
from
August 6, 2026 16:23
e416732 to
5106e9d
Compare
noamr
force-pushed
the
noamr/stream-html
branch
from
August 6, 2026 19:46
deb55bb to
e97c374
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add streaming HTML insertion methods to Element, ShadowRoot, and ChildNode
Introduce safe and unsafe streaming HTML parsing and insertion methods:
This allows developers to parse and stream HTML directly into specific positions of the DOM tree using WritableStream.
The HTML fragment parser is divided into two:
DocumentFragmentThe preparation algorithm is used when streaming, by creating a new fragment parser, and then the stream is routed to feed that parser.
When parsing, the "insertion target redirection map" is configured to reroute insertions intended for the root to go directly into the stream's target element, instead of going into the
DocumentFragment.A special sanitizer mitigation is in place to avoid these removed elements from incurring side effects, by creating them in an inert document if they are about to be removed.
Closes #2142
streamHTMLtests web-platform-tests/wpt#61748(https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use.
(See WHATWG Working Mode: Changes for more details.)
/dynamic-markup-insertion.html ( diff )
/infrastructure.html ( diff )
/interactive-elements.html ( diff )
/parsing.html ( diff )
/references.html ( diff )
/system-state.html ( diff )