Opened 10 years ago
Closed 10 years ago
#13805 closed bug (duplicate)
jQuery.parseHTML can't work as expeced
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | manipulation | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I just wanna to use jQuery.parseHTML
to parse a string into an array of DOM nodes. But I had encountered one problem about it.
Please refer to the test case http://jsfiddle.net/ACdXh/1/.
When it parse the string below:
<a title="xxx />">xxx /></a>
howerver, the result is:
<a title="xxx ></a>">xxx /></a>
I guess jQuery.parseHTML
recognize the a
tag as an empty element(sure it can't be), and as for non-empty elements of xhtml, end tags are required so it adds the corresponding end tag to it.
looking forward to your feedback.
thanks, Khalil
Change History (3)
comment:1 Changed 10 years ago by
Component: | unfiled → manipulation |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
comment:2 Changed 10 years ago by
Resolution: | patchwelcome |
---|---|
Status: | closed → reopened |
comment:3 Changed 10 years ago by
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Duplicate of #14370.
Note: See
TracTickets for help on using
tickets.
Thanks for the report! We can't really fix this without actually parsing content passed to manipulation method, but you can avoid it by escaping potentially dangerous attribute content: http://jsfiddle.net/ACdXh/3/