On Wed Jun 5 15:20:42 2024 +0000, Gabriel Ivăncescu wrote:
I see. In fact it does look like doc frags don't have `html` tags at all, even on Windows:
var docfrag = document.createDocumentFragment(); ok(docfrag.querySelector("html") === null, "html tag in doc frag");
(IE8+ since previous ones don't expose querySelector) So maybe your approach is correct, maybe Jacek has an idea.
I suspect some similar mechanism to clipboard data handing is in play; it probably feels the document fragment to full document on parse. That does rise some questions like what happens if you pass a string containing, for example, `<body>` element.
Anyway, for such an obscure feature, it's likely that digging too deep doesn't make much sense; those old APIs tend to differ badly from what we can get from Gecko. I will have some minor comments, but overall I guess that's fine.