Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7072 closed bug (duplicate)

clone() broken for actions in IE8

Reported by: leoshklo Owned by:
Priority: undecided Milestone: 1.4.3
Component: manipulation Version: 1.4.2
Keywords: clone ie8 Cc:
Blocked by: Blocking:

Description

The following test case is broken when trying to clone a containing a form. For some reason, the html representation of the clone doesn't quote the action attribute of the form tag which leaves the trailing slash to close the form tag destroying the form.

<html>
<head>
<script src="jquery.js"></script>
</head>
<body>
<div class="simpledialog">
   	<form action="/analysis/report/5b0ac4dd-1728-4f02-b41f-495e4ade613d/email/" method="post">
		<input type="text" name="email" id="id_email" />
	</form>
</div>
</body>

Load this file in IE8 then do the following in the console:

>$('.simpledialog').clone().html()
"<FORM method=post action=/analysis/report/5b0ac4dd-1728-4f02-b41f-495e4ade613d/email/><INPUT id=id_email name=email> </FORM>"

I get that result, which effectively destroys the cloned form. Please let me know if you need any more info.

Change History (3)

comment:1 Changed 9 years ago by snover

Resolution: invalid
Status: newclosed

Thanks for the report, but there is no bug here, except that IE generates tag soup when serializing its DOM representation. In HTML, “/>” does not self-close an element, and cloning forms in IE works just fine. Your problem is most likely related to the fact that you are cloning elements that contain IDs, thus causing duplicate IDs to be created in the DOM.

Test case

comment:2 Changed 9 years ago by leoshklo

Resolution: invalid
Status: closedreopened

Thanks for the prompt response. The problem doesn't have anything to do with the id and playing around with the Fiddle it looks like I can trigger it without using clone() at all.

The documentation does note this:

For example, Internet Explorer sometimes leaves off the quotes around attribute values if they contain only alphanumeric characters.

That behavior, however, breaks the form when its HTML is read out and then put in a new element:

http://jsfiddle.net/ZmJWD/3/ - it works fine in FF and breaks in IE8.

comment:3 Changed 9 years ago by dmethvin

Resolution: duplicate
Status: reopenedclosed

See #5998 which should have fixed this but doesn't seem to have done the trick given your test case. I've reopened that ticket.

Note: See TracTickets for help on using tickets.