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
there are two ways to do this: 1. select additional spaces and replace not with f, but with x+' ' (+trim) or 2. use a new string (written off-hand, not tested):
function(o,c,r){r='';o.className=o.className.replace(/\S+/g,function(x){(c.exec?(c.exec(x)||0)[0]:c)==x||(r+=x+' ')}),r.trim()}