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

Commit 9025f4d

Browse files
mallowigiThomasBurleson
authored andcommitted
fix(layout): Prevent class overriding when lastClass is null
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.
1 parent 7f82fe4 commit 9025f4d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/services/layout/layout.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,10 @@
322322
return function updateClassFn(newValue) {
323323
var value = validateAttributeValue(className, newValue || "");
324324
if ( angular.isDefined(value) ) {
325-
element.removeClass(lastClass);
326-
lastClass = !value ? className : className + "-" + value.replace(WHITESPACE, "-")
325+
if (lastClass) {
326+
element.removeClass(lastClass);
327+
}
328+
lastClass = !value ? className : className + "-" + value.replace(WHITESPACE, "-");
327329
element.addClass(lastClass);
328330
}
329331
};

0 commit comments

Comments
 (0)