W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2017

Re: [csswg-drafts] [css-scoping-1] should shadow-piercing descendant combinator (>>>) still be in specification

From: Dylan Barrell via GitHub <sysbot+gh@w3.org>
Date: Mon, 03 Apr 2017 04:21:11 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-291045665-1491193270-sysbot+gh@w3.org>
So I just figured out that we cannot use this combinator to achieve what we want. If you'd like to follow along, please take a look at this page: http://dylanb.github.io/shadowDOM/v1_menu_example.html

If you run this code: `document.querySelectorAll('div >>> ul.menucontainer')`, you will see it selects 3 elements

You can create a unique selector to select the last two of these elements, these selectors are:

document.querySelectorAll('div > li:nth-of-type(2) >>> ul.menucontainer')
document.querySelectorAll('div > li:nth-of-type(1) >>> ul.menucontainer')

however there is no unique selector for the first one. In other words, when you have shadow DOM inside shadow DOM, you can only be guaranteed to uniquely address elements in the shadow DOM that are direct descendants of a light DOM node AND have no children with shadow roots. For all other elements in the shadow DOM, there is no selector that can be guaranteed to be unique.

What I really need is a "single level piercing selector"

GitHub Notification of comment by dylanb
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/640#issuecomment-291045665 using your GitHub account
Received on Monday, 3 April 2017 04:21:17 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:10 UTC