#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: |
Description
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 12 years ago by
comment:2 Changed 11 years ago by
| Component: | unfiled → manipulation |
|---|
comment:3 Changed 11 years ago by
| Keywords: | body added; iframe removed |
|---|---|
| Milestone: | 1.4 → 1.5 |
| Priority: | major → high |
| Status: | new → open |
| Version: | 1.3.2 → 1.4.4 |
comment:4 Changed 11 years ago by
| Owner: | set to jitter |
|---|---|
| Status: | open → assigned |
comment:5 Changed 11 years ago by
| Milestone: | 1.5 → 1.4.5 |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Landed.
comment:6 Changed 11 years ago by
Merge branch 'bug5566' into csnover-bug5566. Fixes #4386, #5566, #6997.
Conflicts:
src/manipulation.js test/unit/manipulation.js
Changeset: 4fae75d575b20d887e4a273c7991c55f8821a62c
comment:7 Changed 10 years ago by
| Milestone: | 1.4.5 → 1.5 |
|---|
Move fixed tickets to appropriate milestone

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!
<html> <head></head> <body> <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"); $("body").append(iframe); var doc = iframe.contentDocument || iframe.contentWindow.document; doc.open(); doc.write("<span>Span 1</span><span>Span 2</span><p>Inside paragraph<span>Span 1</span><span>Span 2</span></p>"); doc.close(); }); </script> <input id="go" value="go" type="button" /> </body> </html>