Re: [css3-namespace] Last call comments from XHTML2 WG

On Fri, 28 Mar 2008 18:55:14 +0100, L. David Baron <dbaron@dbaron.org>  
wrote:

> On Friday 2008-03-28 10:44 -0700, L. David Baron wrote:
>> On Friday 2008-03-28 17:11 +0100, Steven Pemberton wrote:
>> > A note pointing out that default namespaces alter the way that type
>> > selectors work compared with earlier versions of CSS, and if you want  
>> to
>> > avoid that you should always use explicit qualified names would do the
>> > trick.
>>
>> But using explicit qualified names is a *really* bad idea, since it
>> makes the style sheet depend on specific namespace prefixes being
>> used in the document.  We really shouldn't suggest doing that.
>
> Other working group members tell me that I misunderstood your
> comment.  I thought you were suggesting that authors should write
> selectors like "html\:p", but they say you want authors to write
> "html|p".
>
> Which were you suggesting?

The latter. I don't like html\:p either.

> However, I don't see how that is any better, given that "html|p"
> wouldn't be supported by the older CSS implementations that you're
> trying to be compatible with.

Hmm. Apparently I'm not explaining myself very well. Let me try again.

Because of the way that CSS has been designed, there aren't versions in  
the way that XML has versions. There is nothing that announces that this  
is a CSS 2.1 stylesheet, because CSS is designed to work both forwards and  
backwards compatibly.
A CSS 2.1 stylesheet is also a CSS 1 stylesheet in a well-defined way. (By  
the way, I have no argument with this design philosophy - I should point  
out I was a member of the CSS WG from day one, up to CSS 2).

However, the upshot of this is that you have to be very careful how you  
write your stylesheets. You have to be aware that some of the rules are  
going to be ignored by some user agents, and write accordingly if you want  
your stylesheet to work coherently across user agents.

I am willing to be shown I am wrong, but I assert that there has never  
been a change made to CSS that changes how existing rules work (before  
this change we are discussing).

But now when I am writing a stylesheet I mustn't only ask myself "will  
this rule be processed in CSS x?", but also "if it does get processed,  
what does it mean?".

The rule

	a[href] img {...}

may suddenly mean something different in CSS3 to what it means in CSS 2.*  
depending on the context.

And who knows? Maybe in CSS4 it will mean something different yet again.

And worse yet, I can't see *by looking at the rule* if it means something  
different.

This makes my life as CSS author harder, because I used to be able to see  
 from a rule if it would be processed in a particular UA. Now I not only  
have to keep track of which rules are processed, but also how they will be  
processed, and I can't see that by looking at the rule, but I have to look  
back in the stylesheet to see if the different meaning has been switched  
on.

I regret this change in philosophy, because getting CSS right is hard  
enough without having to deal with this sort of non-localised  
dependencies. I foresee people in the future smacking themselves over the  
head when after hours of debugging they realise the bug was triggered  
exactly by this feature and an unforseen change in the document being  
styled. When a selector occasionally means something slightly different,  
you're going to stare at the selector and just not see it.

Now, in this particular case, it is not the end of the world, because I  
can program around it, once I am aware of the problem. But I'm going to  
have to deal with other people's stylesheets too, so I can't put it out of  
my mind entirely, alas.

So in conclusion:
	* Because of CSS's versioning mechanism, it is a Bad Thing if rules  
change meaning across versions
	* Although this change soils the purity of CSS's processing model, we  
have been kind enough not to formally object to this feature.
	* However, we think it is an important enough change to require at least  
to be pointed out.

Hope this was clearer!

Best wishes,

Steven Pemberton

Received on Monday, 31 March 2008 11:03:00 UTC