Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6604 closed bug (duplicate)

html() usage can destroy forms in Internet Explorer 8.

Reported by: jonathan.slenders Owned by:
Priority: Milestone: 1.4.3
Component: core Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:

Description

Maybe this is rather an IE8 bug than JQuery bug, I'm not sure.

Internet explorer often strips the quotes around html attributes, and therefore, the html variable in the code below will contain somewhere: "<form action=/action/a/>" The forward-slash/greater-than combination will also act as the end of the form.


var html = $('<div><p><form action="/action/a/" method="get"><input type="submit" value="aaa" /></form></p></div>').html(); alert ($(html).html());


This will display:

<FORM method=get action=/action/a></FORM><INPUT value=aaa type=submit></FORM>


This behaviour in IE8, will make the following code inreliable, as it can destroy the forms.

$(this).html($(this).html());

Tested in Jquery 1.4.1

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #6236.

Note: See TracTickets for help on using tickets.