[csswg-drafts] [css-pseudo] ::first-line when first child is an empty block

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

== [css-pseudo] ::first-line when first child is an empty block ==
[CSS Pseudo-Elements says](https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo)

> The ::first-line pseudo-element describes the contents of the first formatted line of its originating element.

However, what happens when the first child is an empty block?

Example: https://jsfiddle.net/oyw62a3t/

```html
<div><p></p>Foo</div>
```
```css
div { color: red; }
div::first-line { color: green; }
```

I think the `p` element contains no line, so the first line is Foo. However, Foo is red on Firefox, Chrome and Edge. Is that expected? If so, I think the spec should be clarified. Maybe provide an algorithm like

 - If a block container box has only block-level boxes inside it, its `::first-line` is nested just outside the `::first-line` of the first block-level child.
 - If a block container box has only inline-level boxes inside it, its `::first-line` is nested inside it, containing the inline-level boxes in the first line box, if any.

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

Received on Saturday, 1 April 2017 19:59:00 UTC