Bug Tracker

Modify

Ticket #5353 (closed bug: invalid)

Opened 5 years ago

Last modified 2 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 4 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 2 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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.