From 39232c09804ad4ac153b7f213cd582f197d4019b Mon Sep 17 00:00:00 2001 From: James Strachan Date: Fri, 29 Nov 2013 11:48:23 +0000 Subject: [PATCH] fix : avoid TypeError: Object # has no method 'indexOf' when clicking on an SVG diagram with links a minor patch to check a url is a string before attempting to call indexOf() on it to avoid barfing on SVGAnimatedString fixes #5198 --- src/ng/location.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/ng/location.js b/src/ng/location.js index 402db3cf04d5..e33e73617646 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -629,16 +629,19 @@ function $LocationProvider(){ } var absHref = elm.prop('href'); - var rewrittenUrl = $location.$$rewrite(absHref); - - if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) { - event.preventDefault(); - if (rewrittenUrl != $browser.url()) { - // update location manually - $location.$$parse(rewrittenUrl); - $rootScope.$apply(); - // hack to work around FF6 bug 684208 when scenario runner clicks on links - window.angular['ff-684208-preventDefault'] = true; + // test for string to avoid SVGAnimatedString + if (absHref && angular.isString(absHref)) { + var rewrittenUrl = $location.$$rewrite(absHref); + + if (!elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) { + event.preventDefault(); + if (rewrittenUrl != $browser.url()) { + // update location manually + $location.$$parse(rewrittenUrl); + $rootScope.$apply(); + // hack to work around FF6 bug 684208 when scenario runner clicks on links + window.angular['ff-684208-preventDefault'] = true; + } } } });