Function removes css class names from element class attribute.
Supports regexp as a class name (thing I wait from jQuery for years).
Preserves order, leaves no duplicate or trailing spaces in className.
Regexp should be matched fully, not partially.
/foo-.*/ will match 'foo-bar' in 'foo-bar baz'
/foo-/ will not.
^ and $ means start and end of class name chunk, not of the whole className string
i (case-independent) modifier search is supported
m (multiline) modifier has no meaning
g (global) modifier is ignored: all search behaves as global
removeClass(o, c)
o required object whose className is changed
c required class name: regexp or string (or anything that coerces to string, excepting null and undefined)
Returns: nothing
Interesting fact, I've never considered that. But you're right, let it be an undocumented feature.
For convenience, we may exchange their position:
function(a,b,e,d,c){for(c=/\S+/g;d=c.exec(a.className);)d==(b.exec?(b.exec(d)||0)[0]:b)?0:e=e?e+' '+d:d;a.className=[e]}