aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/location.js
diff options
context:
space:
mode:
authorCaitlin Potter2013-12-18 17:12:02 -0500
committerIgor Minar2013-12-18 17:16:39 -0800
commitbc3ff2cecd0861766a9e8606f3cc2c582d9875df (patch)
tree4155ddfca3e881c59463d763e13f4607098557f1 /src/ng/location.js
parent8f329ffb829410e1fd8f86a766929134e736e3e5 (diff)
downloadangular.js-bc3ff2cecd0861766a9e8606f3cc2c582d9875df.tar.bz2
fix($location): parse xlink:href for SVGAElements
Before this fix, the xlink:href property of an SVG <a> element could not be parsed on click, as the property is an SVGAnimatedString rather than a DOMString. This patch parses the xlink:href's animVal into a DOMString in order to prevent an `Object #<SVGAnimatedString> has no method 'indexOf'` exception from being thrown, and also to update the location if necessary as expected. Closes #5472 Closes #5198 Closes #5199 Closes #4098 Closes #1420
Diffstat (limited to 'src/ng/location.js')
-rw-r--r--src/ng/location.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ng/location.js b/src/ng/location.js
index 402db3cf..12f6c14c 100644
--- a/src/ng/location.js
+++ b/src/ng/location.js
@@ -629,6 +629,13 @@ function $LocationProvider(){
}
var absHref = elm.prop('href');
+
+ if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+ // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+ // an animation.
+ absHref = urlResolve(absHref.animVal).href;
+ }
+
var rewrittenUrl = $location.$$rewrite(absHref);
if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) {