[csswg-drafts] Proposol to allow definition of arbitrary number of pseudo-elements (#6169)

GCSBOSS has just created a new issue for https://github.com/w3c/csswg-drafts:

== Proposol to allow definition of arbitrary number of pseudo-elements ==
### Disclaimer
I imagined this would have been proposed three gazillion times by now. 
Though I haven't found anything meaningful on the internet.
Therefore here we go.

### Proposal
I propose a language feature to allow authors to define an arbitrary number of pseudo-elements similar to `::before` and `::after`.

### Benefits
- Generally increased design possibilities due to having more elements to work with
- Possible reduction to DOM pollution (i.e non-semantic elements added for styling purposes)
- Possible reduction of DOM script complexity due to fewer elements having to be created by authors via javascript

I'm surely missing some good benefits here.

### Problems
I am not really sure. Certainly, you people have great experience in spotting CSS proposal loopholes. Thank you!

### Syntax
Here goes the first syntax that comes to mind.
```css
p::leading(1) {
    /* First pseudo-element */
}

p::leading(2) {
    /* Second pseudo-element */
}

/* ... So on */

p::trailing(1) {
    /* First pseudo-element after last child */
}

p::trailing(2) {
    /* Second pseudo element after last child */
}

/* ... So on */
```

### References
I'm gonna quote this old article because yes.
- https://css-tricks.com/use-cases-for-multiple-pseudo-elements/

---

PS.: It's the first time I post in here, so please (and sorry), let me know if I'm doing anything wrong.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6169 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 31 March 2021 21:42:49 UTC