Combine DOM nodes
JavaScript performance comparison
Info
Compare performance of jQuery vs. native DOM APIs in moving the contents of one element under another.
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
$("body").append('<span id="test">Lorem ipsum <span id="selected-1">dolor sit</span><span id="selected-2" title="important info here"> amet, consectetur</span> adipiscing elit.</span>');
};
Benchmark.prototype.teardown = function() {
$("#test").remove();
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
DOM |
|
pending… |
jQuery |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments