Skip to content

Commit 2c148c7

Browse files
committed
and is also a valid identifier (css-class name)
1 parent 67733fb commit 2c148c7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,6 +2757,7 @@ Token ident() :
27572757
|
27582758
(
27592759
t = <INHERIT>
2760+
| t = <AND>
27602761
| t = <ONLY>
27612762
| t = <NONE>
27622763
| t = <FROM>

src/test/java/org/htmlunit/cssparser/parser/CSS3ParserRealWorldTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ public void semantic_2_5_0() throws Exception {
384384
+ "only screen and (min-width: 768px) and (max-width: 991px);"
385385
+ "only screen and (min-width: 992px);"
386386
+ "only screen and (min-width: 992px) and (max-width: 1199px);";
387-
realWorld("realworld/semantic_2_5_0.css", 5486, 10068, media, 7, 4);
388-
realWorld("realworld/semantic_2_5_0.min.css", 5486, 10068, media, 7, 4);
387+
realWorld("realworld/semantic_2_5_0.css", 5490, 10072, media, 3, 0);
388+
realWorld("realworld/semantic_2_5_0.min.css", 5490, 10072, media, 3, 0);
389389
}
390390

391391
/**

src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public void selector() throws Exception {
109109
selectorType(".only", SelectorType.ELEMENT_NODE_SELECTOR);
110110
selectorType(".none", SelectorType.ELEMENT_NODE_SELECTOR);
111111
selectorType(".from", SelectorType.ELEMENT_NODE_SELECTOR);
112+
selectorType(".and", SelectorType.ELEMENT_NODE_SELECTOR);
112113
}
113114

114115
/**
@@ -230,6 +231,7 @@ public void condition() throws Exception {
230231
conditionType(".only", ConditionType.CLASS_CONDITION);
231232
conditionType(".none", ConditionType.CLASS_CONDITION);
232233
conditionType(".from", ConditionType.CLASS_CONDITION);
234+
conditionType(".and", ConditionType.CLASS_CONDITION);
233235
}
234236

235237
/**
@@ -1854,7 +1856,7 @@ public void unexpectedEndOfPageRule() throws Exception {
18541856

18551857
assertEquals(1, errorHandler.getErrorCount());
18561858
final String expected = "Error in @page rule. "
1857-
+ "(Invalid token \"<EOF>\". Was expecting one of: <S>, \"only\", \"inherit\", \"none\", \"from\", <IDENT>,"
1859+
+ "(Invalid token \"<EOF>\". Was expecting one of: <S>, \"and\", \"only\", \"inherit\", \"none\", \"from\", <IDENT>,"
18581860
+ " \"}\", \";\", \"*\", <CUSTOM_PROPERTY_NAME>.)";
18591861
assertEquals(expected, errorHandler.getErrorMessage());
18601862
assertEquals("1", errorHandler.getErrorLines());
@@ -3234,7 +3236,7 @@ public void invalid_not() throws Exception {
32343236

32353237
checkErrorSelector("input:not()",
32363238
"Error in simple selector. (Invalid token \")\". "
3237-
+ "Was expecting one of: <S>, \"only\", \"inherit\", \"none\", \"from\", <IDENT>, \".\", \":\", \"*\", \"[\", <HASH>.)");
3239+
+ "Was expecting one of: <S>, \"and\", \"only\", \"inherit\", \"none\", \"from\", <IDENT>, \".\", \":\", \"*\", \"[\", <HASH>.)");
32383240

32393241
// checkErrorSelector("input:not(*.home)",
32403242
// "Error in pseudo class or element. (Invalid token \".\"."
@@ -3282,7 +3284,7 @@ public void pseudoElementsErrors() throws Exception {
32823284
"Duplicate pseudo class \":foo(ab)\" or pseudo class \":foo(ab)\" not at end.");
32833285
checkErrorSelector("input:before:",
32843286
"Error in pseudo class or element. (Invalid token \"<EOF>\". "
3285-
+ "Was expecting one of: \"only\", \"inherit\", \"none\", \"from\", <IDENT>, "
3287+
+ "Was expecting one of: \"and\", \"only\", \"inherit\", \"none\", \"from\", <IDENT>, "
32863288
+ "\":\", <FUNCTION_NOT>, <FUNCTION_LANG>, <FUNCTION>.)");
32873289

32883290
// pseudo element not at end

0 commit comments

Comments
 (0)