To remove the class, I use
getElementsByClassName("myclass1")[i].classList.remove("myclass2")
based on HTML5 Techniques. (I know that's not for IE9-, that's for browsers only).
As far as I know it is absolutely fine do not check if class exists. Right?
However, in my case there are many items with myclass1
on the page where I want to remove myclass2
, but most of them (let's say 90%) do not have myclass2
.
Will checking if the class myclass2
exists will help to increase the performance as checking if exists could be much faster than delete? (still not sure about my last statement)
What would you do in my case?
Thank you.