Skip to content

Commit

Permalink
fix : avoid TypeError: Object #<SVGAnimatedString> has no method 'ind…
Browse files Browse the repository at this point in the history
…exOf' 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 angular#5198
  • Loading branch information
jstrachan committed Nov 29, 2013
1 parent 1a8d3c8 commit 39232c0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/ng/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
});
Expand Down

0 comments on commit 39232c0

Please sign in to comment.