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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 11 Apr 2011 14:58:09 -0700
Message-ID: <BANLkTi=GSYXSMTQHUMN8Rd1NOvo2z_LATA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: Dimitri Glazkov <dglazkov@google.com>, "www-style@w3.org" <www-style@w3.org>
On Mon, Apr 11, 2011 at 2:26 PM, Boris Zbarsky <bzbarsky@mit.edu> 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?

XBL exposes the shadow tree directly (if allow-selectors-through is
true), which is explicitly an anti-goal here, for at least two
reasons:

1. It makes the selector tree not match the source tree, without an
explicit indication that something weird is going on.  Components
should, in general, look like and act like normal elements, so that
ordinary selectors act in expected ways.  (For example, "details > p"
should match the <p> in "<details><p>foo</p></details>", even if the
implementation puts a shadow wrapper around the contents.

2. It exposes the entire shadow tree.  Part of the usefulness of the
shadow tree is hiding ugly implementation details, so that you can,
for example, implement a particular element using multiple <div>s
without exposing that dirty markup to the page.  Instead, we'd prefer
exposing only selected component-author-chosen pieces of the
component.  (Hyatt already lodged a strong complaint against anything
that selects into the raw shadow tree, rather than selecting from
among a curated set of elements in the shadow.)

~TJ
Received on Monday, 11 April 2011 21:58:56 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT