Fix findLinkFromClickTarget for SVG elements (fixes #1510)#1518
Fix findLinkFromClickTarget for SVG elements (fixes #1510)#1518Danish-Belal wants to merge 3 commits intohotwired:mainfrom
Conversation
SVGAElement exposes href as SVGAnimatedString which does not implement
startsWith(). Use getAttribute('href') which returns a string for both
HTMLAnchorElement and SVGAElement.
Add tests for clicking SVG links (same-origin and hash-only).
Made-with: Cursor
…Target) Add getLinkHrefString() helper and use in linkToTheSamePage to prevent TypeError when hovering SVG links with hash href. Add prefetch test. Made-with: Cursor
Samuel-Labagnere
left a comment
There was a problem hiding this comment.
Great PR overall, lgtm. 👍🏻
Just added a few comments towards harmonizing your texts with how things are written elsewhere in the project.
|
Thanks for the review, @Samuel-Labagnere . I’ve addressed all your feedback:
Renamed "clicking a same-origin link inside an SVG element" → "following a same-origin SVG link" All changes are pushed. Please let me know if anything else needs adjustment. |
|
@Samuel-Labagnere Looking forward you to review and getting merge my PR. |
|
@Danish-Belal So far so good to me, now it's in the maintainers hands. |
|
@packagethief |
SVGAElement exposes href as SVGAnimatedString which does not implement startsWith(). Use getAttribute('href') which returns a string for both HTMLAnchorElement and SVGAElement.
Add tests for clicking SVG links (same-origin and hash-only).