W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: Need a better way to reach into the shadow DOM subtree

From: David Hyatt <hyatt@apple.com>
Date: Mon, 11 Apr 2011 17:02:34 -0500
Cc: Dimitri Glazkov <dglazkov@google.com>, "www-style@w3.org" <www-style@w3.org>
Message-id: <946F0C6C-FF9E-4893-84AE-0ABC39248B89@apple.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
On Apr 11, 2011, at 4:26 PM, Boris Zbarsky wrote:

> On 4/11/11 12:50 PM, Dimitri Glazkov wrote:
>> video::-webkit-timeline:disabled { /* ... */ }
>> How do we fix this? Tab suggests a new combinator selector like:
>> video % timeline:disabled.
>> I like it. Who's with me and Tab? :)
> I believe |video > timeline:disabled| or |video timeline:disabled| work in both XBL1 and in the XBL2 proposals I last saw, if the binding allows it.
> Why do we need to invent special syntax here?

They work in XBL1 because the shadow tree is fully exposed by default instead of being cut off.  I believe XBL2 changes the default such that the shadow tree is encapsulated and cut off by default.  You can open up (or close off) the whole shadow tree via a flag in both XBL1/2, but that's not exactly ideal, since then the private details of your shadow tree are exposed.  Basically it's all or nothing with the style sheet switch.

XBL2 has a limited form of the pseudo-element feature as Tab mentioned in a previous message, and this allows you to expose only certain elements within your shadow tree to author styling.  Effectively you designate pieces of your component's shadow tree as representing some public content that you are willing to allow authors to style.

The best argument in favor of pseudo-elements in my mind is that XBL is just an implementation detail.  Pseudo elements allow someone else to implement the same element (say a form control) in native code or via a completely different mechanism and still support the same kind of styling.  If you use child or descendant selectors instead, you're exposing the fact that there is a shadow tree and possibly getting into the internals of a shadow tree that might vary from implementation to implementation (or even from platform to platform within the sam engine).

Received on Monday, 11 April 2011 22:03:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:45 UTC