$('<div class='foobar' ...>') vs $('<div>',{'class':'foobar'...}) with jQuery 1.9
JavaScript performance comparison
Info
same test as http://jsperf.com/innerhtml-vs-addattribute-later with jQuery 1.9
Preparation code
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
innerHtml |
|
pending… |
createElement and add attributes |
|
pending… |
createElement and add attributes with chain |
|
pending… |
pure Javascript DOM operation |
|
pending… |
test4 + wrap in a Jquery obj |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments