diff options
author | Elijah Manor <elijah.manor@gmail.com> | 2012-08-08 15:31:59 -0500 |
---|---|---|
committer | Elijah Manor <elijah.manor@gmail.com> | 2012-08-08 15:31:59 -0500 |
commit | d5d8622329e379e449b54ab8805f043d1e6ec02a (patch) | |
tree | 8c699a98b303bb9589588aa7273cb1f997c374aa /src/manipulation.js | |
parent | 0d07e7fc2cf33d70ea51ae58cd0c76bf48f8b3be (diff) | |
download | jquery-d5d8622329e379e449b54ab8805f043d1e6ec02a.tar.gz jquery-d5d8622329e379e449b54ab8805f043d1e6ec02a.zip |
Fix weird clone bug and add a unit test to verify
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 3cfc97c3b..457975a59 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -585,11 +585,17 @@ jQuery.extend({ var srcElements, destElements, i, - clone; + clone, + fix8908; if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); + // Fixes #8909 - By accessing one of the cloned element's computed styles it breaks the + // connection with the source element's styles in IE9/10 + if ( elem.nodeType === 1 && window.getComputedStyle ) { + fix8908 = ( window.getComputedStyle( elem, null ) || {} ).backgroundImage; + } + clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; |