Re: [whatwg/fullscreen] Update fullscreen spec to be Shadow DOM compliant (#54)

foolip commented on this pull request.



> -<var>element</var>'s <a>fullscreen flag</a> and <a>add</a> it to <var>document</var>'s
-<a>top layer</a>.
-
-<p>To <dfn>unfullscreen an <var>element</var></dfn> within a <var>document</var>, unset the
-<var>element</var>'s <a>fullscreen flag</a> and <a>iframe fullscreen flag</a> (if any), and
-<a>remove</a> it from <var>document</var>'s <a>top layer</a>.
-
-<p>To <dfn>unfullscreen a <var>document</var></dfn>,
+<p>All <a>document trees</a> have an associated <dfn>fullscreen element</dfn>. The
+<a>fullscreen element</a> is the topmost <a>element</a> in the <a>document tree</a>'s
+<a>top layer</a> whose <a>fullscreen flag</a> is set, if any, and null otherwise.
+
+<p>To <dfn>fullscreen an <var>element</var></dfn> within a <a>document tree</a> whose root is
+<var>document</var>, set the <var>element</var>'s <a>fullscreen flag</a> and <a>add</a> it to
+<var>document</var>'s <a>top layer</a>. If the <var>element</var> is in a <a>shadow tree</a>,
+set <a>fullscreen flags</a> of all <a>shadow hosts</a> in its <a>shadow-including ancestors</a>.

It would be odd I think if `document.fullscreenElement` is a shadow host with the "top" fullscreen element inside, if that element doesn't match the `:fullscreen` selector like an `iframe` would in the same scenario.

That `:fullscreen` matches any element with the fullscreen flag set is a recent change: 4a2644a888bf04bcf9286f969bc750bcd16ff349. On the benefits, it should avoid unnecessary style changes to elements which (usually) aren't visible, and it makes the selector matching trivial.

Still, I'm pretty sure that just walking the ancestor shadow hosts and setting/unsetting their fullscreen flags when fullscreening/unfullscreening an element isn't workable. Take this case:
```
<top-level-host>
 <#shadow-root>
  <inner-host-1>
   <#shadow-root>
    <fullscreen-element-1/>
   </#shadow-root>
  </inner-host-1>
  <inner-host-2>
   <#shadow-root>
    <fullscreen-element-2/>
   </#shadow-root>
  </inner-host-2>
 </#shadow-root>
</top-level-host>
```

If `fullscreen-element-1` goes fullscreen, then `fullscreen-element-2` and then `fullscreen-element-1` is removed and thus unfullscreened, then `top-level-host` mustn't have its flag unset.

-- 
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/fullscreen/pull/54

Received on Friday, 16 September 2016 12:14:11 UTC