Skip to content

Commit

Permalink
revert: fix(ngHref): remove attribute when empty value instead of ign…
Browse files Browse the repository at this point in the history
…oring

This reverts commit 948c86c.

This commit caused tests to fail in IE8 due to a TypeError '0.childNodes is
null or not an object. The issue should be investigated and fixed. Issue angular#8340
has been opened to investigate.

See this job for failures: https://travis-ci.org/angular/angular.js/jobs/30792508
  • Loading branch information
jeffbcross committed Jul 25, 2014
1 parent e25ed0d commit cd9afd9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
8 changes: 2 additions & 6 deletions src/ng/directive/booleanAttrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,8 @@ forEach(['src', 'srcset', 'href'], function(attrName) {
}

attr.$observe(normalized, function(value) {
if (!value) {
if (attrName === 'href') {
attr.$set(name, null);
}
return;
}
if (!value)
return;

attr.$set(name, value);

Expand Down
17 changes: 0 additions & 17 deletions test/ng/directive/booleanAttrsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,23 +252,6 @@ describe('ngHref', function() {
expect(element.attr('href')).toEqual('http://server');
}));

it('should not set the href if ng-href is empty', inject(function($rootScope, $compile) {
$rootScope.url = null;
element = $compile('<a ng-href="{{url}}">')($rootScope);
$rootScope.$digest();
expect(element.attr('href')).toEqual(undefined);
}));

it('should remove the href if ng-href changes to empty', inject(function($rootScope, $compile) {
$rootScope.url = 'http://www.google.com/';
element = $compile('<a ng-href="{{url}}">')($rootScope);
$rootScope.$digest();

$rootScope.url = null;
$rootScope.$digest();
expect(element.attr('href')).toEqual(undefined);
}));

if (isDefined(window.SVGElement)) {
describe('SVGAElement', function() {
it('should interpolate the expression and bind to xlink:href', inject(function($compile, $rootScope) {
Expand Down

0 comments on commit cd9afd9

Please sign in to comment.