Skip to main content

Bug Tracker

Side navigation

#7072 closed bug (duplicate)

Opened September 23, 2010 08:50PM UTC

Closed September 24, 2010 03:41AM UTC

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.

Attachments (0)
Change History (3)

Changed September 23, 2010 10:30PM UTC by snover comment:1

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

Changed September 24, 2010 12:17AM UTC by leoshklo comment:2

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.

Changed September 24, 2010 03:41AM UTC by dmethvin comment:3

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.