mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-11 16:23:09 +00:00
fix($compile): remove invalid IE exceptional case for href
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
This commit is contained in:
parent
26d43cacdc
commit
c7a1d1ab0b
2 changed files with 8 additions and 4 deletions
|
|
@ -1009,9 +1009,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||||
|
|
||||||
nName = directiveNormalize(name.toLowerCase());
|
nName = directiveNormalize(name.toLowerCase());
|
||||||
attrsMap[nName] = name;
|
attrsMap[nName] = name;
|
||||||
attrs[nName] = value = trim((msie && name == 'href')
|
attrs[nName] = value = trim(attr.value);
|
||||||
? decodeURIComponent(node.getAttribute(name, 2))
|
|
||||||
: attr.value);
|
|
||||||
if (getBooleanAttrName(node, nName)) {
|
if (getBooleanAttrName(node, nName)) {
|
||||||
attrs[nName] = true; // presence means true
|
attrs[nName] = true; // presence means true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4244,6 +4244,12 @@ describe('$compile', function() {
|
||||||
expect(element.attr('test3')).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) {
|
it('should work if they are prefixed with x- or data-', inject(function($compile, $rootScope) {
|
||||||
$rootScope.name = "Misko";
|
$rootScope.name = "Misko";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue