hasAttribute vs jQuery is

Benchmark created by Sam on


Preparation HTML

<select>
  <option value="hasAttr">
    Has a value attr
  </option>
  <option>
    Does not have a value attr
  </option>
</select><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Setup

$options = $('option');

Test runner

Ready to run.

Testing in
TestOps/sec
hasAttribute
$options.eq(0)[0].hasAttribute('value');
$options.eq(1)[0].hasAttribute('value');
ready
jQuery is
$options.eq(0).is('[value]');
$options.eq(1).is('[value]');
ready

Revisions

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