Skip to content

Commit

Permalink
Tests that adoption agency algo doesn't IOOB
Browse files Browse the repository at this point in the history
Issue was fixed in 478b568

Closes #1608
  • Loading branch information
jhy committed Aug 11, 2021
1 parent b4f20f0 commit 04735f9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/java/org/jsoup/parser/HtmlParserTest.java
Expand Up @@ -1450,4 +1450,12 @@ private boolean didAddElements(String input) {
Node node = nodes.get(0);
assertEquals("<p><p></p><a></a></p>", node.parent().outerHtml()); // mis-nested because fragment forced into the element, OK
}

@Test public void nestedAnchorAdoption() {
// https://github.com/jhy/jsoup/issues/1608
String html = "<a>\n<b>\n<div>\n<a>test</a>\n</div>\n</b>\n</a>";
Document doc = Jsoup.parse(html);
assertNotNull(doc);
assertEquals("<a> <b> </b></a><b><div><a> </a><a>test</a> </div> </b>", TextUtil.stripNewlines(doc.body().html()));
}
}

0 comments on commit 04735f9

Please sign in to comment.