jQuery.data() vs getAttribute() (v14)

Revision 14 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>

Setup

document.getElementById("test").setAttribute("searchable", true);
    var test2 = document.getElementById("test");
    var test1 = $("#test");

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.data()
test1.data("searchable");
ready
setAttribute()
test2.getAttribute("searchable");
ready

Revisions

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