- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Fri, 09 Mar 2018 00:54:53 +0000
- To: public-css-archive@w3.org
> Do you agree that having an element-style selector instead of a pseudo element type selector is more flexible I agree that exploring element-style selectors for tree-abiding pseudo-elements may be interesting. But I think of it as a separate selector-specific feature, not intrinsically related to nor as a replacement of `::text` or `::contents`. In fact I don't understand why you think `@text` would be better than `::text`. Even if `section @text` has less precedence than `section p`, the text inside the paragraph will be matched by `section @text` and use its color instead of `section p`s one, right? > Where would you see benefits of having `::contents` over @text? - I may want to take some element out-of-flow like in absolutely positioning, but still reserve some space where it would be with static positioning. Easy: ```css #target { width: 100px; height: 100px; } #target::contents { display: block; position: absolute } ``` - I may want to generate `::after` outside the element, e.g. the element is a flex item and I want `::after` to participate in the same flex formatting context. Easy: ```css #target { display: contents } #target::after { content: "" } #target::contents { display: block } ``` - I may want the contents of an element to be wrapped in a stacking context separated from `::after`, e.g. because I want to ensure `::after` will overlap the contents even if there is some descendant with `z-index: 99999999999999`. Easy: ```css #target::contents { display: block; position: relative; z-index: 0 } #target::after { content: ""; position: relative; z-index: 1 } ``` Etcetera. `::content` can be used in all cases where text is not intrinsically involved. `::text` would only work if the element in question only contained text nodes. -- GitHub Notification of comment by Loirooriol Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2406#issuecomment-371676960 using your GitHub account
Received on Friday, 9 March 2018 00:55:15 UTC