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

Commit d729fcf

Browse files
fix(a): don't reload if there is only a name attribute
Closes #6273 Closes #10880
1 parent 0baa17a commit d729fcf

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

src/ng/directive/a.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var htmlAnchorDirective = valueFn({
1717
restrict: 'E',
1818
compile: function(element, attr) {
19-
if (!attr.href && !attr.xlinkHref && !attr.name) {
19+
if (!attr.href && !attr.xlinkHref) {
2020
return function(scope, element) {
2121
// If the linked element is not an anchor tag anymore, do nothing
2222
if (element[0].nodeName.toLowerCase() !== 'a') return;

src/ng/directive/attrs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
}, 5000, 'page should navigate to /123');
6969
});
7070
71-
xit('should execute ng-click but not reload when href empty string and name specified', function() {
71+
it('should execute ng-click but not reload when href empty string and name specified', function() {
7272
element(by.id('link-4')).click();
7373
expect(element(by.model('value')).getAttribute('value')).toEqual('4');
7474
expect(element(by.id('link-4')).getAttribute('href')).toBe('');

test/ng/directive/aSpec.js

-26
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,6 @@ describe('a', function() {
8282
});
8383

8484

85-
it('should not link and hookup an event if name is present at compile', function() {
86-
var jq = jQuery || jqLite;
87-
element = jq('<a name="bobby">hello@you</a>');
88-
var linker = $compile(element);
89-
90-
spyOn(jq.prototype, 'on');
91-
92-
linker($rootScope);
93-
94-
expect(jq.prototype.on).not.toHaveBeenCalled();
95-
});
96-
97-
9885
it('should not preventDefault if anchor element is replaced with href-containing element', function() {
9986
spyOn(jqLite.prototype, 'on').andCallThrough();
10087
element = $compile('<a link-to="https://www.google.com">')($rootScope);
@@ -168,19 +155,6 @@ describe('a', function() {
168155

169156
expect(jq.prototype.on).not.toHaveBeenCalled();
170157
});
171-
172-
173-
it('should not link and hookup an event if name is present at compile', function() {
174-
var jq = jQuery || jqLite;
175-
element = jq('<svg><a name="bobby">hello@you</a></svg>');
176-
var linker = $compile(element);
177-
178-
spyOn(jq.prototype, 'on');
179-
180-
linker($rootScope);
181-
182-
expect(jq.prototype.on).not.toHaveBeenCalled();
183-
});
184158
});
185159
}
186160
});

0 commit comments

Comments
 (0)