Community
Participate
Working Groups
Hi. 1. I have a CSS file with the following content : h1.myClass1, h1.myClass2 { } 2. I also have the following Java code which I use to retrieve the css selectors: ICSSDocument cssDocument = ((CSSModelImpl) cssModel).getDocument(); ICSSNodeList nodes = cssDocument.getChildNodes(); int numOfNodes = nodes.getLength(); for (int i = 0; i < numOfNodes; i++) { ICSSNode node = nodes.item(i); if (node instanceof ICSSStyleRule) { ICSSStyleRule styleRuleNode = (ICSSStyleRule) node; ICSSSelectorList selectorList = styleRuleNode.getSelectors(); . . . . . . 3. When I activate my code, indeed I get the correct selector list with 2 items : 'h1.myClass1' 'h1.myClass2' BUT... 4. When I changed the style rule to the following : h1.myClass1 , h1.myClass2 { } //Notice that I added one space after h1.myClass1 5. The selector list that I get has only a single item including: 'h1.myClass1 h1.myClass2' Looks like a parsing bug to me. Yaron
Created attachment 91793 [details] Patch to fix CSSTokenizer and add test cases Fixes the jflex file and generated CSS Tokenizer so that a space is only considered as a selector combinator when a comma doesn't follow that space. Also added a test case.
Created attachment 92441 [details] Patch to fix CSSTokenizer and add test cases with pseudo-class fix This patch contains an update to the CSS jflex spec as well as the CSSTokenizer that will also correct Bug 92848.
Releasing. Because of the complications with the generated class, Nick, please recheck the CVS changes and verify it in the build as quickly as possible.
Verified in M-3.0.1-20080717094056.