Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($compile): remove invalid IE exceptional case for href
Browse files Browse the repository at this point in the history
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 #5479
  • Loading branch information
plalx authored and petebacondarwin committed Dec 19, 2013
1 parent 26d43ca commit c7a1d1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,9 +1009,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {

nName = directiveNormalize(name.toLowerCase());
attrsMap[nName] = name;
attrs[nName] = value = trim((msie && name == 'href')
? decodeURIComponent(node.getAttribute(name, 2))
: attr.value);
attrs[nName] = value = trim(attr.value);
if (getBooleanAttrName(node, nName)) {
attrs[nName] = true; // presence means true
}
Expand Down
8 changes: 7 additions & 1 deletion test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4243,7 +4243,13 @@ describe('$compile', function() {
expect(element.attr('test2')).toBe('Misko');
expect(element.attr('test3')).toBe('Misko');
}));


it('should work with the "href" attribute', inject(function($compile, $rootScope) {
$rootScope.value = 'test';
element = $compile('<a ng-attr-href="test/{{value}}"></a>')($rootScope);
$rootScope.$digest();
expect(element.attr('href')).toBe('test/test');
}));

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

0 comments on commit c7a1d1a

Please sign in to comment.