Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#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:
Blocked by: Blocking:


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 (2)

comment:1 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

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.

comment:2 Changed 11 years 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.
Note: See TracTickets for help on using tickets.