Pseudo Selector vs attribute selector

Benchmark created by Vuly on


Description

Which performs better?

Preparation HTML

<input name="test" type="radio" value="cd" checked="checked" />
<input name="test" type="radio" value="ab" /><script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
  var test1;
  var test2;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Pseudo Selector
test1 = $('input:radio:checked').val();
ready
Attribute selector
test2 = $('input[type=radio]:checked').val();
ready

Revisions

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