Skip to main content

Bug Tracker

Side navigation

#5353 closed bug (invalid)

Opened October 12, 2009 01:57AM UTC

Closed December 16, 2009 02:49AM UTC

Last modified April 13, 2012 06:30PM UTC

.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:
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>");

Attachments (0)
Change History (2)

Changed December 16, 2009 02:49AM UTC by dmethvin comment:1

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.

Changed April 13, 2012 06:30PM UTC by anonymous comment:2

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.