You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varlistRoot = // this is an element containing the top level <ul>assertThat(listRoot).isNotNull();
assertThat(listRoot.select("> li"))
.isNotNull()
.hasSize(2);
varli1 = listRoot.selectFirst("> li:nth-child(1)");
varli1ul = Objects.requireNonNull(li1).select("ul");
// as expected the first li does not have a ul so this is emptyassertThat(li1ul).isEmpty();
varli2 = listRoot.selectFirst("> li:nth-child(2)");
// the second li should have one ul with two nested livarli2ulLi = Objects.requireNonNull(li2).select("ul > li");
// this fails because the actual size is 3// it contains the two sub li plus the parent li2 on which the selection is doneassertThat(li2ulLi).hasSize(2);
Observed behaviour:
When selecting the ul > li children of of li2, li2 is contained in the result set additionally to the two sub li. Technically the selector ul > li also matches li2 but only if starting from the root of the document. Changing the selector for the sub li to > ul > li works and only the two sub li are selected.
Expeced behaviour:
Doing a (li2).select("ul > li") should start with li2 as the root element so the selection should not consider the parent of li2 for selection.
The text was updated successfully, but these errors were encountered:
Reproduction case:
We have a nested list that looks a bit like this:
Observed behaviour:
When selecting the
ul > li
children of of li2, li2 is contained in the result set additionally to the two sub li. Technically the selectorul > li
also matches li2 but only if starting from the root of the document. Changing the selector for the sub li to> ul > li
works and only the two sub li are selected.Expeced behaviour:
Doing a
(li2).select("ul > li")
should start with li2 as the root element so the selection should not consider the parent of li2 for selection.The text was updated successfully, but these errors were encountered: