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: improve WHATWG url constructor code example #32782

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ WHATWG URL's `origin` property includes `protocol` and `host`, but not
Parsing the URL string using the WHATWG API:

```js
const URL = require('url').URL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that URL is global, this is not strictly required. This might be improved by explaining that distinction?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it works global :)
I'm thinking out loud in this PR whether we want to promote that or not and yes to make one or the other more explicit so devs are aware.

const myURL =
new URL('https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash');
```
Expand Down