Landed a number of improvements to the selector engine. Results are auto-merged onto the jQuery

object, class filtering is now done inline, and not filtering is more efficient.
This commit is contained in:
John Resig 2009-01-07 00:13:57 +00:00
parent ef661a50b9
commit d8706c5ac9
2 changed files with 58 additions and 25 deletions

View file

@ -260,9 +260,14 @@ jQuery.fn = jQuery.prototype = {
return this.prevObject || jQuery( [] );
},
push: [].push,
find: function( selector ) {
if ( this.length === 1 ) {
return this.pushStack( jQuery.find( selector, this[0] ), "find", selector );
if ( this.length === 1 && !/,/.test(selector) ) {
var ret = this.pushStack( [], "find", selector );
ret.length = 0;
jQuery.find( selector, this[0], ret );
return ret;
} else {
var elems = jQuery.map(this, function(elem){
return jQuery.find( selector, elem );