From 4b0f2dfe0cbd4b5348af8cfb5af2e40904c73a47 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Tue, 31 May 2011 14:51:47 +0200 Subject: Fix IE bug - ng:href ng:href was producing unclickable links, as the event propagation was stopped by 'a' widget All links in regression/issue-352.html were tested in: * Chrome 11 * Opera 11 * Firefox 4 * IE7, IE8 Closes #352 --- src/widgets.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/widgets.js') diff --git a/src/widgets.js b/src/widgets.js index 6aa0227c..a56a967e 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -821,7 +821,15 @@ angularWidget('a', function() { this.directives(true); return function(element) { - if (element.attr('href') === '') { + var hasNgHref = ((element.attr('ng:bind-attr') || '').indexOf('"href":') !== -1); + + // turn link into a link in IE + // but only if it doesn't have name attribute, in which case it's an anchor + if (!hasNgHref && !element.attr('name') && !element.attr('href')) { + element.attr('href', ''); + } + + if (element.attr('href') === '' && !hasNgHref) { element.bind('click', function(event){ event.preventDefault(); }); -- cgit v1.2.3