jquery selectors speed

css-selectors, jquery

Solution

First of all, you're doing it wrong in a weird way. It should be:

var a = $('.listItem', '#myList');

And according to Resig, the `find()` method has proven to be quickest in most cases:

var a = $("#myList").find(".listItem");

Problem

Which of these two is better/faster? ``` var a = $('.listItem', $('#myList')); ``` vs ``` var a = $('#myList .listItem'); ```

Original source