Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#4386 closed bug (fixed)

iframe body clone event IE

Reported by: bgrinstead Owned by: jitter
Priority: high Milestone: 1.5
Component: manipulation Version: 1.4.4
Keywords: explorer body clone Cc:
Blocked by: Blocking:


I found some strange behavior in the clone event on the body element of an iframe. It only saves the first child node in the clone. If you clone an inner element, it works as expected (copies all of it's child nodes). I have been able to work around this behavior by changing the clone event back to how it was in 1.2.6 (with the owner document fix like in http://dev.jquery.com/ticket/2997).

Here is a test case that demonstrates the bug (works in firefox, broken in IE): http://jquery.nodnod.net/cases/257.

It certainly has to do with line 320 in jquery-1.3.2.js, but I haven't been able to fix it myself: return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/\s*/, "")])[0];

Change History (8)

comment:1 Changed 14 years ago by bgrinstead

OK, that test case website is overwriting the case I set up. I haven't heard any response in a few weeks, but I will go ahead and paste the case here. Hopefully someone can get a chance to look at this. Thanks!


<script type='text/javascript' src='jQuery-1.3.2.js'></script>
<script type='text/javascript'>

  $(function() {

     $("#go").click(function() {

       var $body = $(doc.body).clone();        
       var $p = $(doc.body).find("p").clone();
       // In IE only sees the first child of the body
       alert("Body inner html:\n" + $body.html());

       // In IE sees all children of the p tag
       alert("Paragraph inner html:\n" + $p.html());


     var iframe = document.createElement("iframe");
     var doc = iframe.contentDocument || iframe.contentWindow.document;
     doc.write("<span>Span 1</span><span>Span 2</span><p>Inside paragraph<span>Span 1</span><span>Span 2</span></p>");



<input id="go" value="go" type="button" />

comment:2 Changed 13 years ago by dmethvin

Component: unfiledmanipulation

comment:3 Changed 12 years ago by jitter

Keywords: body added; iframe removed
Milestone: 1.41.5
Priority: majorhigh
Status: newopen

Seems like bug in IE when cloning the body element.

test case

and proposal for a fix pull request

comment:4 Changed 12 years ago by snover

Owner: set to jitter
Status: openassigned

comment:5 Changed 12 years ago by john

Resolution: fixed
Status: assignedclosed


comment:6 Changed 12 years ago by Colin Snover

Merge branch 'bug5566' into csnover-bug5566. Fixes #4386, #5566, #6997.


src/manipulation.js test/unit/manipulation.js

Changeset: 4fae75d575b20d887e4a273c7991c55f8821a62c

comment:7 Changed 12 years ago by jitter


Move fixed tickets to appropriate milestone

comment:10 Changed 11 years ago by mikesherov


Note: See TracTickets for help on using tickets.