aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js46
1 files changed, 12 insertions, 34 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index ab19d8b3c..fb10ef5c2 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -2,7 +2,6 @@ define( [
"./core",
"./core/isAttached",
"./var/concat",
- "./var/isFunction",
"./var/push",
"./var/rcheckableType",
"./core/access",
@@ -24,7 +23,7 @@ define( [
"./traversing",
"./selector",
"./event"
-], function( jQuery, isAttached, concat, isFunction, push, rcheckableType,
+], function( jQuery, isAttached, concat, push, rcheckableType,
access, rtagName, rscriptType,
wrapMap, getAll, setGlobalEval, buildFragment, support,
dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
@@ -40,13 +39,11 @@ var
/* eslint-enable */
- // Support: IE <=10 - 11, Edge 12 - 13 only
+ // Support: IE <=10 - 11+, Edge 12 - 13 only
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Prefer a tbody over its parent table for containing new rows
@@ -109,20 +106,6 @@ function cloneCopyEvent( src, dest ) {
}
}
-// Fix IE bugs, see support tests
-function fixInput( src, dest ) {
- var nodeName = dest.nodeName.toLowerCase();
-
- // Fails to persist the checked state of a cloned checkbox or radio button.
- if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
- dest.checked = src.checked;
-
- // Fails to return the selected option to the default selected state when cloning options
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
- }
-}
-
function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays
@@ -133,17 +116,12 @@ function domManip( collection, args, callback, ignored ) {
l = collection.length,
iNoClone = l - 1,
value = args[ 0 ],
- valueIsFunction = isFunction( value );
+ valueIsFunction = typeof value === "function";
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( valueIsFunction ||
- ( l > 1 && typeof value === "string" &&
- !support.checkClone && rchecked.test( value ) ) ) {
+ if ( valueIsFunction ) {
return collection.each( function( index ) {
var self = collection.eq( index );
- if ( valueIsFunction ) {
- args[ 0 ] = value.call( this, index, self.html() );
- }
+ args[ 0 ] = value.call( this, index, self.html() );
domManip( self, args, callback, ignored );
} );
}
@@ -172,9 +150,6 @@ function domManip( collection, args, callback, ignored ) {
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
-
- // Support: Android <=4.0 only, PhantomJS 1 only
- // push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
@@ -255,7 +230,13 @@ jQuery.extend( {
srcElements = getAll( elem );
for ( i = 0, l = srcElements.length; i < l; i++ ) {
- fixInput( srcElements[ i ], destElements[ i ] );
+
+ // Support: IE <=11+
+ // IE fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ if ( destElements[ i ].nodeName.toLowerCase() === "textarea" ) {
+ destElements[ i ].defaultValue = srcElements[ i ].defaultValue;
+ }
}
}
@@ -475,9 +456,6 @@ jQuery.each( {
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems );
-
- // Support: Android <=4.0 only, PhantomJS 1 only
- // .get() because push.apply(_, arraylike) throws on ancient WebKit
push.apply( ret, elems.get() );
}