This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21389 - [Shadow]: ::distributed should allow the :root pseudo selector
Summary: [Shadow]: ::distributed should allow the :root pseudo selector
Status: RESOLVED WONTFIX
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
URL:
Whiteboard:
Keywords:
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:


Attachments

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.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21486