Fixed #1854 by using wizzud's suggestion. The only real difference is the code is...
[jquery.git] / src / core.js
index a37ae78..30820bf 100644 (file)
@@ -342,15 +342,14 @@ jQuery.fn = jQuery.prototype = {
        },
 
        not: function( selector ) {
-               return this.pushStack(
-                       selector.constructor == String &&
-                       jQuery.multiFilter( selector, this, true ) ||
-
-                       jQuery.grep(this, function(elem) {
-                               return selector.constructor == Array || selector.jquery ?
-                                       jQuery.inArray( elem, selector ) < 0 :
-                                       elem != selector;
-                       }) );
+               if (selector.constructor == String)
+                       // test special case where just one selector is passed in
+                       if ( /^.[^:#\[\.]*$/.test(selector) )
+                               return this.pushStack( jQuery.multiFilter( selector, this, true ) );
+                       else
+                               selector = jQuery.multiFilter( selector, this );
+
+               return this.pushStack( jQuery.removeFromArray( selector, this ) );
        },
 
        add: function( selector ) {
@@ -1093,6 +1092,13 @@ jQuery.extend({
                return -1;
        },
 
+       removeFromArray: function( remove, from ) {
+               var isArrayLike = remove.length && remove[remove.length - 1] !== undefined;
+               return jQuery.grep(from, function(elem) {
+                               return isArrayLike ? jQuery.inArray( elem, remove ) < 0 : elem != from;
+                       });
+       },
+
        merge: function( first, second ) {
                // We have to loop this way because IE & Opera overwrite the length
                // expando of getElementsByTagName
@@ -1311,8 +1317,11 @@ jQuery.each([ "Height", "Width" ], function(i, name){
                
                        // Get document width or height
                        this[0] == document ?
-                               // Either scroll[Width/Height] or offset[Width/Height], whichever is greater (Mozilla reports scrollWidth the same as offsetWidth)
-                               Math.max( document.body[ "scroll" + name ], document.body[ "offset" + name ] ) :
+                               // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+                               Math.max( 
+                                       Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), 
+                                       Math.max(document.body["offset" + name], document.documentElement["offset" + name]) 
+                               ) :
 
                                // Get or set width or height on the element
                                size == undefined ?