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

Please doc unexpected behavior of the URL.host setter #37834

Open
NfNitLoop opened this issue Jan 27, 2025 · 1 comment
Open

Please doc unexpected behavior of the URL.host setter #37834

NfNitLoop opened this issue Jan 27, 2025 · 1 comment
Labels
area: URL/URLPattern Content:WebAPI Web API docs help wanted If you know something about this topic, we would love your help!

Comments

@NfNitLoop
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/URL/URL

What specific section or headline is this issue about?

The URL.host property.

What information was incorrect, unhelpful, or incomplete?

According to https://url.spec.whatwg.org/#dom-url-host,

If the given value for the host setter lacks a port, this’s URL’s port will not change. This can be unexpected as host getter does return a URL-port string so one might have assumed the setter to always "reset" both.

What did you expect to see?

I'd expect this to be documented on the host property.

This is a non-intuitive behavior, especially when setting host from a Host or X-Forwarded-Host header. Especially given that .hostname exists, which would seem to be the way to update the hostname without updating the port.

Do you have any supporting links, references, or citations?

Yep!

https://url.spec.whatwg.org/#dom-url-host

Do you have anything more you want to share?

Thanks for MDN! ❤️

I'd make the PR myself, but I started reading your CONTRIBUTING.md and it's a bit long/involved for me to take on for this small of a change, so hopefully someone who already has all of that loaded into their head can pick this up. 😊

@NfNitLoop NfNitLoop added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 27, 2025
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jan 27, 2025
@Josh-Cena Josh-Cena added help wanted If you know something about this topic, we would love your help! area: URL/URLPattern and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jan 27, 2025
@Josh-Cena
Copy link
Member

There's really nothing special about our workflow, so if you are familiar with any OSS repo it's the same PR process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: URL/URLPattern Content:WebAPI Web API docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

No branches or pull requests

2 participants