Skip to content

Commit

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

nName = directiveNormalize(name.toLowerCase());
attrsMap[nName] = name;
attrs[nName] = value = trim((msie && name == 'href')
attrs[nName] = value = trim((msie<9 && name == 'href')
? decodeURIComponent(node.getAttribute(name, 2))
: attr.value);
if (getBooleanAttrName(node, nName)) {
Expand Down
6 changes: 6 additions & 0 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4244,6 +4244,12 @@ describe('$compile', function() {
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 2e38528

Please sign in to comment.