Skip to content

Commit 92231e6

Browse files
plalxjamesdaily
authored andcommitted
fix($compile): remove invalid IE exceptional case for href
It appears that this exceptional case was only valid for IE<8 and that for IE>=8 it was actually causing a bug with the `ng-href-attr` directive on `<a>` elements. Closes angular#5479
1 parent e270519 commit 92231e6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/ng/compile.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1009,9 +1009,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
10091009

10101010
nName = directiveNormalize(name.toLowerCase());
10111011
attrsMap[nName] = name;
1012-
attrs[nName] = value = trim((msie && name == 'href')
1013-
? decodeURIComponent(node.getAttribute(name, 2))
1014-
: attr.value);
1012+
attrs[nName] = value = trim(attr.value);
10151013
if (getBooleanAttrName(node, nName)) {
10161014
attrs[nName] = true; // presence means true
10171015
}

test/ng/compileSpec.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -4243,7 +4243,13 @@ describe('$compile', function() {
42434243
expect(element.attr('test2')).toBe('Misko');
42444244
expect(element.attr('test3')).toBe('Misko');
42454245
}));
4246-
4246+
4247+
it('should work with the "href" attribute', inject(function($compile, $rootScope) {
4248+
$rootScope.value = 'test';
4249+
element = $compile('<a ng-attr-href="test/{{value}}"></a>')($rootScope);
4250+
$rootScope.$digest();
4251+
expect(element.attr('href')).toBe('test/test');
4252+
}));
42474253

42484254
it('should work if they are prefixed with x- or data-', inject(function($compile, $rootScope) {
42494255
$rootScope.name = "Misko";

0 commit comments

Comments
 (0)