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 property setter #184

Merged
merged 2 commits into from
May 24, 2022
Merged

Conversation

slawekkolodziej
Copy link
Contributor

I noticed that with current implementation of anchor property setter doesn't really work with properties other than href. Run this code inside Partytown to see what I'm talking about:

a = document.createElement('a');
a.href = 'https://partytown.builder.io/?foo=bar'
a.search = '?x=y';
console.log(a.href);
// logs: https://partytown.builder.io/?https://partytown.builder.io/?x=y
// should be: https://partytown.builder.io/?x=y

a = document.createElement('a');
a.href = 'https://partytown.builder.io/?foo=bar'
a.host = 'foo.bar';
console.log(a.href);
// logs: https://https/?foo=bar
// should be: https://foo.bar/?foo=bar

This PR reimplements the setter.

@vercel
Copy link

vercel bot commented May 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
partytown ✅ Ready (Inspect) Visit Preview May 24, 2022 at 2:29PM (UTC)

@adamdbradley
Copy link
Contributor

Great fix, thanks!

@slawekkolodziej slawekkolodziej deleted the anchor-fixes branch May 26, 2022 21:06
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.

2 participants