use classList for class ops where available; ref #2164

makes it much faster, and also makes adding/removing classes work for
SVG elements