Skip to content

Optimize Selectors: qSA before Sizzle #666

@mr21

Description

@mr21

Hi :)

On this page: https://learn.jquery.com/performance/optimize-selectors/

We can read this:
$( "#container div.robotarm" ); is slower than:
$( "#container" ).find( "div.robotarm" );

But dmethvin said jQuery is testing if querySelectorAll throw an error before using Sizzle.

I made a quick test (with a recent jQuery) and the result is the reverse of what this page is saying.

I suppose we have to write a warning about using the non-standard selector like :contains, :eq, :first etc.

Do you want me to make a PR to rewrite this (if you agree) ?

EDIT: I really dislike the number of this issue 😈

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions