WICG / sanitizer-api

https://wicg.github.io/sanitizer-api/
Other
226 stars 31 forks source link

Compatibility with new `setHTMLUnsafe` and `parseHTMLUnsafe` methods/Declarative Shadow Roots #236

Open shgysk8zer0 opened 2 months ago

shgysk8zer0 commented 2 months ago

Element.prototype.setHTMLUnsafe and the ShadowRoot equivalent, along with Document.parseHTMLUnsafe have recently landed in browsers, and I assume were at least influenced by what's mentioned here. However, I do not believe I've seen any mention of declarative shadow roots/handling of <template shadowrootmode="..."> here, nor if the following holds true for the "safe" versions here:

The setHTMLUnsafe() method of the Element interface is used to parse a string of HTML into a DocumentFragment, which then replaces the element's subtree in the DOM. The input HTML may include declarative shadow roots.

If the string of HTML defines more than one declarative shadow root in a particular shadow host then only the first ShadowRoot is created — subsequent declarations are parsed as