Skip to content

Commit 33adb70

Browse files
committed
inherit is a valid class name (see #32)
1 parent b466bd0 commit 33adb70

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ Condition _class(boolean pseudoElementFound) :
12121212
locator = createLocator(token);
12131213
}
12141214

1215-
t = <IDENT>
1215+
( t = <IDENT> | t = <INHERIT> )
12161216
{
12171217
if (pseudoElementFound) { throw pe; }
12181218
return new ClassCondition(unescape(t.image, false), locator);

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4525,6 +4525,23 @@ public void doubleColonsPseudoClass() throws Exception {
45254525
assertEquals("h1::link { color: red; }", rule.getCssText());
45264526
}
45274527

4528+
/**
4529+
* @throws Exception if the test fails
4530+
*/
4531+
@Test
4532+
public void inheritClassName() throws Exception {
4533+
final String css = ".inherit { color: red }\n";
4534+
4535+
final CSSStyleSheetImpl sheet = parse(css);
4536+
final CSSRuleListImpl rules = sheet.getCssRules();
4537+
4538+
assertEquals(1, rules.getLength());
4539+
4540+
final AbstractCSSRuleImpl rule = rules.getRules().get(0);
4541+
assertEquals("*.inherit { color: red; }", rule.toString());
4542+
assertEquals("*.inherit { color: red; }", rule.getCssText());
4543+
}
4544+
45284545
//
45294546
// /**
45304547
// * @throws Exception if any error occurs

0 commit comments

Comments
 (0)