Commit 62a4c845 authored by Rick Waldron's avatar Rick Waldron Committed by Dave Methvin

Fix #10324. IE9 fumbles the innerHTML on object elements.

parents 0e2642d2 2795a839
...@@ -423,6 +423,14 @@ function cloneFixAttributes( src, dest ) { ...@@ -423,6 +423,14 @@ function cloneFixAttributes( src, dest ) {
if ( nodeName === "object" ) { if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML; 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" && rcheckableType.test( src.type ) ) { } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox // IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element // or radio button. Worse, IE6-7 fail to give the cloned element
......
...@@ -135,6 +135,7 @@ ...@@ -135,6 +135,7 @@
<param name="p1" value="x1" /> <param name="p1" value="x1" />
<param name="p2" value="x2" /> <param name="p2" value="x2" />
</object> </object>
<object id="object2"><param name="test" value="test"></param></object>​
<span id="台北Táiběi"></span> <span id="台北Táiběi"></span>
<span id="台北" lang="中文"></span> <span id="台北" lang="中文"></span>
......
...@@ -568,6 +568,15 @@ test("IE8 serialization bug", function () { ...@@ -568,6 +568,15 @@ test("IE8 serialization bug", function () {
equal( wrapper.children("link").length, 1, "Link elements are insertable with .html()"); equal( wrapper.children("link").length, 1, "Link elements are insertable with .html()");
}); });
test("html() object element #10324", function() {
expect( 1 );
var object = jQuery("#object2"),
clone = object.clone();
equal( clone.html(), object.html(), "html() returns correct innerhtml of cloned object elements" );
});
test("append(xml)", function() { test("append(xml)", function() {
expect( 1 ); expect( 1 );
...@@ -1771,4 +1780,4 @@ test("Guard against exceptions when clearing safeChildNodes", function() { ...@@ -1771,4 +1780,4 @@ test("Guard against exceptions when clearing safeChildNodes", function() {
} catch(e) {} } catch(e) {}
ok( div && div.jquery, "Created nodes safely, guarded against exceptions on safeChildNodes[ -1 ]" ); ok( div && div.jquery, "Created nodes safely, guarded against exceptions on safeChildNodes[ -1 ]" );
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment