Comparison of replacing a class with className, classList.replace and setAttribute (version: 0)
Compares performance of changing the class name through one of the following three interfaces:
- Element.className
- Element.classList.replace
- Element.setAttribute
Inspiration originates from "Avoiding the FOUC v3.0": https://www.paulirish.com/2009/avoiding-the-fouc-v3/
Preparation code is based on this test: https://measurethat.net/Benchmarks/Show/54/0/classname-vs-setattribute-vs-classlist
Comparing performance of: Element.className vs Element.classList vs Element.setAttribute
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory