Skip to content

Commit

Permalink
Patches error of setClass not working #241
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Pulges committed Oct 27, 2015
1 parent 6d7a5ab commit b62f847
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/dom/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,27 +566,31 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) {
}


if (typeof(allowedClasses) === "string" && allowedClasses === "any" && oldNode.getAttribute("class")) {
if (currentRules.classes_blacklist) {
oldClasses = oldNode.getAttribute("class");
if (oldClasses) {
classes = classes.concat(oldClasses.split(WHITE_SPACE_REG_EXP));
}
if (typeof(allowedClasses) === "string" && allowedClasses === "any") {
if (oldNode.getAttribute("class")) {
if (currentRules.classes_blacklist) {
oldClasses = oldNode.getAttribute("class");
if (oldClasses) {
classes = classes.concat(oldClasses.split(WHITE_SPACE_REG_EXP));
}

classesLength = classes.length;
for (; i<classesLength; i++) {
currentClass = classes[i];
if (!currentRules.classes_blacklist[currentClass]) {
newClasses.push(currentClass);
classesLength = classes.length;
for (; i<classesLength; i++) {
currentClass = classes[i];
if (!currentRules.classes_blacklist[currentClass]) {
newClasses.push(currentClass);
}
}
}

if (newClasses.length) {
attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" ");
}
if (newClasses.length) {
attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" ");
}

} else {
attributes["class"] = oldNode.getAttribute("class");
}
} else {
attributes["class"] = oldNode.getAttribute("class");
attributes["class"] = wysihtml5.lang.array(classes).unique().join(" ");
}
} else {
// make sure that wysihtml5 temp class doesn't get stripped out
Expand Down

0 comments on commit b62f847

Please sign in to comment.