Repository navigation
Conversation
7b105e3 to
e24c23b
Compare
df24ea2 to
e416732
Compare
e24c23b to
aae1d67
Compare
e416732 to
5106e9d
Compare
aae1d67 to
4ff3705
Compare
deb55bb to
e97c374
Compare
4ff3705 to
8551681
Compare
d5a18a7 to
b19b385
Compare
d87ab8d to
4880d38
Compare
c374a0b to
e8c7cba
Compare
2de75ec to
ce9f49b
Compare
See whatwg/html#12758 Note that tests that assert how this works with <template for> are still tentative as that PR is still not landed.
421aa3f to
043dcdf
Compare
2e1181e to
1d9e935
Compare
043dcdf to
286c499
Compare
1d9e935 to
4453c2a
Compare
286c499 to
146266b
Compare
4453c2a to
931141c
Compare
146266b to
6e5c251
Compare
… displaced referenceChild handling
AI reviewReviewed at 1f7ee1a, together with web-platform-tests/wpt#61748 at 8c22eae. This covers the whole spec diff and all 53 test files. Each finding below was checked against the spec text and the test source. The spec diff has no new blockers. The test PR hasn't been updated since before the last three spec commits, and four of its tests are broken. Blockers
Suggestions
Nits
|
…at </script> (including during document parsing) and clarify deferred abort note
Thanks! Addressed in here in the WPT. Blockers
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI review and fixesReviewed at 60f91db and again at b9dec97, together with web-platform-tests/wpt#61748 at 5b249c3 and 49e13af All findings from the previous review are addressed. I've pushed fixes for the new findings below to both branches, one commit each, and self-reviewed them: Blockers
Suggestions
Nits
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI review and fixesReviewed at b9dec97, together with web-platform-tests/wpt#61748 at 38f96d8 This was a fresh full pass: separate reviews of the spec's API layer, its tree construction changes, and the tests. I also ran all test files in Chrome Canary with experimental features, and in Firefox Nightly, which doesn't implement streaming, to catch tests that pass anyway. Line numbers below are at the reviewed commits. I pushed a fix for each finding, one commit each, except where noted, and self-reviewed them: Open questions
Blockers
Suggestions
Nits
|
I discussed this with @noamr. We think dropping in this case is best. I'll add a test. Edit: web-platform-tests/wpt@f50b348 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Otherwise the assert that a Document target parent isn't used for an element replaced with its children is reachable, e.g. when a streamed script makes the foster parenting table the document element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Like the root html element, an element the sanitizer replaces with its children isn't adopted with the target, so its registry can be stale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An abort from the microtask checkpoint before a script is prepared was only deferred, so the script still ran. Mark scripts on the stack of open elements as already started when deferring, as aborting the parser does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document parsing now also requires the element's node document to be the parser's Document, matching HTML scripts' intended document check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Elements were already dropped once fragment parser abort requested is true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The step only applies to the document parser, so this avoids changing which form an element is associated with in Document.parseHTML() with a sanitizer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI review and fixesReviewed at 604b4c7, together with web-platform-tests/wpt#61748 at f50b348 All findings from my previous review are addressed, and f50b348 covers the decision to drop children of a replaced element after its table moves. I've pushed a fix for each new finding below to both branches, one commit each, and self-reviewed them: Open questions
Blockers
Suggestions
Nits
|
Introduce safe and unsafe streaming HTML parsing and insertion methods returning a
WritableStream:Element&ShadowRoot:streamHTML(),streamHTMLUnsafe(),streamAppendHTML(),streamAppendHTMLUnsafe(),streamPrependHTML(), andstreamPrependHTMLUnsafe()NonDocumentTypeChildNode:streamBeforeHTML(),streamBeforeHTMLUnsafe(),streamAfterHTML(),streamAfterHTMLUnsafe(),streamReplaceWithHTML(), andstreamReplaceWithHTMLUnsafe()Key behaviors and parser updates:
writeAlgorithmandcloseAlgorithmconvert chunks toDOMString, append chunks (or an explicit"EOF"character on close) to the parser's input stream, and run the fragment parser.closeAlgorithmwaits for any pending parser-blocking scripts viafragment parser close promise.abortAlgorithmaborts the fragment parser (deferring viafragment parser abort requestedif currently running), marks openscriptelements on the stack as already started, and unblocks rendering on pending scripts.referenceChildis no longer a child oftargetwhen a node would be inserted before it or when another chunk is written,invalid reference child stepserror the stream (and rejectfragment parser close promiseif closing) with a"HierarchyRequestError"DOMExceptionand abort the fragment parser. Elements that would be inserted before a displacedreferenceChildare created in theappropriate template contents owner documentwith a null custom element registry and dropped, and the adoption agency algorithm skips removinglastNode."NotSupportedError"for HTML/SVGscriptcontext elements, or"HierarchyRequestError"forhtmltargets or invalidparent for HTML streaming),HTMLTemplateElementredirection totemplate contents, and Trusted Types /SanitizerConfigvalidation occur synchronously before returning the stream or mutating the DOM.initialize an HTML fragment parser. WhenrunScriptsis true,script target documentiscontext's node document; otherwise it is the temporary inert document.defer,async, and module scripts follow normal HTML parser pausing and execution order.scriptvia a dedicated element queue; other reactions when streaming HTML use the backup element queue.stops parsing) returns early for fragment parsers.htmlelement are created directly in the target's (or fragment's) node document.scriptelements are only processed when the parser'sscript target documentis not the parser'sDocumentand thescriptelement is connected (which also applies to document parsing when an ancestor of an SVGscriptwas disconnected before</script>).appropriate template contents owner documentwith a null custom element registry and not inserted into the DOM.Note: Pre-existing adoption agency algorithm edge cases (#13093) are out of scope for this PR.
Closes #2142
streamHTMLtests web-platform-tests/wpt#61748(See WHATWG Working Mode: Changes for more details.)
/dynamic-markup-insertion.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/parsing.html ( diff )
/references.html ( diff )
/scripting.html ( diff )
/xhtml.html ( diff )