Skip to content

Commit 2cdf3fc

Browse files
committed
Better whitespace check
1 parent c187e6d commit 2cdf3fc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var re_name = /^(?:\\.|[\w\-\u00c0-\uFFFF])+/,
55
re_cleanSelector = /([^\\])\s*([>~+]|$)\s*/g, //Don't remove escaped spaces from "#\ > a". This will trim spaces after "\ ", including trailing whitespace
66
re_nthElement = /^([+\-]?\d*n)?\s*([+\-])?\s*(\d)?$/,
77
re_escapedCss = /\\(\d{6}|.)/g,
8-
re_whitespace = /\s/,
8+
re_nonNumeric = /^\D$/,
99
re_attr = /^\s*((?:\\.|[\w\u00c0-\uFFFF\-])+)\s*(?:(\S?)=\s*(?:(['"])(.*?)\3|(#?(?:\\.|[\w\u00c0-\uFFFF\-])*)|)|)\s*(i)?\]/; //https://github.com/jquery/sizzle/blob/master/sizzle.js#L374
1010

1111
var actionTypes = {
@@ -38,8 +38,7 @@ function unescapeCSS(str){
3838
//based on http://mathiasbynens.be/notes/css-escapes
3939
//TODO support short sequences (/\\\d{1,5} /)
4040
return str.replace(re_escapedCss, function(m, s){
41-
// isNaN(' ') is false (!)
42-
if(isNaN(s) || re_whitespace.test(s)) return s;
41+
if (re_nonNumeric.test(s)) return s;
4342
return String.fromCharCode(parseInt(s, 10));
4443
});
4544
}

0 commit comments

Comments
 (0)