Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(layout): Prevent class overriding when lastClass is null
Browse files Browse the repository at this point in the history
This fixes an annoying behavior of the layout attributes that is removing all the element's other classes when trying to convert layout attributes to classes.

Closes #5257.
  • Loading branch information
mallowigi authored and ThomasBurleson committed Oct 20, 2015
1 parent 7f82fe4 commit 9025f4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/services/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@
return function updateClassFn(newValue) {
var value = validateAttributeValue(className, newValue || "");
if ( angular.isDefined(value) ) {
element.removeClass(lastClass);
lastClass = !value ? className : className + "-" + value.replace(WHITESPACE, "-")
if (lastClass) {
element.removeClass(lastClass);
}
lastClass = !value ? className : className + "-" + value.replace(WHITESPACE, "-");
element.addClass(lastClass);
}
};
Expand Down

0 comments on commit 9025f4d

Please sign in to comment.