]> source.dussan.org Git - jquery.git/commitdiff
Ensure innerHTML of src/dest clone nodes is correctly set. Fixes #10324 713/head
authorRick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>
Fri, 23 Mar 2012 15:31:53 +0000 (11:31 -0400)
committerRick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>
Fri, 23 Mar 2012 15:54:12 +0000 (11:54 -0400)
Signed-off-by: Rick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com>
src/manipulation.js
test/index.html

index 2a375790438f6d1cf71eb2f49b4056c759565a81..9b9872a5cd0758f324fb49960b7d83e75220ade6 100644 (file)
@@ -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
index c1320ccad05610ea937cd625b59f6f79e7091504..fa52c0468bb73892268bcd18fb1e8fb7c0711943 100644 (file)
                                <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>