diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js index 7c98abf31..b00d02120 100644 --- a/src/ng/directive/booleanAttrs.js +++ b/src/ng/directive/booleanAttrs.js @@ -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); diff --git a/test/ng/directive/booleanAttrsSpec.js b/test/ng/directive/booleanAttrsSpec.js index 2b4dc30c4..6bcb57eeb 100644 --- a/test/ng/directive/booleanAttrsSpec.js +++ b/test/ng/directive/booleanAttrsSpec.js @@ -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('')($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('')($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) {