Re: [csswg-drafts] [css-pseudo] Add a ::contents pseudo-element

> `@text` does a similar thing?

I understand that `@text`/`::text` only contain text. Imagine I have

```html
<section>
  <div>
    This <span>contains</span> a mix of <i>text</i> and <b>elements</b>
  </div>
</section>
```
```css
section { display: flex }
div { display: contents }
div::before, div::after { content: "" }
div::contents { display: block }
```

results in this box tree:

 - `<section>`: flex container
   - `<div::before>`: flex-level block container
   - `<div::contents>`: flex-level block container
     - `This `: text-run
     - `<span>`: inline element
       - `contains`: text-run
     - ...
   - `<div::after>`: flex-level block container

Using `::text` would result in

 - `<section>`: flex container
   - `<div::before>`: flex-level block container
   - `<div::text#1>`: flex-level block container
     - `This `: text-run
   - `<span>`: flex-level block container
     - `contains`: text-run
   - `<div::text#2>`: flex-level block container
      - ` a mix of `: text-run
   - ...
   - `<div::after>`: flex-level block container

Completely different.

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

Received on Friday, 9 March 2018 15:12:03 UTC