Update getClass to support SVG edge case

This needs a var keyword for scope safety.