-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
doc: clarify that new URL().port could be an empty string. #22232
Conversation
May want to include all of the special cases here: https://url.spec.whatwg.org/#url-miscellaneous |
@jasnell PTAL. |
3a3e5a7
to
7fd36cc
Compare
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 if lint-md passes.
@nodejs/documentation
doc/api/url.md
Outdated
@@ -303,7 +303,19 @@ to percent-encode may vary somewhat from what the [`url.parse()`][] and | |||
|
|||
* {string} | |||
|
|||
Gets and sets the port portion of the URL. | |||
Gets and sets the port portion of the URL. It can be an empty string and in | |||
that case the port depends on the protocol/scheme. Here are the |
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.
Optional nit: and in that case
-> in which case
doc/api/url.md
Outdated
Gets and sets the port portion of the URL. | ||
Gets and sets the port portion of the URL. It can be an empty string and in | ||
that case the port depends on the protocol/scheme. Here are the | ||
supported protocols: |
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.
Optional nit: Remove the Here are the supported protocols:
sentence and end the previous sentence with :
Not necessarily for this PR but might this material be better closer to this sentence:
|
7fd36cc
to
e0a8408
Compare
@Trott I've applied your nits and do a more substantial change, PTAL. |
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 with the comments addressed.
doc/api/url.md
Outdated
of the `URL` objects given `protocol` will result in the `port` value becoming | ||
the empty string (`''`). | ||
|
||
The port value can be an empty string and in which case the port depends on |
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.
-and
doc/api/url.md
Outdated
|
||
If that string is invalid but it begins with a number, the leading number is | ||
assigned to `port`. | ||
Otherwise, or if the number lies outside the range denoted above, |
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.
-Otherwise, or i
. +I
The sentence seems independent even without the Otherwise.
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.
Maybe Otherwise, or if the number
-> If the resulting number
?
doc/api/url.md
Outdated
@@ -305,6 +305,32 @@ to percent-encode may vary somewhat from what the [`url.parse()`][] and | |||
|
|||
Gets and sets the port portion of the URL. | |||
|
|||
The port value may be set as either a number or as a string containing a number |
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.
Micro-nit, non-blocking: may be set as either a number or as a string containing a number
-> may be a number or a string containing a number
Left a few more optional nits, but the text looks good to me. Not leaving an approval because I don't know anything about this behavior, although I trust that it is being described accurately. |
e0a8408
to
d5c6eb2
Compare
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
@@ -305,6 +305,31 @@ to percent-encode may vary somewhat from what the [`url.parse()`][] and | |||
|
|||
Gets and sets the port portion of the URL. | |||
|
|||
The port value may be a number or a string containing a number in the range |
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.
Nit: remove containing a number
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.
@BridgeAR I disagree, I don't think it's clear enough without that. A string cannot be in a range of numbers.
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.
Yeah, you are probably right.
Landed in 2ce0380 |
PR-URL: #22232 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com>
PR-URL: #22232 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com>
PR-URL: #22232 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: George Adams <george.adams@uk.ibm.com>
Checklist