Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
If I have an SVG element and use an xlink:href to add a link that element, then Extlink doesn't parse any further links on the page, effectively breaking Extlink's functionality anywhere after that SVG element.
As an example:
<g>
<defs>
<polygon id="SVGID_1_" points="176.6,24.1 230.7,24.1 231.4,2.5 177.3,2.5 "/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<a xlink:href="http://www.example.com/" target="_blank">
<path class="..."/>
<rect x="175" width="58px" height="25px" style="fill: transparent;"></rect>
</a>
</g>
If I simply remove the line:
<a xlink:href="http://www.example.com/" target="_blank">
Then everything works fine. I'd like to be able to use links in SVGs.
Comment | File | Size | Author |
---|---|---|---|
#4 | svg_xlink_href_breaks-2670902-4.patch | 933 bytes | geerlingguy |
|
Comments
Comment #2
geerlingguy CreditAttribution: geerlingguy as a volunteer commentedIt looks like it's this line in particular, in
extlink.js
:In the case of an xlink:href in an SVG, it throws a TypeError:
If I print
this.href
to console.log, I get:Comment #3
geerlingguy CreditAttribution: geerlingguy as a volunteer commentedAttached patch fixes the issue, at least for xlink:href links inside SVGs... I can't imagine any other link types at this point.
Comment #4
geerlingguy CreditAttribution: geerlingguy as a volunteer commentedPatch above forgot to remove the actual line that was causing all the mayhem! Here's the correct patch.
Comment #7
elachlan CreditAttribution: elachlan commentedThanks. Now in 7.x and 8.x.
Comment #8
geerlingguy CreditAttribution: geerlingguy as a volunteer commented@elachlan - Thanks!