The add() method of the DOMTokenList interface adds the given tokens to the list, omitting any that are already present.
So Element#classAdd is entirely redundant because DOMTokenList#addalready checks if a supplied class name is already present and does not add it twice.
The same applies to Element#classRemove.
Most of the PCUI codebase (plus apps built on PCUI) already do element.class.add/remove instead of element.classAdd/Remove. This PR migrates the remaining occurrences to simply use the DOMTokenList API.
This PR removes
Element#classAdd
andElement#classRemove
from the API. Let's examine the docs forElement#classAdd
:It performs this check using the
DOMTokenList#contains
function.Now let's examine the docs for
DOMTokenList#add
:So
Element#classAdd
is entirely redundant becauseDOMTokenList#add
already checks if a supplied class name is already present and does not add it twice.The same applies to
Element#classRemove
.Most of the PCUI codebase (plus apps built on PCUI) already do
element.class.add/remove
instead ofelement.classAdd/Remove
. This PR migrates the remaining occurrences to simply use theDOMTokenList
API.