diff options
Diffstat (limited to 'src/data.js')
-rw-r--r-- | src/data.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/data.js b/src/data.js index 3bd4b9715..562834aa1 100644 --- a/src/data.js +++ b/src/data.js @@ -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 ) {} |