Skip to content

Commit

Permalink
Test for #1938
Browse files Browse the repository at this point in the history
Fixes #1938
  • Loading branch information
jhy committed Nov 24, 2024
1 parent d27370a commit 28db617
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/java/org/jsoup/parser/HtmlParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,16 @@ private static void assertMathNamespace(Element el) {
Attribute attribute = el.attribute("<junk");
assertNotNull(attribute);
assertEquals("", attribute.getValue());
}

@Test void pseudoAttributeComment() {
// https://github.com/jhy/jsoup/issues/1938
String html = " <h1>before</h1> <div <!--=\"\" id=\"hidden\" --=\"\"> <h1>within</h1> </div> <h1>after</h1>";
Document doc = Jsoup.parse(html);
assertEquals("<h1>before</h1><div <!--=\"\" id=\"hidden\" --=\"\"><h1>within</h1></div><h1>after</h1>", TextUtil.normalizeSpaces(doc.body().html()));
Element div = doc.expectFirst("div");
assertNotNull(div.attribute("<!--"));
assertEquals("hidden", div.attr("id"));
assertNotNull(div.attribute("--"));
}
}

0 comments on commit 28db617

Please sign in to comment.