diff options
author | jeresig <jeresig@gmail.com> | 2010-03-01 21:24:49 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-03-01 21:24:49 -0500 |
commit | dcf0fa5048ef2379d551f29ffa29b14ec5ee09d5 (patch) | |
tree | 8a1575a43c3f62be0aa768590742246fa950f11b /src/core.js | |
parent | 8c8f685a911c811e9b998958dd453a6a2b9d5940 (diff) | |
download | jquery-dcf0fa5048ef2379d551f29ffa29b14ec5ee09d5.tar.gz jquery-dcf0fa5048ef2379d551f29ffa29b14ec5ee09d5.zip |
More changes to get jQuery in line with JSLint.
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core.js b/src/core.js index 16d052963..50e167657 100644 --- a/src/core.js +++ b/src/core.js @@ -18,7 +18,7 @@ var jQuery = function( selector, context ) { // A simple way to check for HTML strings or ID strings // (both of which we optimize for) - quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, + quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w\-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.,]*$/, @@ -623,12 +623,14 @@ jQuery.extend({ }, grep: function( elems, callback, inv ) { - var ret = []; + var ret = [], retVal; + inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { - if ( !inv !== !callback( elems[ i ], i ) ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { ret.push( elems[ i ] ); } } @@ -748,7 +750,7 @@ function doScrollCheck() { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); - } catch( error ) { + } catch(e) { setTimeout( doScrollCheck, 1 ); return; } |