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

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.

Thoughts?

~TJ

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