开发者

How to get GWT CSSResource to parse not() selectors

I realize that the CSS parser that GWT uses will only handle CSS2, but I am targeting iPhone Safari, so I want to be able to use some of the CSS3 stuff. For properties, I have been fine using the literal function provided by GWT, but I'm having trouble with CSS3 selectors - particularly the not() pseudo-class.

I have a bit of CSS like this:

.iMore:not (.__lod ):active {
    color: #fff
}

When GWT loads this file as a resource, I get:

encountered "(". Was expecting one of: "{" ","

the literal function works well for properties, but I tried this:

.iMore:literal("not (.__lod )"):active {
    color: #fff
}

and just got a different error message:

encountered ""not (.__lod ):"". Was expecting one of: <IDENT>

I put literal around the whole block and the error message went away, but I don't think that will work without @externaling everything referenced in the selectors that use this (there开发者_开发技巧 are a lot of others in this file).

  1. Would that even work?
  2. Is there a more graceful way of doing it?


You escape the parentheses in the selector with backslashes. So for your CSS:

.iMore:not \(.__lod \):active {
    color: #fff
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜