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

fix($location): parse xlink:href for SVGAElements #5472

Closed
wants to merge 1 commit into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Dec 18, 2013

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.

Fixes #5198, #5199, #4098, #1420

@Narretz
Copy link
Contributor

Narretz commented Dec 18, 2013

another fix is in #5199
another one in #4098
issue first reported in #1420

@caitp
Copy link
Contributor Author

caitp commented Dec 18, 2013

Thank you very much

@ghost ghost assigned IgorMinar Dec 19, 2013
anchor.href = url;
var abs = anchor.href;
anchor.href = '';
return abs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a nifty utility for this, check out urlResolve(url).href in urlUtils.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew there was something somewhere, just couldn't find it! Thanks

@IgorMinar
Copy link
Contributor

otherwise this looks good.

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.
@IgorMinar
Copy link
Contributor

@caitp thanks!

@IgorMinar IgorMinar closed this in bc3ff2c Dec 19, 2013
@IgorMinar
Copy link
Contributor

@caitp next time please list all related issues and PRs in the commit message, I amended your PR to fix this. thanks a bunch for quick turnaround

@caitp
Copy link
Contributor Author

caitp commented Dec 19, 2013

Sorry about that, I added the ones @Narretz mentioned, but didn't do a search for similar ones.

Do you know of a good tool to search for matching issues on github? I've tried using the advanced search feature, but it tends to not find everything

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
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 angular#5472
Closes angular#5198
Closes angular#5199
Closes angular#4098
Closes angular#1420
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
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 angular#5472
Closes angular#5198
Closes angular#5199
Closes angular#4098
Closes angular#1420
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

when clicking on SVG diagrams with links I get: TypeError: Object #<SVGAnimatedString> has no method 'indexOf'
3 participants