function hasClass(element, className) { var classList = element.className.split(" "); return classList.some(function (name) { return name === className; }); }