1

I realize that the GWT Css resource parser only support CSS2 at the moment, but is there a way to make the css shared parent select (the "~" selector) to work in a Css Resource?

For example:

.password{
    font-weight: normal;
}
.email ~ .password{   /* <--- This selector won't be included */
    font-weight: bold;
}
7
  • the literal function works well for styles that CssResource can't understand - I don't know if it works for selectors as well. You might try .email literal("~") .password { ... } , for example. Commented Jan 6, 2012 at 20:34
  • I tried a few iterations, but all them result in the selector not being output. I've tried both .email literal("~") .password and literal(".email ~ .password") Commented Jan 6, 2012 at 20:50
  • I've also tried .email \~ .password, but that outputs .email \~ .password Commented Jan 6, 2012 at 20:51
  • Actually general sibling combinator selector is in CSS selectors level 4 aka CSS4 Commented Jan 6, 2012 at 20:55
  • @Mohsen - be that as it may, it has great cross-browser support Commented Jan 6, 2012 at 20:58

1 Answer 1

2

If worse comes to worst and you don't find an elegant solution to this, you can always inject some styles after compilation. That is, let CssResource turn .email and .password into email() and password(), and then inject email() + " ~ " + password() into your page manually. Clearly an ugly hack, but you'd still get all the benefits of CssResource (except browser-specific tweaking) and the styles should apply as you expect.

I guess the simplest workaround is to create .email-password-parent and apply it manually to the parent.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.