// (both of which we optimize for)
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
+// Is it a simple selector
+var isSimple = /^.[^:#\[\.]*$/;
+
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
},
not: function( selector ) {
- if (selector.constructor == String)
+ if ( selector.constructor == String )
// test special case where just one selector is passed in
- if ( /^.[^:#\[\.]*$/.test(selector) )
+ if ( isSimple.test( selector ) )
return this.pushStack( jQuery.multiFilter( selector, this, true ) );
else
selector = jQuery.multiFilter( selector, this );
- return this.pushStack( jQuery.removeFromArray( selector, this ) );
+ return this.filter(function() {
+ return jQuery.inArray( this, selector ) < 0;
+ });
},
add: function( selector ) {
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