Switching from .className to .getAttribute('class') caused failure when
there was no `class` attribute.