Permalink
Browse files

Make cached rspaces regex definitions consistent. Fixes #9008

  • Loading branch information...
1 parent 632cd6c commit 57f56be04f18f25fbf313973c1d8ce685fa05d3e @rwaldron rwaldron committed with timmywil Apr 28, 2011
Showing with 5 additions and 5 deletions.
  1. +3 −3 src/ajax.js
  2. +2 −2 src/event.js
View
6 src/ajax.js
@@ -13,7 +13,7 @@ var r20 = /%20/g,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
- rspacesAjax = /\s+/,
+ rspaces = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
@@ -71,7 +71,7 @@ function addToPrefiltersOrTransports( structure ) {
}
if ( jQuery.isFunction( func ) ) {
- var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
+ var dataTypes = dataTypeExpression.toLowerCase().split( rspaces ),
i = 0,
length = dataTypes.length,
dataType,
@@ -599,7 +599,7 @@ jQuery.extend({
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspaces );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
View
4 src/event.js
@@ -4,7 +4,7 @@ var hasOwn = Object.prototype.hasOwnProperty,
rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
- rspace = / /g,
+ rspaces = /\s+/,
rescape = /[^\w\s.|`]/g,
fcleanup = function( nm ) {
return nm.replace(rescape, "\\$&");
@@ -1177,7 +1177,7 @@ function liveHandler( event ) {
}
function liveConvert( type, selector ) {
- return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +

2 comments on commit 57f56be

@rdworth

This commit caused a regression in 'make lint':

$ make lint
Checking jQuery against JSLint...

rspaces = /\s+/,
Problem at line 2430 character 13: 'rspaces' is already defined.
rspaces = /\s+/,
Problem at line 6518 character 13: 'rspaces' is already defined.

2 Error(s) found.

@rwaldron
jQuery Foundation member

thanks, I submitted a supplement patch last night that restores the var names and also adds some unit tests, sorry about the eff-up

Please sign in to comment.