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

Revision 9 of this benchmark created on


Description

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

Preparation HTML

<input type="text" id="testID" LineNumber="22"                              </input>

<script>
  var element = document.getElementById("testID");
</script>

Test runner

Ready to run.

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

Revisions

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