jQuery .find() vs context, w/o special case (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id='myDiv'>
  <p>
    hello
    <a href="http://www.example.com/">link</a>
  </p>
  <p>
    world
    <a href="http://www.example.com/">link</a>
  </p>
</div>
<script>
  if (!window.console || !window.console.log) {
    throw 'console.log() is not supported. Please install Firebug. http://getfirebug.com'
  }
</script>

Setup

var $myDiv = $("#myDiv"),
        context = $myDiv[0];

Test runner

Ready to run.

Testing in
TestOps/sec
.find()
$myDiv.find('a');
ready
context
$('a', $myDiv);
ready
context modified
$('a', context);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.