function addClass(element, className) {
    if (!className) return;

    if (element.classList) {
      element.classList.add(className);
    } else {
      if (!elementMatches(element, '.' + className)) {
        element.className += ' ' + className;
      }
    }
  }
Add class to an element.

@param {HTMLElement} element
@param {String} className