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

doc: clarify that new URL().port could be an empty string. #22232

Closed
wants to merge 1 commit into from

Conversation

mcollina
Copy link
Member

Checklist

@mcollina mcollina requested a review from jasnell August 10, 2018 13:56
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. url Issues and PRs related to the legacy built-in url module. labels Aug 10, 2018
@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 10, 2018
@jasnell
Copy link
Member

jasnell commented Aug 10, 2018

May want to include all of the special cases here: https://url.spec.whatwg.org/#url-miscellaneous

@mcollina
Copy link
Member Author

@jasnell PTAL.

Copy link
Member

@Trott Trott left a 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
Copy link
Member

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:
Copy link
Member

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 :

@Trott
Copy link
Member

Trott commented Aug 10, 2018

Not necessarily for this PR but might this material be better closer to this sentence:

Setting the value to the default port of the URL objects given protocol will result in the port value becoming the empty string ('').

@mcollina
Copy link
Member Author

@Trott I've applied your nits and do a more substantial change, PTAL.

CI: https://ci.nodejs.org/job/node-test-pull-request/16416/

Copy link
Member

@BridgeAR BridgeAR left a 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
Copy link
Member

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,
Copy link
Member

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.

Copy link
Member

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
Copy link
Member

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

@Trott
Copy link
Member

Trott commented Aug 13, 2018

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.

@mcollina
Copy link
Member Author

Copy link
Member

@BridgeAR BridgeAR left a 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
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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.

@maclover7 maclover7 removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 15, 2018
@mcollina
Copy link
Member Author

Landed in 2ce0380

@mcollina mcollina closed this Aug 17, 2018
@mcollina mcollina deleted the url-doc-change branch August 17, 2018 11:01
mcollina added a commit that referenced this pull request Aug 17, 2018
PR-URL: #22232
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: George Adams <[email protected]>
targos pushed a commit that referenced this pull request Aug 19, 2018
PR-URL: #22232
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: George Adams <[email protected]>
targos pushed a commit that referenced this pull request Sep 3, 2018
PR-URL: #22232
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: George Adams <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. url Issues and PRs related to the legacy built-in url module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants