From 4cf97b150fbd1acead4943a460b6c35de9c06c27 Mon Sep 17 00:00:00 2001 From: Elior Boukhobza Date: Mon, 19 Oct 2015 20:18:25 +0300 Subject: [PATCH] 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. --- src/core/services/layout/layout.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/services/layout/layout.js b/src/core/services/layout/layout.js index bf79a60ecd4..22f6449417e 100644 --- a/src/core/services/layout/layout.js +++ b/src/core/services/layout/layout.js @@ -322,7 +322,9 @@ return function updateClassFn(newValue) { var value = validateAttributeValue(className, newValue || ""); if ( angular.isDefined(value) ) { - element.removeClass(lastClass); + if (lastClass) { + element.removeClass(lastClass); + } lastClass = !value ? className : className + "-" + value.replace(WHITESPACE, "-") element.addClass(lastClass); }