Applied the RegExp issues reported by Jeff Robinson here: http://jmrware.com/articles/2010/jqueryregex/jQueryRegexes.html Additionally broke out all remaining inline RegExp. Fixes #7062.

This commit is contained in:
jeresig 2010-09-22 09:16:28 -04:00
parent 19b5d9e874
commit 9dc6e0c572
8 changed files with 66 additions and 50 deletions

View file

@ -1,7 +1,8 @@
(function( jQuery ) {
var windowData = {},
rbrace = /^(?:\{.*\}|\[.*\])$/;
rbrace = /^(?:\{.*\}|\[.*\])$/,
rdigit = /\d/;
jQuery.extend({
cache: {},
@ -157,7 +158,7 @@ jQuery.fn.extend({
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
/\d/.test( data ) && !isNaN( data ) ? parseFloat( data ) :
rdigit.test( data ) && !isNaN( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}