More changes to get jQuery in line with JSLint.
[jquery.git] / src / core.js
index 16d0529..50e1676 100644 (file)
@@ -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;
        }