W3C home > Mailing lists > Public > www-style@w3.org > February 2014

[shadow-styling] /shadow vs /shadow-all

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 10 Feb 2014 15:57:09 -0800
Message-ID: <CAAWBYDDi954c1hYKHUMAKH-xkbW0-t5Ywi+k9-8v4kMKqjZMzw@mail.gmail.com>
To: www-style list <www-style@w3.org>
The /shadow-all combinator is exactly the older ^ combinator from
previous updates.  I added the /shadow combinator (which only selects
the top-level elements in the shadow tree) based on suggestions from
Boris and Jonas that there should be an easy way to select into a
shadow tree without implicitly invoking a descendant combinator, due
to the performance implications of descendant combinators.

My coworker Elliot pointed out privately, though, that moving only
into the top-level elements makes the styling more brittle - if the
component author rearranges their shadow DOM so that something isn't a
child anymore, it'll break users.

He'd prefer that the shortest name go to something that isn't as
brittle.  He also pointed out that, with bottom-up selector matching,
there's not actually any real cost difference between /shadow and
/shadow-all, since you can always cheaply jump from an element in a
shadow tree directly up to the shadow host in any reasonable
implementation.  (For the same reasons that any element can cheaply
jump up to the document in any reasonable implementation.)

This seems compelling to me.  I'd like to swap things around to have
/shadow be the old ^ combinator, where it selects all the elements in
the shadow tree, and either rename the "only top-level elements" one
to /shadow-child, or just kill it and rely on use of :top to handle
this use-case.


Received on Monday, 10 February 2014 23:57:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:19 UTC