Commit 69e2f068 authored by Dave Methvin's avatar Dave Methvin

Fix #9469. Remove semi-functional .selector property. Close gh-1006.

Saved 65 bytes.
parent 305e169a
...@@ -203,22 +203,15 @@ jQuery.fn = jQuery.prototype = { ...@@ -203,22 +203,15 @@ jQuery.fn = jQuery.prototype = {
// Take an array of elements and push it onto the stack // Take an array of elements and push it onto the stack
// (returning the new matched element set) // (returning the new matched element set)
pushStack: function( elems, name, selector ) { pushStack: function( elems ) {
// Build a new jQuery matched element set // Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems ); var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference) // Add the old object onto the stack (as a reference)
ret.prevObject = this; ret.prevObject = this;
ret.context = this.context; ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set // Return the newly-formed element set
return ret; return ret;
}, },
......
...@@ -564,7 +564,7 @@ jQuery.each({ ...@@ -564,7 +564,7 @@ jQuery.each({
ret = ret.concat( elems ); ret = ret.concat( elems );
} }
return this.pushStack( ret, name, insert.selector ); return this.pushStack( ret );
} }
}; };
}); });
......
...@@ -25,7 +25,7 @@ jQuery.fn.extend({ ...@@ -25,7 +25,7 @@ jQuery.fn.extend({
}); });
} }
ret = this.pushStack( "", "find", selector ); ret = this.pushStack( [] );
for ( i = 0, l = this.length; i < l; i++ ) { for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length; length = ret.length;
...@@ -44,6 +44,8 @@ jQuery.fn.extend({ ...@@ -44,6 +44,8 @@ jQuery.fn.extend({
} }
} }
// Needed because $( "selector", context ) becomes $( context ).find( "selector" )
ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
return ret; return ret;
}, },
...@@ -62,11 +64,11 @@ jQuery.fn.extend({ ...@@ -62,11 +64,11 @@ jQuery.fn.extend({
}, },
not: function( selector ) { not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector); return this.pushStack( winnow(this, selector, false) );
}, },
filter: function( selector ) { filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector ); return this.pushStack( winnow(this, selector, true) );
}, },
is: function( selector ) { is: function( selector ) {
...@@ -103,7 +105,7 @@ jQuery.fn.extend({ ...@@ -103,7 +105,7 @@ jQuery.fn.extend({
ret = ret.length > 1 ? jQuery.unique( ret ) : ret; ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors ); return this.pushStack( ret );
}, },
// Determine the position of an element within // Determine the position of an element within
...@@ -216,7 +218,7 @@ jQuery.each({ ...@@ -216,7 +218,7 @@ jQuery.each({
ret = ret.reverse(); ret = ret.reverse();
} }
return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); return this.pushStack( ret );
}; };
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment