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(js-runtime): bring URL closer to the standard #253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Have a few suggestions, let me know if you want to/can implement username/password for href
in this PR or not.
@@ -80,6 +81,48 @@ | |||
throw new Error('Not implemented'); | |||
} | |||
|
|||
get href(): string { | |||
// TODO: username and password | |||
let href = this.protocol + '//' + this.host + this.pathname + this.search + this.hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also implement username/password in this PR? We should only add the username -> password separator :
if both of them are non-empty strings. If at least the username is set, we can add a @
separator before the host.
|
||
set search(search: string) { | ||
// TODO: Probably not spec compliant, all tested engines keep the same searchParams object | ||
this.searchParams = new URLSearchParams(search); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating a new object, we can get and delete all entries and append()
the new ones by applying the same logic as in URLSearchParams
's constructor. Some libs might expect the reference to be the same, which will fail in this case.
Hi @cyco130, do you have the time to fix the above comments? If not, do not hesitate to tell me and I'll fix it :) I'm also curious to see the before/after within the web-platform-tests runner that was added a few days ago (#270) |
Hi @QuiiBz, Sorry for the radio silence :) I'll have some time this weekend and this PR is definitely on my todo. Ooh, great web-platform-tests integration is a great idea! |
Hi, I'm trying to come back to this but I get the following error when I try to run the unit tests:
Any idea how to proceed? |
Hi! Strange issue, I'm not able to reproduce it. Make sure to rebase + |
@cyco130 is attempting to deploy a commit to the Lagon Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I think my Rust setup is screwed up, that's why I keep getting weird issues :) Anyway, I tried to address the issues in your review and included tests for those cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks again!
This PR brings the
URL
class closer to the standard. In particular it adds the ability to reflect the changes to thehref
property when a part is updated: e.g. whensearchParams.set
is called.