Appending HTML element with attributes
JavaScript performance comparison
Preparation code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="screenshots">
</div>
<script>
Benchmark.prototype.setup = function() {
var link = "something.html";
var title = "Some Title";
var el = "someImg.png";
};
Benchmark.prototype.teardown = function() {
$("#screenshots").empty();
};
</script>
Preparation code output
<div id="screenshots">
</div>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
Original Code
|
|
pending… |
DOM scripting
|
|
pending… |
getElementById append
|
|
pending… |
Actual DOM Scripting
|
|
pending… |
insertAdjacentHTML
|
|
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.
- Revision 1: published Will Klein
- Revision 2: published
- Revision 3: published Paul Grenier
- Revision 4: published Scott Sauyet
- Revision 5: published Will Klein
- Revision 6: published
- Revision 7: published jason
- Revision 8: published Rafael
- Revision 9: published
- Revision 10: published
- Revision 11: published and last updated
- Revision 12: published
- Revision 13: published Heavensrevenge
- Revision 14: published
0 Comments