W3C home > Mailing lists > Public > www-style@w3.org > November 2007

Re: Validating media queries in Java

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 16 Nov 2007 12:02:30 -0500
Message-ID: <473DCD26.2060204@inkedblade.net>
To: Henri Sivonen <hsivonen@iki.fi>
CC: W3C Style List <www-style@w3.org>

Henri Sivonen wrote:
> 
> I'm trying to validate CSS Media Queries as HTML5 attribute values. I'm 
> using Java.
> 
> I first thought that media queries would be syntactically very 
> simple--something for which importing the W3C CSS Validator or a parser 
> generator as a project dependency would be and overkill. I have since 
> learned that most of the complications are hiding inside <value> and the 
> language is nowhere near as simple as the pseudo-BNF in the Media 
> Queries spec makes it appear. In particular, even traditional CSS 
> lengths make the states in the parser balloon and support for calc() 
> would make things much, much more complex.
> 
> I'm now considering abandoning my hand-rolled code in favor of either a 
> customized generated parser or a generic CSS parser that someone has 
> already written. I checked out the W3C CSS Validator source today. 
> Unfortunately, it seems that it doesn't have an entry point for parsing 
> media queries in isolation and the JavaCC grammar it uses is tightly 
> coupled with the program internals.
> 
> I'd appreciate advice:
> Is there some Open Source work that I'm missing but could use? Other 
> recommendations on how to proceed?

We could disallow calc() in media queries. I don't see much of a use case
for it.

~fantasai
Received on Friday, 16 November 2007 17:02:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:56 GMT