show vs addclass
JavaScript performance comparison
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style type="text/css">
.displayClass { display: block; }
</style>
<div id="test" style="display: none;">Hi</div>
<script>
var elem = document.getElementById("test");
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
.show() |
|
pending… |
.addClass() |
|
pending… |
.css() |
|
pending… |
raw js |
|
pending… |
jquery to raw js |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Nick Craver
- Revision 4: published by wisevehicle
- Revision 6: published
- Revision 7: published by Mohit Seth
0 comments