diff --git a/src/main/javacc/CSS3Parser.jj b/src/main/javacc/CSS3Parser.jj index ed1d82c..e61c3b4 100644 --- a/src/main/javacc/CSS3Parser.jj +++ b/src/main/javacc/CSS3Parser.jj @@ -1593,6 +1593,7 @@ LexicalUnit term(LexicalUnit prev) : ) | t = { value = LexicalUnitImpl.createString(prev, unescape(t.image, false)); } | t = "progid:" { value = LexicalUnitImpl.createIdent(prev, skipUnit().trim()); } + | t = { value = LexicalUnitImpl.createSlash(prev); } | ( t = diff --git a/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java b/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java index 3a1c3be..6d431a6 100644 --- a/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java +++ b/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java @@ -1155,6 +1155,12 @@ public void hslVariousErrors() throws Exception { "foreground: hsl(10, 20%, 30)"); } + @Test + public void modernColorSyntax() throws Exception { + color("foreground: oklch(55% 0.2308 256.91 / 0.5)", "foreground: oklch(55% 0.2308 256.91 / 0.5)"); + color("foreground: oklch(from var(--text-color-secondary) l c h / 0.1)", "foreground: oklch(from var(--text-color-secondary) l c h / 0.1)"); + } + private void color(final String expected, final String cssText) throws Exception { color(0, expected, cssText); } @@ -1881,7 +1887,7 @@ public void malformedDeclaration() throws Exception { final String expected = "Error in declaration. (Invalid token \"}\". Was expecting one of: , \":\".)" + " Error in declaration. (Invalid token \";\". Was expecting one of: , \":\".)" + " Error in expression. (Invalid token \"}\". Was expecting one of: , , \"inherit\", " - + ", , \"-\", \"+\", , , , , , " + + ", , \"/\", \"-\", \"+\", , , , , , " + ", , , , " + ", , , , , , , " + ", , , , " @@ -1889,7 +1895,7 @@ public void malformedDeclaration() throws Exception { + ", , , , , " + ", , , \"progid:\".)" + " Error in expression. (Invalid token \";\". Was expecting one of: , , \"inherit\", " - + ", , \"-\", \"+\", , , , , , " + + ", , \"/\", \"-\", \"+\", , , , , , " + ", , , , " + ", , , , , , , " + ", , , , " @@ -2186,7 +2192,7 @@ public void unexpectedEndOfString() throws Exception { assertEquals(1, errorHandler.getErrorCount()); final String expected = "Error in expression. " + "(Invalid token \"\\'\". Was expecting one of: , , \"inherit\", " - + ", , \"-\", \"+\", , , , , , " + + ", , \"/\", \"-\", \"+\", , , , , , " + ", , , , " + ", , , , , , , " + ", , , , "