W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2018

Re: [csswg-drafts] [css-shadow-parts-1] Can class name selectors apply to a part? (#3431)

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Tue, 11 Dec 2018 23:26:12 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-446401804-1544570770-sysbot+gh@w3.org>
No, this isn't possible, by design.

The point of ::part is to hide the internal details of the component, and expose only exactly the parts the component author explicitly wants to. Random classes are an internal detail; there's no telling what use the component author has for them, or whether they're appropriate for outside code to use.

One can give a single element multiple part names, and differentiate state based on that. I also *thought* that you could do, say, `::part(one two)` to select only elements with both part names, but it turns out you can't; that's probably something we want to add, so you can more easily add a "selected" part name in your example, and then use `::part(tab-button selected)`.

@fergald , what do you think?

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3431#issuecomment-446401804 using your GitHub account
Received on Tuesday, 11 December 2018 23:26:13 UTC

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