Bug Tracker

Ticket #5353 (closed bug: invalid)

Opened 5 years ago

Last modified 3 years ago

.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 5 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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 3 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.