aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>2012-03-23 11:31:53 -0400
committerRick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>2012-03-23 11:54:12 -0400
commit2795a8390c1986200bf4e00158dbf3ad2da8d898 (patch)
tree504b8ae0bb77a02338d87de0b0341e83fb2f3e88
parent379a1370164ff6b0fc57e3b10e1867ae867e2850 (diff)
downloadjquery-2795a8390c1986200bf4e00158dbf3ad2da8d898.tar.gz
jquery-2795a8390c1986200bf4e00158dbf3ad2da8d898.zip
Ensure innerHTML of src/dest clone nodes is correctly set. Fixes #10324
Signed-off-by: Rick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>
-rw-r--r--src/manipulation.js7
-rw-r--r--test/index.html1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 2a3757904..9b9872a5c 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -435,6 +435,13 @@ function cloneFixAttributes( src, dest ) {
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
+ dest.innerHTML = src.innerHTML;
+ }
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
diff --git a/test/index.html b/test/index.html
index c1320ccad..fa52c0468 100644
--- a/test/index.html
+++ b/test/index.html
@@ -135,6 +135,7 @@
<param name="p1" value="x1" />
<param name="p2" value="x2" />
</object>
+ <object id="object2"><param name="test" value="test"></param></object>​
<span id="台北Táiběi"></span>
<span id="台北" lang="中文"></span>