Visible checkboxes
JavaScript performance comparison
Info
http://stackoverflow.com/questions/4696779/performance-of-jquery-visible/4696891#4696891
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="test-content"></div>
<script>
$(function() {
for (var i = 200; i--;) {
$('<input />', {
style: "display:" + ((i % 2) ? 'block' : 'none'),
class: "test-span" + ((i % 2) ? ' visi' : ' notvisi'),
type: 'checkbox',
checked: (Math.random() > 0.5)
}).appendTo('#test-content');
}
});
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
:visible |
|
pending… |
2 classes |
|
pending… |
jQuery.expr.filters.visible |
|
pending… |
:checked:visible |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments