Skip to content

Commit

Permalink
Testcase to show #1292 works as-is.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed Mar 1, 2020
1 parent e807847 commit 5136929
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/java/org/jsoup/select/SelectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -942,4 +942,21 @@ public void xmlWildcardNamespaceTest() {
assertEquals("1111", select.get(0).text());
assertEquals("2222", select.get(1).text());
}

@Test
public void childElements() {
// https://github.com/jhy/jsoup/issues/1292
String html = "<body><span id=1>One <span id=2>Two</span></span></body>";
Document doc = Jsoup.parse(html);

Element outer = doc.selectFirst("span");
Element span = outer.selectFirst("span");
Element inner = outer.selectFirst("* span");

assertEquals("1", outer.id());
assertEquals("1", span.id());
assertEquals("2", inner.id());
assertEquals(outer, span);
assertNotEquals(outer, inner);
}
}

0 comments on commit 5136929

Please sign in to comment.