jquery prop(id) vs dom id prop (v6)

Revision 6 of this benchmark created by allx on


Description

as of jQuery 1.9

Preparation HTML

<div><div></div>I AM SOME CONTENT LOREM IPSUM DOLOR SIT AMEt<div><a href="http://google.com">non-test text and then <span id="test">test</span></a></div>asdf asdfa ssf saf<span class="filler">jkasdfjkakjdf</span>d</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
  var elem = $('#test')[0];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery prop id
var test_id = $(elem).prop('id');
ready
dom id prop
var test_id = elem.id;
ready
jquery attr id
var test_id = $(elem).attr('id');
ready

Revisions

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