$(condition).remove() vs $().remove(condition)

JavaScript performance comparison

Test case created by l2ealize

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<p>This is a paragraph in the div.</p>
<p class="italic"><i>This is another paragraph in the div.</i></p>
<p class="italic"><i>This is another paragraph in the div.</i></p>
<p id="p1"><i>This is another paragraph in the div. p1</i></p>
<p id="p2"><i>This is another paragraph in the div. p2</i></p>

Preparation code output

This is a paragraph in the div.

This is another paragraph in the div.

This is another paragraph in the div.

This is another paragraph in the div. p1

This is another paragraph in the div. p2

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
$(condition).remove()
$('p.italic').remove();
pending…
$().remove(condition)
$('p').remove('.italic');
pending…

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

Compare results of other browsers

0 comments

Add a comment