Modify ↓
Ticket #5353 (closed bug: invalid)
.html(value) silently dies on IE in case of invalid markup
| Reported by: | DmitryBaranovskiy | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | core | Version: | 1.3.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
If value for html method contains badly formatted HTML, like this one: “<ul><li>test</li></ul></div>” it silently dies in IE. The HTML of the container in this case erased to “”.
Test case: $("p").html("<ul><li>test</li></ul></div>");
Change History
comment:1 Changed 3 years ago by dmethvin
- Status changed from new to closed
- Resolution set to invalid
comment:2 Changed 13 months ago by anonymous
Please update the documentation to reflect this. It appears from the docs that it will simply put the html you specify into the element but in the case of garbage html it does not do what the docs suggest, it fails instead.
Description: Set the HTML contents of each element in the set of matched elements.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Pretty much garbage-in-garbage-out. jQuery doesn't try to validate the HTML it gives to the IE .innerHTML property, it would be too expensive to try and do that in Javascript.