- From: Ryosuke Niwa <notifications@github.com>
- Date: Mon, 10 May 2021 21:01:52 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/977/837757855@github.com>
> I think the `<p>` case is still not clear though, since step 7.1 of [create an element](https://dom.spec.whatwg.org/#concept-create-element) is not specific about which window to look up the element interface in. (I guess the HTMLElement and HTMLUnknownElement in step 6 has a similar problem, for the intermediate period between the insertion and the upgrade...). I'd say there are at least two plausible choices: Yeah, none of those specify in which realm we'd be looking up the interfaces, which is ambiguous given what you've discovered. > * Use the element interface from the global associated to the document passed to "create an element" > * Use the element interface from the current global object (i.e. the global object of the innerHTML setter) > > In this case they are equivalent and equal to the other window (so `<p>` should not be from the main window, I think, so Chrome's behavior is correct?). 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. Arguably this behavior is a bit strange / unlike other JS objects since the following code will return `false` but I think it's a necessary oddity that arises from the fact `Node` has the ability to get adopted to another document and change its associated document: ``` iframeRange = document.body.appendChild(document.createElement('iframe')).contentDocument.createRange(); iframeRange.selectNode(document.body); iframeRange.cloneRange().__proto__ == document.createRange().__proto__ ``` -- 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-837757855
Received on Tuesday, 11 May 2021 04:02:05 UTC