JS Test Suite Attributes - Get

JavaScript performance comparison

Test case created by JP

Preparation code

<script src='http://code.jquery.com/jquery-1.7.1.min.js'></script>
<script>
jq17 = jQuery.noConflict();
</script>

<script src="http://code.jquery.com/jquery-2.0.0b1.js"></script>
<script>
jq20 = jQuery.noConflict();
</script>

<script src="http://cdn.jqmobi.com/jq.mobi.min.js"></script>

<div class='tests'>
  <div id='attributes_test_getting' class='test' data-custom-attr='customTestAttr'></div>
  <div id='attributes_test_setting' class='test'></div>
  <div id='attributes_test_removing' class='test' data-delete-attr='deleteMe'></div>
</div>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jqMobi - attr
jq("#attributes_test_getting").attr('data-custom-attr');
 
pending…
jQuery 1.7.1 - attr
jq17("#attributes_test_getting").attr('data-custom-attr');
pending…
jQuery 2.0 - attr
jq20("#attributes_test_getting").attr('data-custom-attr');
pending…
Native - Data Set
document.getElementById("attributes_test_getting").dataset.customAttr;
pending…
Native - Get Attribute
document.getElementById("attributes_test_getting").getAttribute('data-custom-attr');
pending…

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

Compare results of other browsers

0 comments

Add a comment