Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using nth-child CSS selector with UiBinder in GWT

In my web app, I want to have a table where every other row is colored with a different background. I am using GWT and so in my UiBinder file I have some style information like this:

<ui:style> 
  .productlist { 
    cursor: pointer; 
    width: 50em; 
    padding: 10px 10px 0px 10px; 
  }

  .productlist tr:nth-child(even) { 
    background-color: silver; 
  }
</ui:style>

I believe this is the correct CSS as it works in the browser. However, when running the app in dev mode, I get a crash saying the CSS cannot be interpreted. If I replace "even" with "5", I get an error saying the Uibinder expected <IDENT>.

Has anyone used the nth-child CSS selector with GWT before?

like image 409
Dusty Campbell Avatar asked Dec 02 '10 23:12

Dusty Campbell


1 Answers

This is a known issue.

You can work around this problem by escaping the parenthesis to avoid confusing the poor GWT CSS parser:

.productlist tr:nth-child\(even\) { 
    background-color: silver; 
}
like image 172
z00bs Avatar answered Oct 20 '22 17:10

z00bs