You should try to use [classList](http://caniuse.com/classlist) where available and fall back to this.