If you add a class name with a space to an element that doesn't yet have a class name, Mozilla ignores the leading space.
Sometimes you want to add class names to an element, like
x.className += ' over';
The purpose is to make sure that any class name that has already been defined is not overwritten, but that the new class name is added to the other class names.
If you do this on an element that does not yet have a class name, Mozilla removes the leading space.
In the test below Mozilla alerts
'over', while all other browsers correctly alert
This can be a problem if you use a regexp to remove the class name, including the space. The regexp doesn't work in Mozilla.
x.className = x.className.replace(/ over/,'');
Do the test. We add class name
over (with a leading space)
to this div, that doesn't yet have a class name.