aria-hidden remove vs. change attribute

Benchmark created on


Description

https://stackoverflow.com/questions/77157334/performance-differential-between-omitting-and-changing-an-attribute-of-an-html-e

Preparation HTML

<div id="demo" aria-hidden="true">
	demo element
</div>

Setup

const el = document.getElementById('demo');

Test runner

Ready to run.

Testing in
TestOps/sec
removeAttribute
el.removeAttribute('aria-hidden');
el.setAttribute('aria-hidden', 'true');
ready
setAttribute true/false
el.setAttribute('aria-hidden', 'false');
el.setAttribute('aria-hidden', 'true');
ready

Revisions

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