Skip to content

Commit

Permalink
Merge pull request #1668 from martinoss/fix-ui-sref-inside-svg
Browse files Browse the repository at this point in the history
fix($StateRefDirective): resolve support for svg anchor elements #1667
  • Loading branch information
nateabele committed Jan 6, 2015
2 parents 7e38adb + 0149a7b commit b7aae02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/stateDirectives.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ function $StateRefDirective($state, $timeout) {
link: function(scope, element, attrs, uiSrefActive) {
var ref = parseStateRef(attrs.uiSref, $state.current.name);
var params = null, url = null, base = stateContext(element) || $state.$current;
var newHref = null, isAnchor = element.prop("tagName") === "A";
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
var hrefKind = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
'xlink:href' : 'href';
var newHref = null, isAnchor = element.prop("tagName").toUpperCase() === "A";
var isForm = element[0].nodeName === "FORM";
var attr = isForm ? "action" : "href", nav = true;
var attr = isForm ? "action" : hrefKind, nav = true;

var options = { relative: base, inherit: true };
var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};
Expand Down

0 comments on commit b7aae02

Please sign in to comment.