As it turns out, the context was being started at a higher root than needed - fixing this speeds up > selectors.

This commit is contained in:
John Resig 2009-02-26 01:15:54 +00:00
parent 58235cc38e
commit 410e13b400

View File

@ -68,7 +68,7 @@ var Sizzle = function(selector, context, results, seed) {
if ( context ) { if ( context ) {
var ret = seed ? var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } : { expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, contextXML ); Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
if ( parts.length > 0 ) { if ( parts.length > 0 ) {