Skip to content

Commit 92b0555

Browse files
TimothyGuaddaleax
authored andcommitted
doc: various small revisions in url
PR-URL: #14478 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 9dd9760 commit 92b0555

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

doc/api/url.md

+15-5
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,18 @@ const myURL =
7777
added: v7.0.0
7878
-->
7979

80-
*Note*: Using the `delete` keyword on `URL` objects (e.g.
81-
`delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will
82-
still return `true`.
83-
8480
### Class: URL
81+
82+
Browser-compatible `URL` class, implemented by following the WHATWG URL
83+
Standard. [Examples of parsed URLs][] may be found in the Standard itself.
84+
85+
*Note*: In accordance with browser conventions, all properties of `URL` objects
86+
are implemented as getters and setters on the class prototype, rather than as
87+
data properties on the object itself. Thus, unlike [legacy urlObject][]s, using
88+
the `delete` keyword on any properties of `URL` objects (e.g. `delete
89+
myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
90+
return `true`.
91+
8592
#### Constructor: new URL(input[, base])
8693

8794
* `input` {string} The input URL to parse
@@ -116,7 +123,8 @@ const myURL = new URL('https://你好你好');
116123
// https://xn--6qqa088eba/
117124
```
118125

119-
Additional [examples of parsed URLs][] may be found in the WHATWG URL Standard.
126+
*Note*: This feature is only available if the `node` executable was compiled
127+
with [ICU][] enabled. If not, the domain names are passed through unchanged.
120128

121129
#### url.hash
122130

@@ -1142,9 +1150,11 @@ console.log(myURL.origin);
11421150
[`url.toString()`]: #url_url_tostring
11431151
[`urlSearchParams.entries()`]: #url_urlsearchparams_entries
11441152
[`urlSearchParams@@iterator()`]: #url_urlsearchparams_iterator
1153+
[ICU]: intl.html#intl_options_for_building_node_js
11451154
[Punycode]: https://tools.ietf.org/html/rfc5891#section-4.4
11461155
[WHATWG URL Standard]: https://url.spec.whatwg.org/
11471156
[WHATWG URL]: #url_the_whatwg_url_api
11481157
[examples of parsed URLs]: https://url.spec.whatwg.org/#example-url-parsing
1158+
[legacy urlObject]: #url_legacy_urlobject
11491159
[percent-encoded]: #whatwg-percent-encoding
11501160
[stable sorting algorithm]: https://en.wikipedia.org/wiki/Sorting_algorithm#Stability

0 commit comments

Comments
 (0)