- From: Mohamed Akram <notifications@github.com>
- Date: Wed, 05 Mar 2025 01:19:24 -0800
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 5 March 2025 09:19:28 UTC
mohd-akram left a comment (whatwg/url#354) > The problem is you can't build a URL step-by-step. Each part affects the whole. It's not really a sensible operation in the URL data model. > > I suggest people just use the following: > > Object.assign(new URL("https://example.com/"), { ... pieces go here ... }); This does not validate the port: ```javascript Object.assign(new URL("https://example.com/"), { port: 'bad' }); /* URL { href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', searchParams: URLSearchParams {}, hash: '' } */ ``` The port is silently ignored. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/url/issues/354#issuecomment-2700325738 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/url/issues/354/2700325738@github.com>
Received on Wednesday, 5 March 2025 09:19:28 UTC