diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 0b71e128c..2037fd37b 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -57,7 +57,8 @@ exports.hasClass = function(el,className) { }; exports.addClass = function(el,className) { - var c = (el.getAttribute("class") || "").split(" "); + var classAttr = el.getAttribute("class") || ""; + var c = classAttr.trim() ? classAttr.split(" ") : []; if(c.indexOf(className) === -1) { c.push(className); el.setAttribute("class",c.join(" "));