W3C home > Mailing lists > Public > www-style@w3.org > June 2012

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 26 Jun 2012 17:29:12 -0700
Message-ID: <CAAWBYDBHVcE=3ywdnWXFoRpMX-04X9+txVwaPkem_z9+t-L4aA@mail.gmail.com>
To: Sebastian Zartner <sebastianzartner@gmx.de>
Cc: Bjoern Hoehrmann <derhoermi@gmx.net>, www-style@w3.org, fantasai.lists@inkedblade.net
On Mon, Jun 25, 2012 at 10:00 PM, Sebastian Zartner
<sebastianzartner@gmx.de> wrote:
>> * Tab Atkins Jr. wrote:
>> >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.
>> It should also be noted, then, that this is where the discussion always
>> ends. Cycle detection is a problem computer science students will learn,
>> in fact, are supposed to solve on their on, in their first semester, in
>> Germany anyway, it's just that some people find this might be confusing
>> to authors, or interfere with optimizations, or be scary in some other
>> way, but we are far from a point where this is as bad as, say, the hal-
>> ting problem. It's not out of the question to introduce cycles like the
>> one above, it just requires extraordinary evidence that so far no-one
>> has bothered to provide (or shown to be impossible to provide). Either
>> would be welcome if anyone feels like "wasting" a lot of time on it.
> The example mentioned above reminds me of a statement from the famous British series The IT Crowd: "If you type 'google' into Google you can break the internet." ;-)
> Sorry if I am missing something fundamental of the CSS spec here, but why should the rule be applied infinitely often? In my eyes it would only apply once, so there wouldn't be any circular dependency at all. First the writing mode is 'horizontal-tb' and from then on it's 'vertical-lr'. In a programming language this describes a simple if(a == 1) a = 5; thing.

Your intuition is tuned for imperative languages.  CSS is a
declarative language instead, like spreadsheets are.  There's no
if/then, just statements that while something is true, this other
thing applies.

> And btw. I don't believe that that example is something somebody would use for real. It looks more like a "Let's see what happens if I am doing this." thing.

Nobody would do it intentionally, no.  But it's surprising how often
ridiculous/contrived edge cases show up in real code.

>> 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'.)
> Yes, I read that and it seems to me like an unnecessary limitation. The reading direction is something related to display. That's a clear inicator that it should be defined in CSS and not in HTML. So also the pseudo-class ':dir' would be based on the CSS 'direction' property.
> Anyway, I am also German. So this ':writing-mode' pseudo-class doesn't really affect me. But I was thinking that somebody will surely want to style their elements in regard of the writing mode, which AFAIK can't be done at the moment. If there is already a solution for this or somebody else has a better idea, feel free to throw it in.

We actually did discuss this at a meeting some time ago.  As far as we
can tell, the major use-case is styling things differently based on
whether the *environment* is vertical or horizontal (for example, if a
user of a Japanese e-reader prefers to read horizontal or vertical
Japanese).  That can be detected without any possibility of a circular

Received on Wednesday, 27 June 2012 00:30:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:00 UTC