jquery element in dom (v40)

Revision 40 of this benchmark created by mirek on


Description

...and if you're not using id, which means document doesn't have a map to check.

Preparation HTML

<div data-foo="element"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

Setup

var el = $('[data-foo="element"]');

Test runner

Ready to run.

Testing in
TestOps/sec
selector
el.closest("html");
ready
object
el.closest(document.documentElement);
ready
jQuery.contains
jQuery.contains(document.documentElement, el[0])
ready

Revisions

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