Re: [csswg-drafts] [css-pseudo] Add a ::contents pseudo-element (#2406)

> 
> 
> The old CSS 3 Content was killed with fire and allowed the creation of pseudo-elements _outside_ the element, which is not consistent with `::before` and `::after` and is less useful.
> 
> Additionally, it allowed nested pseudo-elements, which either meant that they were created by the selector (ugly) or that the element tree was infinite (hard to implement?). I purposely avoided this feature in my proposal, at least for the moment.
> 
> I had seen the `::wrap` proposal in #588. Frankly, I believe it's completely unrealistic. It seems amazing at first glance, but it allows aberrations like
> 
> ```css
> #parent > :nth-child(1)::wrap(2), /* wrapper #1 */
> #parent > :nth-child(2)::wrap(2)  /* wrapper #2 */
> {border: thick solid lime}
> ```
> 
> ```
> <div id="parent">
>   <div>1</div> <!-- belongs to wrapper #1 -->
>   <div>2</div> <!-- belongs to wrappers #1 and #2 -->
>   <div>3</div> <!-- belongs to wrapper #2 -->
> </div>
> ```
> 
> So the result is not really a tree! I prefer to avoid this can of worms.
> 
> But I believe my `::contents` is completely feasible (if there is implementation interest).

I'm not sure I understand you. Your CSS code example seems pretty normal. I don't know why it would lead to your HTML code example.

-- 
GitHub Notification of comment by ianthedev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2406#issuecomment-542478179 using your GitHub account

Received on Wednesday, 16 October 2019 02:07:11 UTC