Repository navigation
Document sanitization during HTML parsing - #46211
Open
Stackforge-07 wants to merge 4 commits into
Open
Stackforge-07 wants to merge 4 commits into
Stackforge-07 wants to merge 4 commits into
Conversation
Stackforge-07
requested review from
hamishwillee
and removed request for
a team
October 20, 2026 11:54
Contributor
AI reviewReviewed at cf4bf10 The PR covers what #46132 asked for, and I checked its claims against the spec text from whatwg/html#12756. It also fixes the broken Blockers
Suggestions
|
Contributor
AI reviewReviewed at fa821d4 The new commit addresses all the earlier points. Two small things are left. Nits
|
zcorpan
approved these changes
Oct 20, 2026
Contributor
Preview URLs (7 pages)(comment last updated: 2026-11-10 03:17:09) |
Collaborator
|
There's some work going on on in this area in: I will review when that is done. @wbamberg I don't think this one is same area but different focus, so will assume you don't want to review it. |
Contributor
|
This pull request has merge conflicts that must be resolved before it can be merged. |
This branch has not been deployed
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.
Description
Update the HTML Sanitizer API overview and all six Element, ShadowRoot, and Document method references to describe sanitization during parsing rather than a separate pass over the completed DOM. Explain the observable consequences for adjacent text nodes, custom element construction, resource-fetching side effects, and declarative shadow roots, with a focused example showing a replaced
<b>producing one text node.Also correct the default-sanitizer example to pass
{ sanitizer: "default" }tosetHTMLUnsafe(), fix its inconsistent variable names and whitespace output, and clarify fragment parsing's top-level shadow-template behavior.Motivation
The HTML Standard changed in whatwg/html#12756. The existing descriptions still teach the earlier parse-then-sanitize model and the unsafe example currently omits the sanitizer it claims to use. This documents the current specification and notes that some browsers still sanitize after parsing, producing different DOM structures.
Additional details
git diff --checkpassed for the changed content.Related issues and pull requests
Fixes #46132.
Related to #46148 (the release-note task); this PR updates the overview and API references.