diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-07-22 22:23:32 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-07-22 22:23:32 -0400 |
commit | c14a6b385fa419ce67f115e853fb4a89d8bd8fad (patch) | |
tree | c3214778d8bd142388c73b0c6a899372fd95a950 /src/core.js | |
parent | 74cc5b0984335532ab272b8286566000c4bf3daf (diff) | |
download | jquery-c14a6b385fa419ce67f115e853fb4a89d8bd8fad.tar.gz jquery-c14a6b385fa419ce67f115e853fb4a89d8bd8fad.zip |
Clean up regexen; use common regex for numbers. Close gh-862.
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core.js b/src/core.js index 01a3019e7..89e25978c 100644 --- a/src/core.js +++ b/src/core.js @@ -30,6 +30,9 @@ var return new jQuery.fn.init( selector, context, rootjQuery ); }, + // Used for matching numbers + core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, + // Used for detecting and trimming whitespace core_rnotwhite = /\S/, core_rspace = /\s+/, @@ -42,13 +45,13 @@ var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, |