david-mark-llc / jessie

Javascript cross-browser library builder enabling (real) progressive enhancement
http://jessie.herokuapp.com
39 stars 13 forks source link

Asymmetry in add/removeClass #318

Open david-mark opened 8 years ago

david-mark commented 8 years ago

Have never agreed with removeClass functions that silently removed duplicate classes (hiding a previous mistake that needs to be tracked down), but that's what the - classList.remove - renditions do.

As we can't change he behavior of the host method, we should match its unwanted (and silent) duplicate class removal in the legacy rendition. Just do a global replace.

Also recommend scaffolding to prevent adding duplicate classes (currently covers up that mistake in all renditions).

For convenience, recommend a replaceClass function as well. Just one rendition as it will have no DOM dependencies (only other library functions).