-
Notifications
You must be signed in to change notification settings - Fork 325
Add HTML setters features #4318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
45c155a
Add HTML setters features
tunetheweb 3c0cad6
Add spec
tunetheweb d0f75e3
Update features/html-setters.yml
tunetheweb eee53d3
Update html-streaming-setters.yml
tunetheweb c8c2cbe
Review feedback
tunetheweb de89f56
Move setHTML and setHTMLUnsafe
tunetheweb 54762e0
Update features/html-setters.yml
tunetheweb 4ff8c94
Update features/parse-html-unsafe.yml
tunetheweb 6e175c7
Update features/sanitizer.yml
tunetheweb 192a786
Update features/parse-html-unsafe.yml
tunetheweb 757361d
Merge branch 'main' into html-setters
tunetheweb acc9714
Temp spec URLs
tunetheweb 35fb089
Merge branch 'main' into html-setters
tunetheweb 0b53cec
Feedback from Jake
tunetheweb 1d0a3f6
Merge branch 'main' into html-setters
tunetheweb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: HTML setter methods | ||
| description: The `setHTML()`, `replaceWithHTML()`, `beforeHTML()`, `prependHTML()`, `appendHTML()` and `afterHTML()` DOM methods, and unsafe equivalents, insert HTML into an existing tree. | ||
| spec: https://github.com/whatwg/html/pull/12753 | ||
| #TODO: replace with below and remove from specs.ts once about PR is merged | ||
| #spec: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization | ||
| group: dom | ||
| compat_features: | ||
| - api.CharacterData.afterHTML | ||
| - api.CharacterData.afterHTMLUnsafe | ||
| - api.CharacterData.beforeHTML | ||
| - api.CharacterData.beforeHTMLUnsafe | ||
| - api.CharacterData.replaceWithHTML | ||
| - api.CharacterData.replaceWithHTMLUnsafe | ||
| - api.DocumentType.afterHTML | ||
| - api.DocumentType.afterHTMLUnsafe | ||
| - api.DocumentType.beforeHTML | ||
| - api.DocumentType.beforeHTMLUnsafe | ||
| - api.DocumentType.replaceWithHTML | ||
| - api.DocumentType.replaceWithHTMLUnsafe | ||
| - api.Element.afterHTML | ||
| - api.Element.afterHTMLUnsafe | ||
| - api.Element.appendHTML | ||
| - api.Element.appendHTMLUnsafe | ||
| - api.Element.beforeHTML | ||
| - api.Element.beforeHTMLUnsafe | ||
| - api.Element.prependHTML | ||
| - api.Element.prependHTMLUnsafe | ||
| - api.Element.replaceHTML | ||
| - api.Element.replaceHTMLUnsafe | ||
| - api.Element.replaceWithHTML | ||
| - api.Element.replaceWithHTMLUnsafe | ||
| - api.Element.setHTML | ||
| - api.Element.setHTMLUnsafe | ||
| - api.Element.setHTMLUnsafe.options_runscripts_parameter | ||
| - api.ShadowRoot.setHTML | ||
| - api.ShadowRoot.afterHTML | ||
| - api.ShadowRoot.afterHTMLUnsafe | ||
| - api.ShadowRoot.appendHTML | ||
| - api.ShadowRoot.appendHTMLUnsafe | ||
| - api.ShadowRoot.beforeHTML | ||
| - api.ShadowRoot.beforeHTMLUnsafe | ||
| - api.ShadowRoot.prependHTML | ||
| - api.ShadowRoot.prependHTMLUnsafe | ||
| - api.ShadowRoot.replaceWithHTML | ||
| - api.ShadowRoot.replaceWithHTMLUnsafe | ||
| - api.ShadowRoot.setHTMLUnsafe | ||
| - api.ShadowRoot.setHTMLUnsafe.options_runscripts_parameter | ||
| - api.TrustedHTMLParserOptions | ||
| - api.TrustedHTMLParserOptions.runScripts | ||
| - api.TrustedHTMLParserOptions.sanitizer | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Generated from: html-setters.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: false | ||
| support: {} | ||
| compat_features: | ||
| # baseline: low | ||
| # baseline_low_date: 2025-09-15 | ||
| # support: | ||
| # chrome: "124" | ||
| # chrome_android: "124" | ||
| # edge: "124" | ||
| # firefox: "123" | ||
| # firefox_android: "123" | ||
| # safari: "26" | ||
| # safari_ios: "26" | ||
| - api.Element.setHTMLUnsafe | ||
| - api.ShadowRoot.setHTMLUnsafe | ||
|
|
||
| # baseline: false | ||
| # support: | ||
| # chrome: "146" | ||
| # chrome_android: "146" | ||
| # edge: "146" | ||
| # firefox: "148" | ||
| # firefox_android: "148" | ||
| - api.Element.setHTML | ||
| - api.ShadowRoot.setHTML | ||
|
|
||
| # ⬇️ Same status as overall feature ⬇️ | ||
| # baseline: false | ||
| # support: {} | ||
| - api.CharacterData.afterHTML | ||
| - api.CharacterData.afterHTMLUnsafe | ||
| - api.CharacterData.beforeHTML | ||
| - api.CharacterData.beforeHTMLUnsafe | ||
| - api.CharacterData.replaceWithHTML | ||
| - api.CharacterData.replaceWithHTMLUnsafe | ||
| - api.DocumentType.afterHTML | ||
| - api.DocumentType.afterHTMLUnsafe | ||
| - api.DocumentType.beforeHTML | ||
| - api.DocumentType.beforeHTMLUnsafe | ||
| - api.DocumentType.replaceWithHTML | ||
| - api.DocumentType.replaceWithHTMLUnsafe | ||
| - api.Element.afterHTML | ||
| - api.Element.afterHTMLUnsafe | ||
| - api.Element.appendHTML | ||
| - api.Element.appendHTMLUnsafe | ||
| - api.Element.beforeHTML | ||
| - api.Element.beforeHTMLUnsafe | ||
| - api.Element.prependHTML | ||
| - api.Element.prependHTMLUnsafe | ||
| - api.Element.replaceHTML | ||
| - api.Element.replaceHTMLUnsafe | ||
| - api.Element.replaceWithHTML | ||
| - api.Element.replaceWithHTMLUnsafe | ||
| - api.Element.setHTMLUnsafe.options_runscripts_parameter | ||
| - api.ShadowRoot.afterHTML | ||
| - api.ShadowRoot.afterHTMLUnsafe | ||
| - api.ShadowRoot.appendHTML | ||
| - api.ShadowRoot.appendHTMLUnsafe | ||
| - api.ShadowRoot.beforeHTML | ||
| - api.ShadowRoot.beforeHTMLUnsafe | ||
| - api.ShadowRoot.prependHTML | ||
| - api.ShadowRoot.prependHTMLUnsafe | ||
| - api.ShadowRoot.replaceWithHTML | ||
| - api.ShadowRoot.replaceWithHTMLUnsafe | ||
| - api.ShadowRoot.setHTMLUnsafe.options_runscripts_parameter | ||
| - api.TrustedHTMLParserOptions | ||
| - api.TrustedHTMLParserOptions.runScripts | ||
| - api.TrustedHTMLParserOptions.sanitizer |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: HTML streaming setters | ||
| description: The `streamHTML()`, `streamReplaceWithHTML()`, `streamBeforeHTML()`, `streamPrependHTML()`, `streamAppendHTML()` and `streamAfterHTML()` DOM methods, and unsafe equivalents, return writeable streams that incrementally insert HTML into an existing tree. | ||
| spec: https://github.com/whatwg/html/pull/12758 | ||
| #TODO: replace with below and remove from specs.ts once about PR is merged | ||
| #spec: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization | ||
| group: dom | ||
| compat_features: | ||
| - api.CharacterData.streamAfterHTML | ||
| - api.CharacterData.streamAfterHTMLUnsafe | ||
| - api.CharacterData.streamBeforeHTML | ||
| - api.CharacterData.streamBeforeHTMLUnsafe | ||
| - api.CharacterData.streamReplaceWithHTML | ||
| - api.CharacterData.streamReplaceWithHTMLUnsafe | ||
| - api.DocumentType.streamAfterHTML | ||
| - api.DocumentType.streamAfterHTMLUnsafe | ||
| - api.DocumentType.streamBeforeHTML | ||
| - api.DocumentType.streamBeforeHTMLUnsafe | ||
| - api.DocumentType.streamReplaceWithHTML | ||
| - api.DocumentType.streamReplaceWithHTMLUnsafe | ||
| - api.Element.streamAfterHTML | ||
| - api.Element.streamAfterHTMLUnsafe | ||
| - api.Element.streamAppendHTML | ||
| - api.Element.streamAppendHTMLUnsafe | ||
| - api.Element.streamBeforeHTML | ||
| - api.Element.streamBeforeHTMLUnsafe | ||
| - api.Element.streamHTML | ||
| - api.Element.streamHTMLUnsafe | ||
| - api.Element.streamPrependHTML | ||
| - api.Element.streamPrependHTMLUnsafe | ||
| - api.Element.streamReplaceHTML | ||
| - api.Element.streamReplaceHTMLUnsafe | ||
| - api.Element.streamReplaceWithHTML | ||
| - api.Element.streamReplaceWithHTMLUnsafe | ||
| - api.ShadowRoot.streamAfterHTML | ||
| - api.ShadowRoot.streamAfterHTMLUnsafe | ||
| - api.ShadowRoot.streamAppendHTML | ||
| - api.ShadowRoot.streamAppendHTMLUnsafe | ||
| - api.ShadowRoot.streamBeforeHTML | ||
| - api.ShadowRoot.streamBeforeHTMLUnsafe | ||
| - api.ShadowRoot.streamHTML | ||
| - api.ShadowRoot.streamHTMLUnsafe | ||
| - api.ShadowRoot.streamPrependHTML | ||
| - api.ShadowRoot.streamPrependHTMLUnsafe | ||
| - api.ShadowRoot.streamReplaceWithHTML | ||
| - api.ShadowRoot.streamReplaceWithHTMLUnsafe |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Generated from: html-streaming-setters.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: false | ||
| support: {} | ||
| compat_features: | ||
| - api.CharacterData.streamAfterHTML | ||
| - api.CharacterData.streamAfterHTMLUnsafe | ||
| - api.CharacterData.streamBeforeHTML | ||
| - api.CharacterData.streamBeforeHTMLUnsafe | ||
| - api.CharacterData.streamReplaceWithHTML | ||
| - api.CharacterData.streamReplaceWithHTMLUnsafe | ||
| - api.DocumentType.streamAfterHTML | ||
| - api.DocumentType.streamAfterHTMLUnsafe | ||
| - api.DocumentType.streamBeforeHTML | ||
| - api.DocumentType.streamBeforeHTMLUnsafe | ||
| - api.DocumentType.streamReplaceWithHTML | ||
| - api.DocumentType.streamReplaceWithHTMLUnsafe | ||
| - api.Element.streamAfterHTML | ||
| - api.Element.streamAfterHTMLUnsafe | ||
| - api.Element.streamAppendHTML | ||
| - api.Element.streamAppendHTMLUnsafe | ||
| - api.Element.streamBeforeHTML | ||
| - api.Element.streamBeforeHTMLUnsafe | ||
| - api.Element.streamHTML | ||
| - api.Element.streamHTMLUnsafe | ||
| - api.Element.streamPrependHTML | ||
| - api.Element.streamPrependHTMLUnsafe | ||
| - api.Element.streamReplaceHTML | ||
| - api.Element.streamReplaceHTMLUnsafe | ||
| - api.Element.streamReplaceWithHTML | ||
| - api.Element.streamReplaceWithHTMLUnsafe | ||
| - api.ShadowRoot.streamAfterHTML | ||
| - api.ShadowRoot.streamAfterHTMLUnsafe | ||
| - api.ShadowRoot.streamAppendHTML | ||
| - api.ShadowRoot.streamAppendHTMLUnsafe | ||
| - api.ShadowRoot.streamBeforeHTML | ||
| - api.ShadowRoot.streamBeforeHTMLUnsafe | ||
| - api.ShadowRoot.streamHTML | ||
| - api.ShadowRoot.streamHTMLUnsafe | ||
| - api.ShadowRoot.streamPrependHTML | ||
| - api.ShadowRoot.streamPrependHTMLUnsafe | ||
| - api.ShadowRoot.streamReplaceWithHTML | ||
| - api.ShadowRoot.streamReplaceWithHTMLUnsafe |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,5 @@ | ||
| name: Unsanitized HTML parsing methods | ||
| description: The `Document.parseHTMLUnsafe()` static method parses HTML into a DOM tree, while the `setHTMLUnsafe()` method of `Element` and `ShadowRoot` parses and inserts HTML into an existing tree. No sanitization applies to these methods, so never call them with user-provided HTML strings. | ||
| spec: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#unsafe-html-parsing-methods | ||
| # TODO: https://github.com/web-platform-dx/web-features/issues/1971 | ||
| # Status changed: https://github.com/web-platform-dx/web-features/pull/3200 | ||
| # 2025-08-06 - low → false - In Safari, if there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors and `connectedCallback()` methods are not called. | ||
| # References: | ||
| # - https://bugs.webkit.org/show_bug.cgi?id=296420 | ||
| name: Unsanitized HTML parsing | ||
| description: The `Document.parseHTMLUnsafe()` static method parses HTML into a DOM tree, much like the `setHTMLUnsafe()` DOM method inserts HTML into an existing tree. No sanitization applies, so never call it with user-provided strings. | ||
| spec: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization | ||
| compat_features: | ||
| - api.Document.parseHTMLUnsafe_static | ||
|
ddbeck marked this conversation as resolved.
|
||
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.