@@ -77,11 +77,18 @@ const myURL =
77
77
added: v7.0.0
78
78
-->
79
79
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
-
84
80
### 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
+
85
92
#### Constructor: new URL(input[ , base] )
86
93
87
94
* ` input ` {string} The input URL to parse
@@ -116,7 +123,8 @@ const myURL = new URL('https://你好你好');
116
123
// https://xn--6qqa088eba/
117
124
```
118
125
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.
120
128
121
129
#### url.hash
122
130
@@ -1142,9 +1150,11 @@ console.log(myURL.origin);
1142
1150
[ `url.toString()` ] : #url_url_tostring
1143
1151
[ `urlSearchParams.entries()` ] : #url_urlsearchparams_entries
1144
1152
[ `urlSearchParams@@iterator()` ] : #url_urlsearchparams_iterator
1153
+ [ ICU ] : intl.html#intl_options_for_building_node_js
1145
1154
[ Punycode ] : https://tools.ietf.org/html/rfc5891#section-4.4
1146
1155
[ WHATWG URL Standard ] : https://url.spec.whatwg.org/
1147
1156
[ WHATWG URL ] : #url_the_whatwg_url_api
1148
1157
[ examples of parsed URLs ] : https://url.spec.whatwg.org/#example-url-parsing
1158
+ [ legacy urlObject ] : #url_legacy_urlobject
1149
1159
[ percent-encoded ] : #whatwg-percent-encoding
1150
1160
[ stable sorting algorithm ] : https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
0 commit comments