Closed
Description
There seems to be some weird behavior in version 1.17.1 when combining multiple nested attribute selectors.
Minimal working example:
Document document = Jsoup.parse("""
<div id="parent">
<span class="child"></span>
<span class="child"></span>
<span class="child"></span>
</div>
""");
System.out.println(document.select("[class*=\"child\"]").size()); // 3
System.out.println(document.select("#parent [class*=\"child\"]").size()); // 3
System.out.println(document.select("#parent [class*=\"child\"], .some-other-selector").size()); // 3
System.out.println(document.select("#parent [class*=\"child\"], .some-other-selector .nested").size()); // 0
The first three select
s all correctly find 3 nodes, while the last one doesn't seem to find anything.
The code above works correctly (all four select
s find 3 nodes) on version 1.16.2.
Tested on OpenJDK 11, 17 and 21.