On 19 oct, 11:38, DaveC <[email protected]> wrote:
> I'm trying to use some css3 media queries in my GWT app via a
> CssResource and StyleInjector e.g.
>
> @media screen and (color) {
>
> ...
>
> }
>
> Unfortunately GWT’s CssResource doesn't yet support this - it strips
> out the bit it doesn't understand and outputs:
>
> @MEDIA screen{}
>
> …removing any rules I declared inside.

Your @media rule is not valid CSS 2.1 (it only accepts comma-separated
media, each medium being an identifier), and GWT (Flute, actually)
expectedly chokes on the "and":
[WARN] Line 7 column 14: encountered "and". Was expecting one of: "{"
","

See http://www.w3.org/TR/CSS21/grammar.html
Your @media rule is "CSS3 media queries"-style: 
http://www.w3.org/TR/css3-mediaqueries/
which Flute(the CSS aprser used by GWT) doesn't support
(unfortunately, CSSParser doesn't either AFAICT).

> I also came across a similar "thing" when trying to use vendor
> specific extensions, but found a working around that caused the GWT
> compiler to ignore them (I escaped the starting hyphen e.g. \-moz-
> inline-box).

Yes, it's because Flute is somewhat outdated (supports CSS 2.0 but not
CSS 2.1):
http://code.google.com/p/google-web-toolkit/issues/detail?id=3595#c3

> I find the W3C spec a bit ambiguous:
>
> Quote: "An initial dash or underscore is guaranteed never to be used
> in a property or keyword by any current or future level of CSS. Thus
> typical CSS implementations may not recognize such properties and may
> ignore them according to the rules for handling parsing
> errors."  (Note usage of "may" and "may not" - are they errors or
> not?)

They're not errors.

> My question is does anyone know of a way I can get the GWT Compiler to
> recognise my media queries?

Apart from patching Flute (or rather CSSParser and then GWT, to use
CSSParser instead of Flute), I don't see.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to