|
|
|
|
|
by masklinn
2265 days ago
|
|
> Why is classList read-only, I can think of any valid reason. Because it's a live DOMTokenList, not a computed property. That is if you keep a reference to a classList and mutate the className parameter, classList will reflect the changes. classList could also be a computed property which, when assigned to, clears the underlying token list and adds all elements but I'm guessing the developers of the API saw this as unnecessary complexity given you can do the same thing by setting className. The point of classList is the ability to more easily check for and toggle individual classes, if you don't need that capability you just don't use classList. > Perhaps ele.className=(v.classes).join(" ") is a valid solution? Yes. |
|