Re: [css4-selectors] Pseudo-class for writing mode

The problem is more complex than just the case Tab outlined. Circual 
dependencies could be worked out, even if in a hacky way (we already do that 
in the :hover case, for example).

The problem here is that you would double the time needed to find out the 
styling of the document. Why? Because, if properties can influence matching, 
you need to start over matching after the styling has been done using the 
previous style.

    a {
        writing-mode: vertical-lr;
    }

    a:where(writing-mode: vertical-lr) {
        color: red;
    }

In the first pass, only the first rule is matching. Temporary computed style 
is found to be { ...; writing-mode: vertical-lr; ... }. At that point, we 
need to start over the matching phase, where we find out that a:where(...) 
also matches, so we create a new style.

Even if we say that a rule depending on a property isn't reevaluated if the 
value it depended on has been modified by another rule depending on a 
property (as such, we accept second-order incoherences), you still have 
asked two matching phases, whose second one required the 'temporary' style 
the be known.

To say it honestly, I think there'll be a time where we'll allow something 
like this (custom properties could make a lot of use of it). However, I also 
think now isn't that time.



-----Message d'origine----- 
From: Tab Atkins Jr.
Sent: Monday, June 25, 2012 11:45 PM
To: fantasai
Cc: Sebastian Zartner ; www-style@w3.org
Subject: Re: [css4-selectors] Pseudo-class for writing mode

On Fri, Jun 22, 2012 at 12:02 AM, fantasai
<fantasai.lists@inkedblade.net> wrote:
> On 06/21/2012 11:08 PM, Sebastian Zartner wrote:
>> As far as I saw there's currently no possibility to select according to a
>> certain writing mode [1], only for the direction [2].
>> Therefore I suggest to introduce a :writing-mode pseudo-class matching 
>> the
>> values of the writing-mode property.
>
> Selectors can't select based on the value of a CSS property,
> so that won't work. (If you read the Selectors 4 spec carefully,
> you'll note that :dir() operates *only* on the directionality
> stated in the markup, if the markup supports such a notion.
> It does not reflect the CSS 'direction'.)

To be more specific, the problem that fantasai is alluding to is this:

:writing-mode(horizontal-tb) {
  writing-mode: vertical-lr; /* WHERE IS YOUR GOD NOW?!? */
}

Circular dependencies are bad times.

~TJ 

Received on Tuesday, 26 June 2012 07:23:58 UTC