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

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 UTC