Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Clicking on an svg link:
<a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/foo/bar/test">
<polygon points="...."></polygon>
</a>
gives me:
Uncaught TypeError: this.href.match is not a function
on:
else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) {
that's because the this.href is of type SVGAnimatedString instead of a link
Comments
Comment #1
hass CreditAttribution: hass commentedComment #2
ioannis.cherouvim CreditAttribution: ioannis.cherouvim commentedComment #3
ioannis.cherouvim CreditAttribution: ioannis.cherouvim commentedTo solve this you can go to line 13 and add:
var href = this.getAttribute('href')||this.getAttribute('xlink:href');
and replace all occurences of this.href with href.
Comment #4
hass CreditAttribution: hass commentedWhat happens if both do not exist?
Comment #5
ioannis.cherouvim CreditAttribution: ioannis.cherouvim commentedThe value of href will be null. My proposed change doesn't affect anything in this regard. It just allows the code to work with both html a and svg a elements.
If there are more clickable html/svg stuff with target hrefs (I don't know any other than html a and svg a) then we could add it.
Comment #6
hass CreditAttribution: hass commentedhttps://developer.mozilla.org/de/docs/Web/SVG/Attribute/xlink:href
And:
This makes this featue a won't fix. At least Firefox 51+ has this feature.