Skip to content

Commit 2e38528

Browse files
fix($compile): only run exceptional href case for IE<9
There is a special case for getting hold of the href value for old versions of IE. But it turns out that this actually breaks newer versions of IE. Closes angular#5479
1 parent 26d43ca commit 2e38528

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/ng/compile.js

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

10101010
nName = directiveNormalize(name.toLowerCase());
10111011
attrsMap[nName] = name;
1012-
attrs[nName] = value = trim((msie && name == 'href')
1012+
attrs[nName] = value = trim((msie<9 && name == 'href')
10131013
? decodeURIComponent(node.getAttribute(name, 2))
10141014
: attr.value);
10151015
if (getBooleanAttrName(node, nName)) {

test/ng/compileSpec.js

+6
Original file line numberDiff line numberDiff line change
@@ -4244,6 +4244,12 @@ describe('$compile', function() {
42444244
expect(element.attr('test3')).toBe('Misko');
42454245
}));
42464246

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)