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

fix($location): compatibility with SVG anchors #4098

Closed
wants to merge 1 commit into from

Conversation

chrisirhc
Copy link
Contributor

In SVGs, the href property of an anchor element is a SVGAnimatedString, so it needs to be unpacked.

Demonstration of this problem: http://jsfiddle.net/sirhc/MKQnM/

Fixes #1420 .

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

In SVGs, the href property is a SVGAnimatedString.

Note that the href property is animatable. As such, the animVal must
be used.
@chrisirhc
Copy link
Contributor Author

Signed CLA, full name is Kien Chuan Chua.

@IgorMinar
Copy link
Contributor

we need resolve animVal to absolute url, closing in favor of #5472

thanks!

@IgorMinar IgorMinar closed this Dec 19, 2013
IgorMinar pushed a commit that referenced this pull request Dec 19, 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.

Closes #5472
Closes #5198
Closes #5199
Closes #4098
Closes #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
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.

Following hyperlink in svg throws exception.
3 participants