w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.43k stars 656 forks source link

[css-selectors] repeating selectors #2792

Open Wes0617 opened 6 years ago

Wes0617 commented 6 years ago

Hello,

section > div repeat(> ul > li) { /* ... */ }

which is equal to writing 

section > div > ul > li,
section > div > ul > li > ul > li,
section > div > ul > li > ul > li > ul > li,
section > div > ul > li > ul > li > ul > li > ul > li,
section > div > ul > li > ul > li > ul > li > ul > li > ul > li,
... {}

The specificity would be the same of the matched "splatted" selector. Having this would solve a lot of problems derived from too generic css selectors' specificity that designers often encounter.

Would this make sense to have in your opinion?

Thank you for reading this. This is my third request in very short time, I promise I will shut up now :-P

jonjohnjohnson commented 6 years ago

Would the toggle() expression solve most of what you're needing for this example?

https://drafts.csswg.org/css-values-4/#toggle-notation

fantasai commented 5 years ago

@Netmosfera Can you respond to @jonjohnjohnson's question, please? It's not entirely clear what you're trying to do...