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

Svg link don't work even if there is no angular var inside #5896

Closed
altair2010 opened this issue Jan 20, 2014 · 1 comment
Closed

Svg link don't work even if there is no angular var inside #5896

altair2010 opened this issue Jan 20, 2014 · 1 comment

Comments

@altair2010
Copy link

See this jsffidle : http://jsfiddle.net/Altair2010/SLSxs/

There is only a angular var ouside the svg => angular bind it with the model value.
and a svg with 2 rect. The second one have an anchor.

The anchor don't work, but if you remove the "ng-app" attribute, it work.

@caitp
Copy link
Contributor

caitp commented Jan 20, 2014

the reason for this is because the htmlAnchorDirective checks for the href attribute, and prevents default if it's not there.

To be honest, this is a pretty trivial bug to fix, I'll write up a quick patch. Thanks for reporting this =)

caitp added a commit to caitp/angular.js that referenced this issue Jan 20, 2014
Before this change, SVG elements without an 'href' attribute (but with an xlink:href attribute)
within the application would always have their click event preventDefault, due to the href
attribute being falsy.

This change fixes this by giving an SVGAElement a separate link function which is concerned with
the xlink:href attribute.

Closes angular#5896
caitp added a commit to caitp/angular.js that referenced this issue Jan 20, 2014
Before this change, SVG elements without an 'href' attribute (but with an xlink:href attribute)
within the application would always have their click event preventDefault, due to the href
attribute being falsy.

This change fixes this by giving an SVGAElement a separate link function which is concerned with
the xlink:href attribute.

Closes angular#5896
caitp added a commit to caitp/angular.js that referenced this issue Jan 20, 2014
Before this change, SVG elements without an 'href' attribute (but with an xlink:href attribute)
within the application would always have their click event preventDefault, due to the href
attribute being falsy.

This change fixes this by giving an SVGAElement a separate link function which is concerned with
the xlink:href attribute.

Closes angular#5896
caitp added a commit to caitp/angular.js that referenced this issue Jan 22, 2014
…ref attribute

Before this change, an SVGAElement with an xlink:href attribute and no href or name attribute which
was compiled by the angular HTML compiler would never be clickable, due to the htmlAnchorDirective
calling event.preventDefault() due to the missing href attribute.

This change corrects this behaviour by also testing the xlink:href attribute if the element in
question is determined to be an SVG anchor tag (with the href property having type SVGAnimatedString)

Closes angular#5896
@caitp caitp closed this as completed in ccd4227 Jan 22, 2014
caitp added a commit that referenced this issue Jan 22, 2014
…ref attribute

Before this change, an SVGAElement with an xlink:href attribute and no href or name attribute which
was compiled by the angular HTML compiler would never be clickable, due to the htmlAnchorDirective
calling event.preventDefault() due to the missing href attribute.

This change corrects this behaviour by also testing the xlink:href attribute if the element in
question is determined to be an SVG anchor tag (with the href property having type SVGAnimatedString)

Closes #5896
Closes #5897
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants