File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -251,15 +251,15 @@ const myURL = new URL('https://example.org:81/foo');
251251console .log (myURL .hostname );
252252// Prints example.org
253253
254- // Setting an invalid hostname is ignored:
255- myURL .hostname = ' example.com:82 ' ;
254+ // Setting the hostname does not change the port
255+ myURL .hostname = ' example.com' ;
256256console .log (myURL .href );
257- // Prints https://example.org :81/foo
257+ // Prints https://example.com :81/foo
258258
259259// Use myURL.host to change the hostname and port
260- myURL .host = ' example.com :82' ;
260+ myURL .host = ' example.org :82' ;
261261console .log (myURL .href );
262- // Prints https://example.com :82/foo
262+ // Prints https://example.org :82/foo
263263```
264264
265265Invalid host name values assigned to the ` hostname ` property are ignored.
You can’t perform that action at this time.
0 commit comments