Re: [whatwg/dom] shadowRoot.innerHTML parsing elements from another realm/iframe (#977)

> I'm not following. Both of those options seems to result in creating HTMLParagraphElement in the realm of the main window since the shadow host is in the main document at that point? The only reasonable option I can think of creating HTMLParagraphElement of the iframe's realm will be if we did the interface lookup via the global object of this in innerHTML's setter.

I think you are right for "Use the element interface from the global associated to the document passed to "create an element"". The fragment parsing algorithm ends up being based on `elmFromAnotherDoc`'s node document, which is the main document because of adoption.

For "Use the element interface from the current global object (i.e. the global object of the innerHTML setter)", I think the subframe is correct, because the innerHTML setter is `iframe.contentWindow.ShadowRoot`'s `innerHTML` setter. This is because  `elmFromAnotherDoc.__proto__ === Bar`, `elmFromAnotherDoc.__proto__.__proto__ == iframe.contentWindow.HTMLElement.prototype`, so `elmFromAnotherDoc.shadowRoot` will return an instance of `iframe.contentWindow.ShadowRoot`. I am pretty sure? (But, I keep being wrong in this thread...)

Anyway, laying out all the possible behaviors isn't too important. The question is what the behavior should be. Probably we should make `<p>` match `<x-bar>`? I think the conclusion of all this is that the simplest way to do that would be to specify the global to be the global of the document passed to "create an element". Then they would both use the main document.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/977#issuecomment-838910815

Received on Tuesday, 11 May 2021 17:55:27 UTC