jQuery .is() vs. expando

Benchmark created by Andreas Göbel on


Description

This testcase compares the performance of figuring out whether a checkbox is checked by using jQuerys .is(:checked) pseudo selector vs. node expando property .checked

Preparation HTML

<input type="checkbox" checked/>

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

Test runner

Ready to run.

Testing in
TestOps/sec
.is()
if ($('input').is(':checked')) {}
ready
expando
if ($('input')[0].checked) {}
ready

Revisions

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

  • Revision 1: published by Andreas Göbel on