From 1b2d0fe851f331f17d0fbc12e7ba4694adb7a153 Mon Sep 17 00:00:00 2001 From: Siddique Hameed Date: Thu, 2 Jan 2014 10:18:02 -0600 Subject: [PATCH 1/2] Fix for issue #5513 --- src/ng/compile.js | 2 +- test/ng/compileSpec.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ng/compile.js b/src/ng/compile.js index 9285b253d0b3..6a40f54f85f2 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1009,7 +1009,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { nName = directiveNormalize(name.toLowerCase()); attrsMap[nName] = name; - attrs[nName] = value = trim(attr.value); + attrs[nName] = value = attr.value; if (getBooleanAttrName(node, nName)) { attrs[nName] = true; // presence means true } diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index c37461fcc007..a13ed3d53cad 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2387,6 +2387,14 @@ describe('$compile', function() { expect(componentScope.attrAlias).toEqual(componentScope.attr); })); + it('should copy simple attribute with spaces', inject(function() { + compile('
'); + + expect(componentScope.attr).toEqual(' some text '); + expect(componentScope.attrAlias).toEqual(' some text '); + expect(componentScope.attrAlias).toEqual(componentScope.attr); + })); + it('should set up the interpolation before it reaches the link function', inject(function() { $rootScope.name = 'misko'; compile('
'); From 03181e6287aa0eaa80daa4c3d76a147985d29add Mon Sep 17 00:00:00 2001 From: Siddique Hameed Date: Thu, 2 Jan 2014 10:18:49 -0600 Subject: [PATCH 2/2] Fix for issue #5513 --- test/ng/compileSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index a13ed3d53cad..16d25a6627ff 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2387,7 +2387,7 @@ describe('$compile', function() { expect(componentScope.attrAlias).toEqual(componentScope.attr); })); - it('should copy simple attribute with spaces', inject(function() { + it('should copy simple attribute value with spaces', inject(function() { compile('
'); expect(componentScope.attr).toEqual(' some text ');