Misc

Cleaned up some comments. Simplified some loops. Avoid an issue where
element.className returns SVGAnimatedString instead of DOMString because
SVGAnimatedString does not support trim by just using getAttribute, use
some clearer variable names