cache selector

Benchmark created by Rasmita Dash on


Preparation HTML

< div id = 'Mydiv' >
 < label > Label 1 < /label>
  <label class='myClass'>Label 2</label > 
< label > Label 3 < /label>
</div ><script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
without cache
$('#Mydiv label.myClass').html('My label');
        $('#Mydiv label.myClass').css('border','1px solid red');
        $('#Mydiv label.myClass').show();
ready
cache the element
var SelElement = $('#Mydiv label.myClass');     
        SelElement.html('My label');
        SelElement.css('border','1px solid red');
        SelElement.show();
ready

Revisions

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

  • Revision 1: published by Rasmita Dash on