Re: [csswg-drafts] [css-cascade][css-pseudo] How does 'inherit' keyword behave in a child of ::first-line?

At first sight, Firefox seems the most flexible and useful. But `::first-line` is enough problematic by itself to add CSS variables into the mix.

I was testing, and setting `display: none` via a CSS variable in `::first-line` can create a shrink-to-fit block ([bug 8858465](, but then, removing the variable and readding it with JS, does hide the element. It's also easy to produce a crash ([bug 1356601]( Things like this happen because `::first-line` depends on the box tree, the box tree depends on the `display` values, and `display` depends on `::first-line` via CSS variables.

So I think it would be better to say CSS variables do not apply to `::first-line`, and fragments inside `::first-line` inherit CSS variables through the element tree, ignoring `::first-line`.

Alternatively, CSS variables could have two values: one inherited through the element tree, and other taking `::first-line` into account. Properties which affect the box tree (display, float, position, content, ...) would see the value inherited through the element tree. This would allow to construct the box tree with the `::first-line`. Properties which don't affect the box tree would see the value inherited taking `::first-line` into account. Dynamically updating a properties which affects the box tree would still read the value inherited through the element tree, otherwise it's nonsense.

But this approach can be problematic, e.g. if a new feature allows an old property to affect the box tree. And given the great amount of bugs related to `::first-line` despite being an old pseudo-element, I'm reticent to think this can end up working properly. For implementators, it's probably not worth the effort.

So despite CSS variables applying to `::first-line` in all major implementations, I think this should change.

GitHub Notification of comment by Loirooriol
Please view or discuss this issue at using your GitHub account

Received on Sunday, 16 April 2017 20:25:55 UTC