[w3c/DOM-Parsing] fragment parsing algorithm appears to be wrong when invoked from innerHTML setter of template element (#61)

It's possible there's some other piece here that I'm missing, but it looks like https://w3c.github.io/DOM-Parsing/#dfn-fragment-parsing-algorithm tells us to make a document fragment on the node document of the context element, and then append nodes to it. This has the potential to enqueue upgrade reactions on those nodes if they match custom element definitions.

However, if we're setting the innerHTML of a template, we want to stay away from the node document of that template element, using the associated inert template document instead and not enqueuing upgrade reactions.

https://w3c.github.io/DOM-Parsing/#dom-innerhtml distinguishes the template as a special case, but only _after_ it's already done calling the fragment parsing algorithm; the upgrade reactions have already been queued before we check if the context object is a template.

The second case of this WPT test checks when upgrades happen in this situation, and browsers are passing it, which implies the specification isn't matching browser behavior: https://github.com/web-platform-tests/wpt/blob/master/custom-elements/reactions/Document.html

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/DOM-Parsing/issues/61

Received on Tuesday, 11 February 2020 22:23:26 UTC