[Bug 26365] [Shadow]: Need an equivalent definition of 'in a Document' for shadow trees

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365

--- Comment #43 from Hayato Ito <hayato@chromium.org> ---
(In reply to Olli Pettay from comment #41)
> So I think if one overrides existing shadow dom of an element without
> providing shadow insertion point for the old shadow tree, I would expect the 
> elements in that older shadow tree to stop behaving as if they where
> still in document. Say, you have an <iframe> there, and the younger 
> shadow tree just wants to override all that with something more lightweight
> (and not provide <shadow>). I think the <iframe> should be unloaded as if it
> was
> removed from document.

Yeah, that's a good point and that's one of the potential issue in idea A.

I think the concern comes from the fact that there is no way to get rid of the
existing old shadow trees completely from the shadow host in the current API
set of Shadow DOM.
The reason we don't have such an API is that I've not heard the requirement for
the removal, AFAIK.
I guess much attention has not been paid to such a wasteful resource, which
would be consumed by *overridden* shadow trees, because that's a rare use case.

I'm okay to add such an API if this would be a non-ignorable use case and
developers would start to complain about this kind of wastefulness.


(In reply to Boris Zbarsky from comment #39)
> This comes down to questions like whether a non-distributed <iframe> should
> load its document, whether a non-distributed <style> should affect the
> styles of nodes, whether a non-distributed <link rel="stylesheet"> should
> load a stylesheet, whether a non-distibuted <embed> that was at one point
> distributed should continue running the plugin it loaded, whether a media
> element that stops being distributed should pause, whether non-distributed
> form controls should associate to forms, what should happen with showModal
> on a non-distributed <dialog>, whether a <script> inserted under a
> non-distributed node should run, etc.
> 
> Note that it might turn out that the answers are different in those various
> different situation, in that some of them want non-distributed elements to
> act as if they were in a document and others don't...

Yeah, that's a good point. That should be always on my radar, however, it seems
I forgot to mention that in my recent posts.

The basic idea in my head is:
  - We should treat such elements so that we got the equivalent result to "They
were in a document (in a traditional meaning), but it is marked 'display:
none'.

For example:

- As for <script> element, we have to run the <script> 'in a document deeply,
but not in the document-rooted composed tree', as long as <script> in a
document runs even if it is marked with 'display: none'.
- As for <iframe> element, we have to load the resources from <iframe> 'in a
document deeply, but not in the document-rooted composed tree' as long as
<iframe> 'in a document' loads resources even if this is marked with 'display:
none'.

Of course, there should be a exception. For example, the current spec disables
the capability of the <link> and <base> elements in shadow trees as if they
were in a document fragment. The answers should be different in those various
different situation as you mentioned.

I'd expect the my basic idea covers the most cases, hopefully.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 13 November 2014 07:27:34 UTC