Bug 21389 - [Shadow]: ::distributed should allow the :root pseudo selector
Summary: [Shadow]: ::distributed should allow the :root pseudo selector
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
Depends on:
Blocks: 14978 21499
  Show dependency treegraph
Reported: 2013-03-25 18:48 UTC by Steve Orvell
Modified: 2013-04-01 22:52 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Steve Orvell 2013-03-25 18:48:47 UTC
Now that it's possible to use ::distributed to style the nodes distributed to a given insertion point, the spec needs to clarify how this can be used to make selectors that match starting from distributed nodes themselves.

In general, one wants to be able to style the distributed nodes using complex css selectors:

/* style match .bar with .foo matching ancestors */
content::distributed(.foo .bar) {

However, it's common to want to create selectors that start at the distributed nodes themselves. The :root selector could be use for this purpose (http://dev.w3.org/csswg/selectors4/#the-root-pseudo).

/* match .bar descendants of distributed children matching .foo */
content::distribute(.foo:root .bar) {
Comment 1 Dominic Cooney 2013-03-26 00:55:59 UTC
I think this should be :scope and not :root.

As you can see in the scoping section of the CSS4 Selectors spec [1] "The :root pseudo-class, however, still only matches the actual root of the document." even when doing a scope-contained selector.

Perhaps we can use :scope [2] for this, with the awkwardness that the ShadowRoot now becomes addressable despite not being style-able, and you have to write content::distributed(:scope > .foo .bar) to mean what you want.

[1] <http://dev.w3.org/csswg/selectors4/#scoping>
[2] <http://dev.w3.org/csswg/selectors4/#the-scope-pseudo>
Comment 2 Dimitri Glazkov 2013-03-26 00:58:37 UTC
See this thread for discussion: http://lists.w3.org/Archives/Public/www-style/2013Mar/thread.html#msg581
Comment 3 Dominic Cooney 2013-03-26 02:13:56 UTC
Sounds good. Thanks for the link.
Comment 4 Hayato Ito 2013-04-01 06:55:51 UTC
Let me close the bug in favor of scope-relative selectors.