Element.cssSelector() fails with org.jsoup.select.Selector$SelectorParseException: Could not parse query
org.jsoup.select.Selector$SelectorParseException: Could not parse query 'section.event-list.grid.md:grid-cols-2.lg:grid-cols-3.gap-8.md:gap-12.lg:gap-16.lg:block': unexpected token at ':grid-cols-2.lg:grid-cols-3.gap-8.md:gap-12.lg:gap-16.lg:block'
at org.jsoup.select.QueryParser.findElements(QueryParser.java:218)
at org.jsoup.select.QueryParser.parse(QueryParser.java:74)
at org.jsoup.select.QueryParser.parse(QueryParser.java:45)
at org.jsoup.select.QueryParser.combinator(QueryParser.java:90)
at org.jsoup.select.QueryParser.parse(QueryParser.java:60)
at org.jsoup.select.QueryParser.parse(QueryParser.java:45)
at org.jsoup.select.Selector.select(Selector.java:95)
at org.jsoup.nodes.Element.select(Element.java:421)
at org.jsoup.nodes.Element.cssSelector(Element.java:838)
Seems that jsoup cannot parse it's own generated query.
Using jsoup 1.14.3
Can you provide a simple test case with the input query / HTML so this can be reproed / understood?
I don't have the html-example anymore. But it seems, that the html contains some classes like "grid.md:grid-cols-2", so it must look like
<section class="grid.md:grid-cols-2 lg:grid-cols-3">.. maybe it is invalid html/css, but jsoup should not crash, with its own document-model.
There is no input query, because jsoup generated its own query (Element.cssSelector method)
This can be fixed by implementing escapes in the query parser for IDs and classes (etc). E.g. an updated / revised #1442. And then apply the escapes in the cssSelector method.