Wow, thanks for catching that. That's amusing that it was still so
fast without using querySelectorAll, in that case. Just committed the
fix:
http://github.com/jeresig/sizzle/commit/6239a25918f8fd7d56fc97c22815418833a64e00

--John



On Mon, Oct 20, 2008 at 10:47 AM, Per Cederberg <[EMAIL PROTECTED]> wrote:
> Of course, FF 3.1 includes querySelectorAll:
>
> http://ejohn.org/blog/queryselectorall-in-firefox-31/
>
> And in fact, there is a slight bug in Sizzle here, causing it to not
> use that version when not sending in an explicit 2:nd argument:
>
>    Sizzle("...", document)
>
> The problem is here:
>
> if ( document.querySelectorAll ) (function(){
>    var oldSizzle = Sizzle;
>
>    Sizzle = function(query, context, extra){
>        if ( context === document ) {
>            try {
>                return makeArray(context.querySelectorAll(query));
>            } catch(e){}
>        }
>
>        return oldSizzle(query, context, extra);
>    };
>
>    Sizzle.find = oldSizzle.find;
>    Sizzle.filter = oldSizzle.filter;
> })();
>
> Cheers,
>
> /Per
>
> On Mon, Oct 20, 2008 at 4:05 PM, Arnar Birgisson <[EMAIL PROTECTED]> wrote:
>>
>> Hi John,
>>
>> On Mon, Oct 20, 2008 at 15:52, John Resig <[EMAIL PROTECTED]> wrote:
>>> That's... odd. Are there any selectors that are noticeably faster?
>>
>> Yes, it seems that nested queries are to blame. By nested queries I
>> mean queries that uses the axis combinator, either the implicit
>> "descendant" axis (like "div p") or an explicit axis combinator such
>> as ~, > or +.
>>
>> "div ~ p" is 2ms on MK+Sizzle vs. 13ms on Sizzle.
>> "div p" is 2ms on MK+Sizzle vs. 4ms on Sizzle.
>> "div > p" is 1ms vs. 3ms
>> "div + p" is 1ms vs. 5ms
>> "div p a" is 1ms vs. 8ms
>>
>> Also, a[href][lang][class] is 1ms vs. 9ms.
>>
>>> Maybe something is failing?
>>
>> I don't think so, at least the number of elements returned by each is
>> the same in every test.
>>
>> You can run the test benchmark yourself here:
>> http://www.hvergi.net/arnar/public/sizzle/speed/
>>
>> cheers,
>> Arnar
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to