url.port = "" sets the port number to null.#113
Conversation
|
This also affects |
url.port = '' sets the port number to null.url.port = "" sets the port number to null.
|
The example.net does not seem to match Firefox (although Chrome does set it to zero there). |
|
We could also define this as part of https://url.spec.whatwg.org/#dom-url-port or check that state override is "port state"... |
|
Probably defining it in the port setter would be clearer. |
See #2830 (comment). This can be un-reverted when the following are fixed in the spec: - whatwg/url#113 - whatwg/url#104
See web-platform-tests#2830 (comment). This can be un-reverted when the following are fixed in the spec: - whatwg/url#113 - whatwg/url#104
See web-platform-tests#2830 (comment). This can be un-reverted when the following are fixed in the spec: - whatwg/url#113 - whatwg/url#104
|
@achristensen07 @cdumez what do you think about changing the behavior of Presumably we should also change HTML if we change this here. Did you check |
|
I agree with this change. If someone wants port 0, they would set url.port to 0, not the empty string. I was planning on changing the behavior of port 0 vs. no port anyways. |
|
It seems Firefox and Safari use the default port (not 0) for |
It was previously (per spec) a no-op. This matches Firefox. (Chromium sets the port to zero.) http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4054
Setting it to the empty string should set the underlying port concept to null. See web-platform-tests/wpt#4101 for test changes and whatwg/url#113 for the change to the URL Standard.
|
Thanks for the review @zcorpan and thanks @SimonSapin for the original patch (although do note I went with a different fix). |
Setting it to the empty string should set the underlying port concept to null. See web-platform-tests/wpt#4101 for test changes and whatwg/url#113 for the change to the URL Standard.
This patch contains the following changes: url: make IPv4 parser more spec compliant * Return int64_t from ParseNumber to prevent overflow for valid big numbers * Don't throw when there are more than 4 parts (it cannot be an IP address) * Correctly interpret the address and don't always throw when there are numbers > 255 Ref: https://url.spec.whatwg.org/#concept-ipv4-parser Fixes: nodejs#10306 url: percent encode fragment to follow spec change Ref: whatwg/url#150 Ref: whatwg/url@373dbed url: fix URL#search setter The check for empty string must be done before removing the leading '?'. Ref: https://url.spec.whatwg.org/#dom-url-search url: set port to null if an empty string is given This is to follow a spec change. Ref: whatwg/url#113 url: fix parsing of paths with Windows drive letter test: update WHATWG URL test fixtures PR-URL: nodejs#10317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This patch contains the following changes: url: make IPv4 parser more spec compliant * Return int64_t from ParseNumber to prevent overflow for valid big numbers * Don't throw when there are more than 4 parts (it cannot be an IP address) * Correctly interpret the address and don't always throw when there are numbers > 255 Ref: https://url.spec.whatwg.org/#concept-ipv4-parser Fixes: #10306 url: percent encode fragment to follow spec change Ref: whatwg/url#150 Ref: whatwg/url@373dbed url: fix URL#search setter The check for empty string must be done before removing the leading '?'. Ref: https://url.spec.whatwg.org/#dom-url-search url: set port to null if an empty string is given This is to follow a spec change. Ref: whatwg/url#113 url: fix parsing of paths with Windows drive letter test: update WHATWG URL test fixtures PR-URL: #10317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This patch contains the following changes: url: make IPv4 parser more spec compliant * Return int64_t from ParseNumber to prevent overflow for valid big numbers * Don't throw when there are more than 4 parts (it cannot be an IP address) * Correctly interpret the address and don't always throw when there are numbers > 255 Ref: https://url.spec.whatwg.org/#concept-ipv4-parser Fixes: #10306 url: percent encode fragment to follow spec change Ref: whatwg/url#150 Ref: whatwg/url@373dbed url: fix URL#search setter The check for empty string must be done before removing the leading '?'. Ref: https://url.spec.whatwg.org/#dom-url-search url: set port to null if an empty string is given This is to follow a spec change. Ref: whatwg/url#113 url: fix parsing of paths with Windows drive letter test: update WHATWG URL test fixtures PR-URL: #10317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Setting it to the empty string should set the underlying port concept to null. See web-platform-tests/wpt#4101 for test changes and whatwg/url#113 for the change to the URL Standard.
It was previously (per spec) a no-op.
This matches Firefox. (Chromium sets the port to zero.)
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4054
(
url.htmlnot regenerated since the latest version of Bikeshed does various things differently, generating unrelated diff churn.)