diff --git a/src/core/services/layout/layout.js b/src/core/services/layout/layout.js index 55b14762862..f9a8df37334 100644 --- a/src/core/services/layout/layout.js +++ b/src/core/services/layout/layout.js @@ -425,7 +425,9 @@ function buildUpdateFn(element, className, attrs) { return function updateAttrValue(fallback) { if (!needsInterpolation(fallback)) { - element.attr(className, fallback); + // Do not modify the element's attribute value; so + // uses '' will not + // be affected. Just update the attrs value. attrs[attrs.$normalize(className)] = fallback; } }; diff --git a/src/core/services/layout/layout.spec.js b/src/core/services/layout/layout.spec.js index aee01b23a42..60760a73903 100644 --- a/src/core/services/layout/layout.spec.js +++ b/src/core/services/layout/layout.spec.js @@ -20,8 +20,10 @@ describe('layout directives', function() { it('should ignore invalid values', function() { var element = $compile('
Layout
')(pageScope); - expect(element.hasClass("layout-row")).toBeTruthy(); + + expect( element.attr('layout') ).toBe('humpty'); // original attribute value unmodified expect(element.hasClass('layout-humpty')).toBeFalsy(); + expect(element.hasClass("layout-row")).toBeTruthy(); // injected className based on fallback value }); it('should support interpolated values layout-gt-sm="{{direction}}"', function() { @@ -37,6 +39,7 @@ describe('layout directives', function() { expect(element.hasClass('layout-gt-sm-column')).toBeTruthy(); }); + /** * For all breakpoints, * - Test percentage values