jQuery CSS vs addClass speed (v12)

Revision 12 of this benchmark created on


Description

asfd

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<style type="text/css">
.newClass {
visibility:"hidden";
display:"none";
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="some preexisting classes"></div>

Teardown


    $('div').remove();
    $('body').append('<div class="some preexisting classes"></div>');
    
  

Test runner

Ready to run.

Testing in
TestOps/sec
Add class
$('div').addClass('newClass').removeClass('newClass')
ready
Apply CSS
$('div').css({
'visibility':'hidden',
'display':'none'
});
ready

Revisions

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