Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] anchor tag inside svg #2286

Merged
merged 8 commits into from
Sep 6, 2021
Merged

Conversation

ptizzy
Copy link
Contributor

@ptizzy ptizzy commented Aug 25, 2021

With anchor tags inside SVG elements, the href attribute is an object. The href value is at a.href.baseVal. However, this value differs from a normal anchor tag, in that it is not the full resolved path, so in order to pass it to a URL constructor, you have to include a base URL. This change handles SVG anchor tags correctly, including prefetch, and in the click event handler function.

Fixes #2256

@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2021

🦋 Changeset detected

Latest commit: e1f23b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the formatting issues Ben pointed out, code lgtm.

@ignatiusmb
Copy link
Member

It would be nice if these had some accompanying tests

@bluwy
Copy link
Member

bluwy commented Aug 25, 2021

Looks like spaces and tabs are being mixed too. we'll need to normalize/format them as well

@ptizzy
Copy link
Contributor Author

ptizzy commented Aug 25, 2021

I can clean up the formatting easily enough. I'll need some guidance regarding tests, though. I'm not sure where to begin with that.

@ignatiusmb
Copy link
Member

You can try and take a look at the examples in test/apps/basics/src/routes/routing/_tests.js, there isn't a lot of prefetch tests so some addition to make sure this behavior keeps working properly in later PRs would be nice

@benmccann benmccann changed the title Fixed anchor tag inside svg issue [fix] anchor tag inside svg Aug 26, 2021
@benmccann benmccann merged commit b4eacd6 into sveltejs:master Sep 6, 2021
@github-actions github-actions bot mentioned this pull request Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Anchor hrefs inside SVG elements not getting handled properly by router
5 participants