- From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
- Date: Sun, 11 Feb 2018 19:49:15 +0000
- To: public-css-archive@w3.org
_It has been brought to my attention that I read Tab's proposal way too fast. I thought the script-based bit was an essential part of it._
Functionally, my proposal is the same as the first part of https://tabatkins.github.io/specs/css-aliases/#custom-selectors
Repeated here, that proposal is:
> A ***custom selector*** is defined with the `@custom-selector` rule:
>
> ```
> @custom-selector = @custom-selector <extension-name> <selector> ;
> ```
>
> This defines a custom selector which is written as a pseudo-class with the given `<extension-name>`, and represents a `:matches()` selector using the provided `<selector>` as its argument.
>
> For example, if an author wanted to easily refer to all heading elements in their HTML document, they could create an alias:
>
> ``` css
> @custom-selector :--heading h1, h2, h3, h4, h5, h6;
>
> :--heading { /* styles for all headings */ }
> :--heading + p { /* more styles */ }
> /* etc */
> ```
So, I'm totally supportive of that syntax, too. Even if `:--x` is kind of kooky looking. To make the two proposal consistent from a CSS parsing perspective, you'd need to say that any pseudoselector starting with `:--` is valid for parsing, although it wouldn't match anything unless a corresponding `@custom-selector` is also defined.
--
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2298#issuecomment-364781737 using your GitHub account
Received on Sunday, 11 February 2018 19:49:25 UTC