Commit 0877d424 authored by Richard Gibson's avatar Richard Gibson Committed by jaubourg

Fix #12959: Optimize library-wide patterns

parent 512b826f
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"maxerr": 100, "maxerr": 100,
"newcap": false, "newcap": false,
"quotmark": "double", "quotmark": "double",
"regexdash": true,
"strict": true, "strict": true,
"sub": true, "sub": true,
"trailing": true, "trailing": true,
......
...@@ -13,7 +13,7 @@ var ...@@ -13,7 +13,7 @@ var
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/, rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//, rprotocol = /^\/\//,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method // Keep a copy of the old load method
_load = jQuery.fn.load, _load = jQuery.fn.load,
...@@ -67,7 +67,7 @@ function addToPrefiltersOrTransports( structure ) { ...@@ -67,7 +67,7 @@ function addToPrefiltersOrTransports( structure ) {
var dataType, var dataType,
i = 0, i = 0,
dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ); dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) { if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression // For each dataType in the dataTypeExpression
...@@ -432,7 +432,7 @@ jQuery.extend({ ...@@ -432,7 +432,7 @@ jQuery.extend({
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list // Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch // A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) { if ( s.crossDomain == null ) {
......
var nodeHook, boolHook, fixSpecified, var nodeHook, boolHook, fixSpecified,
rclass = /[\t\r\n]/g, rclass = /[\t\r\n]/g,
rreturn = /\r/g, rreturn = /\r/g,
rtype = /^(?:button|input)$/i, rtype = /^(?:input|button)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i, rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^a(?:rea|)$/i, rclickable = /^(?:a|area)$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute; getSetAttribute = jQuery.support.getSetAttribute;
...@@ -34,35 +34,36 @@ jQuery.fn.extend({ ...@@ -34,35 +34,36 @@ jQuery.fn.extend({
}, },
addClass: function( value ) { addClass: function( value ) {
var classNames, i, l, elem, var classes, elem, cur, clazz, j,
setClass, c, cl; i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) { if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) { return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) ); jQuery( this ).addClass( value.call( this, j, this.className ) );
}); });
} }
if ( value && typeof value === "string" ) { if ( proceed ) {
classNames = value.split( core_rspace ); // The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( i = 0, l = this.length; i < l; i++ ) { for ( ; i < len; i++ ) {
elem = this[ i ]; elem = this[ i ];
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) { cur = elem.className ?
elem.className = value; ( " " + elem.className + " " ).replace( rclass, " " ) :
" ";
} else { j = 0;
setClass = " " + elem.className + " "; while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
for ( c = 0, cl = classNames.length; c < cl; c++ ) { cur += clazz + " ";
if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
setClass += classNames[ c ] + " ";
} }
} }
elem.className = jQuery.trim( setClass ); elem.className = jQuery.trim( cur );
}
} }
} }
} }
...@@ -71,30 +72,34 @@ jQuery.fn.extend({ ...@@ -71,30 +72,34 @@ jQuery.fn.extend({
}, },
removeClass: function( value ) { removeClass: function( value ) {
var removes, className, elem, c, cl, i, l; var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) { if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) { return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) ); jQuery( this ).removeClass( value.call( this, j, this.className ) );
}); });
} }
if ( (value && typeof value === "string") || !arguments.length ) { if ( proceed ) {
removes = ( value || "" ).split( core_rspace ); classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( i = 0, l = this.length; i < l; i++ ) { for ( ; i < len; i++ ) {
elem = this[ i ]; elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) { if ( elem.nodeType === 1 ) {
// This expression is here for better compressibility (see addClass)
className = (" " + elem.className + " ").replace( rclass, " " ); cur = elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
// loop over each item in the removal list " ";
for ( c = 0, cl = removes.length; c < cl; c++ ) { j = 0;
// Remove until there is nothing to remove, while ( (clazz = classes[j++]) ) {
while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { // Remove *all* instances
className = className.replace( " " + removes[ c ] + " " , " " ); while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
} }
} }
elem.className = value ? jQuery.trim( className ) : ""; elem.className = value ? jQuery.trim( cur ) : "";
} }
} }
} }
...@@ -119,7 +124,7 @@ jQuery.fn.extend({ ...@@ -119,7 +124,7 @@ jQuery.fn.extend({
i = 0, i = 0,
self = jQuery( this ), self = jQuery( this ),
state = stateVal, state = stateVal,
classNames = value.split( core_rspace ); classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) { while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list // check each className given, space separated list
...@@ -331,17 +336,12 @@ jQuery.extend({ ...@@ -331,17 +336,12 @@ jQuery.extend({
}, },
removeAttr: function( elem, value ) { removeAttr: function( elem, value ) {
var propName, attrNames, name, isBool, var name, propName, isBool,
i = 0; i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( value && elem.nodeType === 1 ) {
attrNames = value.split( core_rspace );
for ( ; i < attrNames.length; i++ ) {
name = attrNames[ i ];
if ( name ) { if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name; propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name ); isBool = rboolean.test( name );
...@@ -358,7 +358,6 @@ jQuery.extend({ ...@@ -358,7 +358,6 @@ jQuery.extend({
} }
} }
} }
}
}, },
attrHooks: { attrHooks: {
......
...@@ -4,7 +4,7 @@ var optionsCache = {}; ...@@ -4,7 +4,7 @@ var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache // Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) { function createOptions( options ) {
var object = optionsCache[ options ] = {}; var object = optionsCache[ options ] = {};
jQuery.each( options.split( core_rspace ), function( _, flag ) { jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true; object[ flag ] = true;
}); });
return object; return object;
......
...@@ -15,14 +15,22 @@ var ...@@ -15,14 +15,22 @@ var
// Map over the $ in case of overwrite // Map over the $ in case of overwrite
_$ = window.$, _$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "@VERSION",
// Save a reference to some core methods // Save a reference to some core methods
core_concat = Array.prototype.concat, core_concat = core_deletedIds.concat,
core_push = Array.prototype.push, core_push = core_deletedIds.push,
core_slice = Array.prototype.slice, core_slice = core_deletedIds.slice,
core_indexOf = Array.prototype.indexOf, core_indexOf = core_deletedIds.indexOf,
core_toString = Object.prototype.toString, core_toString = class2type.toString,
core_hasOwn = Object.prototype.hasOwnProperty, core_hasOwn = class2type.hasOwnProperty,
core_trim = String.prototype.trim, core_trim = core_version.trim,
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -31,21 +39,17 @@ var ...@@ -31,21 +39,17 @@ var
}, },
// Used for matching numbers // Used for matching numbers
core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for detecting and trimming whitespace
core_rnotwhite = /\S/,
core_rspace = /\s+/,
// List of deleted data cache ids, so we can reuse them // Used for splitting on whitespace
core_deletedIds = [], core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings // A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag // Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
...@@ -54,7 +58,7 @@ var ...@@ -54,7 +58,7 @@ var
rvalidchars = /^[\],:{}\s]*$/, rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing // Matches dashed string for camelizing
rmsPrefix = /^-ms-/, rmsPrefix = /^-ms-/,
...@@ -62,7 +66,7 @@ var ...@@ -62,7 +66,7 @@ var
// Used by jQuery.camelCase as callback to replace() // Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) { fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase(); return letter.toUpperCase();
}, },
// The ready event handler and self cleanup method // The ready event handler and self cleanup method
...@@ -76,12 +80,12 @@ var ...@@ -76,12 +80,12 @@ var
document.detachEvent( "onreadystatechange", DOMContentLoaded ); document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready(); jQuery.ready();
} }
}, };
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = { jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery, constructor: jQuery,
init: function( selector, context, rootjQuery ) { init: function( selector, context, rootjQuery ) {
var match, elem; var match, elem;
...@@ -188,9 +192,6 @@ jQuery.fn = jQuery.prototype = { ...@@ -188,9 +192,6 @@ jQuery.fn = jQuery.prototype = {
// Start with an empty selector // Start with an empty selector
selector: "", selector: "",
// The current version of jQuery being used
jquery: "@VERSION",
// The default length of a jQuery object is 0 // The default length of a jQuery object is 0
length: 0, length: 0,
...@@ -560,7 +561,7 @@ jQuery.extend({ ...@@ -560,7 +561,7 @@ jQuery.extend({
// Workarounds based on findings by Jim Driscoll // Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) { globalEval: function( data ) {
if ( data && core_rnotwhite.test( data ) ) { if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer // We use execScript on Internet Explorer
// We use an anonymous function so that context is window // We use an anonymous function so that context is window
// rather than jQuery in Firefox // rather than jQuery in Firefox
......
...@@ -8,7 +8,7 @@ var curCSS, iframe, iframeDoc, ...@@ -8,7 +8,7 @@ var curCSS, iframe, iframeDoc,
rmargin = /^margin/, rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" }, elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" },
......
...@@ -188,7 +188,7 @@ jQuery.extend({ ...@@ -188,7 +188,7 @@ jQuery.extend({
// Unique for each copy of jQuery on the page // Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery // Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you // The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them. // attempt to add expando properties to them.
......
var fxNow, timerId, var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/, rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/, rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ], animationPrefilters = [ defaultPrefilter ],
tweeners = { tweeners = {
......
var rformElems = /^(?:textarea|input|select)$/i, var rformElems = /^(?:input|select|textarea)$/i,
rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
reventTypes = /\S+/g,
rkeyEvent = /^key/, rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/, rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
/* /*
* Helper functions for managing events -- not part of the public interface. * Helper functions for managing events -- not part of the public interface.
...@@ -13,8 +12,9 @@ jQuery.event = { ...@@ -13,8 +12,9 @@ jQuery.event = {
add: function( elem, types, handler, data, selector ) { add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events, var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj, tns, type, namespaces, handleObj,
handleObjIn, handlers, special; handleObjIn, handlers, special,
t = 0;
// Don't attach events to noData or text/comment nodes (allow plain objects tho) // Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
...@@ -53,8 +53,8 @@ jQuery.event = { ...@@ -53,8 +53,8 @@ jQuery.event = {
// Handle multiple events separated by a space // Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn); // jQuery(...).bind("mouseover mouseout", fn);
types = (types || "").match( reventTypes ) || [""]; types = ( types || "" ).match( core_rnotwhite ) || [""];
for ( t = 0; t < types.length; t++ ) { for ( ; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || []; tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1]; type = tns[1];
...@@ -127,8 +127,9 @@ jQuery.event = { ...@@ -127,8 +127,9 @@ jQuery.event = {
// Detach an event or set of events from an element // Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) { remove: function( elem, types, handler, selector, mappedTypes ) {
var t, tns, type, origType, namespaces, origCount, var tns, type, origType, namespaces, origCount,
j, events, special, eventType, handleObj, j, events, special, eventType, handleObj,
t = 0,
elemData = jQuery.hasData( elem ) && jQuery._data( elem ); elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) { if ( !elemData || !(events = elemData.events) ) {
...@@ -136,8 +137,8 @@ jQuery.event = { ...@@ -136,8 +137,8 @@ jQuery.event = {
} }
// Once for each type.namespace in types; type may be omitted // Once for each type.namespace in types; type may be omitted
types = (types || "").match( reventTypes ) || [""]; types = ( types || "" ).match( core_rnotwhite ) || [""];
for ( t = 0; t < types.length; t++ ) { for ( ; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || []; tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1]; type = origType = tns[1];
namespaces = tns[2]; namespaces = tns[2];
......
...@@ -15,20 +15,20 @@ function createSafeFragment( document ) { ...@@ -15,20 +15,20 @@ function createSafeFragment( document ) {
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/, rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/, rtagName = /<([\w:]+)/,
rtbody = /<tbody/i, rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/, rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i, rnoInnerhtml = /<(?:script|style|link)/i,
rnocache = /<(?:script|object|embed|applet|option|style)/i, rnocache = /<(?:script|style|object|embed|applet|option)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
rcheckableType = /^(?:checkbox|radio)$/,
// checked="checked" or checked // checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i, rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/, rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
wrapMap = { wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ], option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ], legend: [ 1, "<fieldset>", "</fieldset>" ],
...@@ -485,7 +485,7 @@ function cloneFixAttributes( src, dest ) { ...@@ -485,7 +485,7 @@ function cloneFixAttributes( src, dest ) {
dest.innerHTML = src.innerHTML; dest.innerHTML = src.innerHTML;
} }
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { } else if ( nodeName === "input" && manipulation_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
// a checked appearance if the defaultChecked value isn't also set // a checked appearance if the defaultChecked value isn't also set
...@@ -611,7 +611,7 @@ function getAll( context, tag ) { ...@@ -611,7 +611,7 @@ function getAll( context, tag ) {
// Used in clean, fixes the defaultChecked property // Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) { function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) { if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked; elem.defaultChecked = elem.checked;
} }
} }
......
var r20 = /%20/g, var r20 = /%20/g,
rbracket = /\[\]$/, rbracket = /\[\]$/,
rCRLF = /\r?\n/g, rCRLF = /\r?\n/g,
rcheckTypes = /^(?:checkbox|radio)$/i,
rsubmitterTypes = /^(?:submit|button|image|reset)$/i, rsubmitterTypes = /^(?:submit|button|image|reset)$/i,
rsubmittable = /^(?:select|textarea|input|keygen)/i; rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({ jQuery.fn.extend({
serialize: function() { serialize: function() {
...@@ -20,7 +19,7 @@ jQuery.fn.extend({ ...@@ -20,7 +19,7 @@ jQuery.fn.extend({
// Use .is(":disabled") so that fieldset[disabled] works // Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) && return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckTypes.test( type ) ); ( this.checked || !manipulation_rcheckableType.test( type ) );
}) })
.map(function( i, elem ){ .map(function( i, elem ){
var val = jQuery( this ).val(); var val = jQuery( this ).val();
......
Subproject commit c488e18facdf50de2d272a052d1e0f663ec19fd4 Subproject commit ac765b61bd4fdc6e76f459f18e1f99c9ed6e28da
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