W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2017

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

From: Loirooriol via GitHub <sysbot+gh@w3.org>
Date: Sun, 16 Apr 2017 20:25:48 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-294372288-1492374346-sysbot+gh@w3.org>
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](https://bugzilla.mozilla.org/show_bug.cgi?id=1356739)), but then, removing the variable and readding it with JS, does hide the element. It's also easy to produce a crash ([bug 1356601](https://bugzilla.mozilla.org/show_bug.cgi?id=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 https://github.com/w3c/csswg-drafts/issues/1097#issuecomment-294372288 using your GitHub account
Received on Sunday, 16 April 2017 20:25:55 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 10:12:53 UTC