el.getAttribute("id") vs el.id (v6)

Revision 6 of this benchmark created by jd on


Description

Testing element.getAttribute("id") vs element.id

Preparation HTML

<div id="testID" lineNumber="22"></div>
<script>
  var element = document.getElementById("lineNumber");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.getAttribute("id")
var id = element.getAttribute("lineNumber");
ready
.id
var id = element.lineNumber;
ready

Revisions

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