W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > July 2008

Re: Bugs in CSS parsing

From: Francois Daoust <fd@w3.org>
Date: Thu, 10 Jul 2008 18:07:30 +0200
Message-ID: <487633C2.9040207@w3.org>
To: Jo Rabin <jrabin@mtld.mobi>
CC: public-mobileok-checker <public-mobileok-checker@w3.org>

Jo Rabin wrote:
> Interesting point. Apparently everything that CSS defines is case 
> insensitive: property names values and units in particular. But I 
> suppose selectors, font-names, URIs, classes, ids and so on are not. I 
> don't think that the latter affects mobileOK processing, though, since 
> we make no attempt to match any of these to the document that the CSS is 
> applied to

I haven't checked the latter point into details because we don't really 
care here indeed (there are interesting exceptions to the 
case-insentivity in practice [also triggered by the fact that HTML is 
case-insensitive whereas XHTML is not and this kind of things]).

But the former point still holds: property name, values, and units are 
case-insensitive. And spaces may be defined almost anywhere.



> - though perhaps we ought to have done in the case of CSS in 
> <style> elements. I think we did discuss it and dropped it as an idea, 
> another version, maybe.

Already having some new ideas for a future version of the mobileOK Basic 
Tests document? I see you're a bit sad to let it go... ;-)


> 
> Space sensitivity is another matter though. In some cases spaces are 
> required, in some cases they are optional and in other cases they are 
> prohibited ... so is the treatment of space in the way we do a defect in 
> the CSS parser, or is it an artefact of using regex to extract some 
> parts of the CSS Style?

The bug is just an artefact of using regex. Nothing too hard to fix, I 
was mostly willing to make sure that we agreed on the need to relax the 
way the parsing is done in the checker.

In practice, the changes affect, I think:
- MeasuresTest.java: to extract absolute values, and match CSS1 properties
- CSSUtils.java: there may be spaces before the ":" (i.e.: 
"background-image:" and "background-image   :" are both correct)
- StyleSheetsSupport.java

I just committed a first patch to MeasuresTest.java.
I say "first patch" as it's not entirely enough, because:
   "font-size:
	12pt;"
... is valid as well, and we're parsing the CSS line after line AFAICT.
I guess we may list this last case in the "bug for later" category though.

The same needs to be done to CSSUtils.java and StyleSheetsSupport.java.
(Note I'm off tomorrow, and Monday is a blank holiday in France)


Actually, not willing to open a big can of worms and to trigger, but... 
why did we decide to link to the CSS1 Grammar and not the CSS2 Grammar 
(they are mostly the same anyway)?

Francois.
Received on Thursday, 10 July 2008 16:08:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 10 July 2008 16:08:05 GMT