jQuery :has vs .has()

Benchmark created by Mathias Bynens on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>
<code>Foo bar<br>baz</code>
<code>Foo bar baz</code>

Test runner

Ready to run.

Testing in
TestOps/sec
:has selector
$('code:has(br)');
ready
.has() filter
$('code').has('br');
ready

Revisions

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

  • Revision 1: published by Mathias Bynens on