@@ -79,13 +79,13 @@ private static Stream<Arguments> dupeAttributeData() {
7979
8080 @ Test public void parsesQuiteRoughAttributes () {
8181 String html = "<p =a>One<a <p>Something</p>Else" ;
82- // this (used to; now gets cleaner) gets a <p> with attr '=a' and an <a tag with an attribute named '<p'; and then auto-recreated
82+ // this gets a <p> with attr '=a' and an <a tag with an attribute named '<p'; and then auto-recreated
8383 Document doc = Jsoup .parse (html );
8484
85- // NOTE: per spec this should be the test case. but impacts too many ppl
86- // assertEquals("<p =a >One<a <p>Something</a></p>\n <a <p>Else</a>", doc.body().html());
87-
88- assertEquals ( "<p _a>One<a></a></p><p><a>Something</a></p><a>Else</a>" , TextUtil . stripNewlines ( doc . body (). html () ));
85+ // =a is output as _a
86+ assertEquals ("<p _a >One<a <p>Something</a></p><a <p>Else</a>" , TextUtil . stripNewlines ( doc .body ().html () ));
87+ Element p = doc . expectFirst ( "p" );
88+ assertNotNull ( p . attribute ( "=a" ));
8989
9090 doc = Jsoup .parse ("<p .....>" );
9191 assertEquals ("<p .....></p>" , doc .body ().html ());
@@ -1939,4 +1939,17 @@ private static void assertMathNamespace(Element el) {
19391939 assertEquals ("Hello" , ab .text ());
19401940 assertEquals ("a<b" , ab .tag ().normalName ());
19411941 }
1942+
1943+ @ Test void ltInAttrStart () {
1944+ // https://github.com/jhy/jsoup/issues/1483
1945+ String html = "<a before='foo' <junk after='bar'>One</a>" ;
1946+ Document doc = Jsoup .parse (html );
1947+ assertEquals ("<a before=\" foo\" <junk after=\" bar\" >One</a>" , TextUtil .normalizeSpaces (doc .body ().html ()));
1948+
1949+ Element el = doc .expectFirst ("a" );
1950+ Attribute attribute = el .attribute ("<junk" );
1951+ assertNotNull (attribute );
1952+ assertEquals ("" , attribute .getValue ());
1953+
1954+ }
19421955}
0 commit comments