This is actually a pretty naive implementation (eg. if the element had `class="reallyopen"` it would not work right).

```js
var classes = ' ' + element.className + ' ';
var hasClass = classes.indexOf(' ' + className + ' ') > -1
// then add/remove, trim, set
```