jQuery.data() vs getAttribute() (v3)

Revision 3 of this benchmark created on


Description

Test the data attribute

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="test">foo</div>
<script>
  $el = jQuery(document.getElementById("test"));
  el = document.getElementById("test");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.data()
$el.data("searchable", true);
$el.data("searchable");
ready
setAttribute()
el.setAttribute("searchable", true);
el.getAttribute("searchable");
ready

Revisions

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