aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2012-04-16 21:57:41 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-04-16 21:57:41 -0400
commitabd2a07498afa48a4ec3ce0471b9b0b4fc812b55 (patch)
treed108cb24a30d0d67f9cde1189e9711a64e3dc73c /src
parent8fadc5ba01bc517ebb07736d5af9a965ed133a39 (diff)
downloadjquery-abd2a07498afa48a4ec3ce0471b9b0b4fc812b55.tar.gz
jquery-abd2a07498afa48a4ec3ce0471b9b0b4fc812b55.zip
Fix #8894. Ensure `.appendTo` creates a new set in oldIE.
Diffstat (limited to 'src')
-rw-r--r--src/core.js2
-rw-r--r--src/manipulation.js28
2 files changed, 14 insertions, 16 deletions
diff --git a/src/core.js b/src/core.js
index 193dc1b34..4e38deaeb 100644
--- a/src/core.js
+++ b/src/core.js
@@ -801,7 +801,7 @@ jQuery.extend({
return proxy;
},
- // Mutifunctional method to get and set values to a collection
+ // Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
var exec,
diff --git a/src/manipulation.js b/src/manipulation.js
index da4f475b5..cc6acee82 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -40,7 +40,8 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
- safeFragment = createSafeFragment( document );
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
@@ -529,7 +530,7 @@ jQuery.each({
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
- if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+ if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
@@ -563,24 +564,21 @@ function fixDefaultChecked( elem ) {
}
}
-// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
-function shimCloneNode( elem ) {
- var div = document.createElement( "div" );
- safeFragment.appendChild( div );
-
- div.innerHTML = elem.outerHTML;
- return div.firstChild;
-}
-
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
- // IE<=8 does not properly clone detached, unknown element nodes
- clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
- elem.cloneNode( true ) :
- shimCloneNode( elem );
+ clone;
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {