Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
using getAttribute vs property to access an element's href
ok
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
getAttribute
172.7 Ops/sec
property
140.3 Ops/sec
HTML Preparation code:
hi <a id="yes" href="/okay">go here!!!! jkkjkkjjj don't</a>
Tests:
getAttribute
const element = document.getElementById('yes'); let i = 1000; while (i--) { // here let attr = element.getAttribute('href'); console.log(attr); }
property
const element = document.getElementById('yes'); let i = 1000; while (i--) { // here 2 let attr = element.href; console.log(attr); }