Re: [csswg-drafts] [css-pseudo-5] ::text / ::text-node pseudoelement (#2208)

A pseudo element like `::text` would have its benefits, but I'm still trying to figure out how to use it in the following use case:

HTML:
```html
<p class="message">
     Hi there
     <span class="emoji-native" id="1">😋</span>
     this is cool!
     <span class="emoji-native" id="2">😍</span>
     <span class="emoji-native" id="3">😍</span>
<p>
```

CSS:
```css
.emoji-native {
      margin: 0 3px;
}
.emoji-native + .emoji-native {
      margin-left: 0px;
}
```

Basically in this example I want to consider `::text` as a node between the two `.emoji-native` nodes when using the `+` operator, but it turns out it simply ignores it and adds that CSS on both ID `2` and `3`.

To be honest I don't see a syntax that would make this work, and this would be the first time a pseudo element would contain actual written HTML code in the source file, so this feels totally out of context. I would vouch though for a new kind of element that would represent displaced text written directly into the source code, or even a simple "invisible" `<text>` HTML tag that represents all texts that are siblings to actual nodes. Still, this need a lot of thought to not create something that doesn't make sense.

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


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

Received on Monday, 28 June 2021 18:36:53 UTC