09:02
<Luke Warlow>

To anyone who knows about DSD:

Should data:text/html,<div id="foo"></div><script>foo.setHTMLUnsafe('<template shadowrootmode="open"><h1>Foo</h1></template>')</script> create a shadow root for the div, or simply insert a document fragment? It feels like this should work for DSD to me, but currently in Chromium, Gecko and WebKit it inserts a document fragment. Ladybird however creates a shadow root.

So now I'm wondering who's correct?

09:08
<sideshowbarker>
I wonder if the difference may be due to Ladybird strictly implemented what’s actually spec’ed
09:08
<sideshowbarker>
Or maybe in different words that’s the same thing you’re asking
09:09
<Luke Warlow>
Yeah essentially I'm trying to work out if I should raise a bug with ladybird or with the other 3. It feels to me and to the person who found the current behaviour like Ladybird is correct with what is expected. From a quick glance at the spec ladybird seems right too but I'm only familiar with the surface level of the API.
09:11
<Noam Rosenthal>
yes it is
11:05
<annevk>
Luke Warlow: doesn't that create a Document with an html root node and parses template into that? Why would that create a shadow tree for the div?
11:07
<Luke Warlow>
parseHTMLUnsafe creates a new document. I don't think setHTMLUnsafe does?
11:08
<annevk>
Luke Warlow: that's step 1 of fragment parsing, afaict
11:09
<Luke Warlow>
Ah wait yeah just spotted that. Must have skipped over that. I assumed the context element was used more exhaustively than it is. But it looks like it maybe just sets the initial parser state?
11:11
<Luke Warlow>
Ah but wait then it does append a copy of the context element into the stack. I assume when it later does the replacement that the DSD gets swapped out for a doc fragment because the parent elements don't match?
11:13
<annevk>
I don't think the context element gets onto the stack. "the adjusted current node is not the topmost element in the stack of open elements," is why we just insert the template element.
11:15
<Luke Warlow>
Step 11 here sounds like it does something, but you're right it doesn't seem to actually end up in the stack? https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-parsing-algorithm
11:15
<Luke Warlow>
Either way thanks! I'll raise an issue with Ladybird (and WPT) and just keep in mind that it needs the container element for context in the source string to parse
11:15
<annevk>
Yeah, modernizing the HTML parser would be nice. Lots of implicit nonsense.
11:18
<annevk>
Luke Warlow: attachHTMLShadow() or some such could be interesting, maybe. Would be quite a bit of work though.
16:59
<annevk>
keithamus: can you review https://github.com/whatwg/html/pull/11053 please?
18:03
<keithamus>
keithamus: can you review https://github.com/whatwg/html/pull/11053 please?
LGTM!