mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-08 16:30:26 +00:00
fix: addClass may cause class pad with space, cause test to fail
This commit is contained in:
parent
a19ace31a9
commit
6557017d4e
@ -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(" "));
|
||||
|
Loading…
Reference in New Issue
Block a user