summaryrefslogtreecommitdiff
path: root/cli/js/lib.deno.ns.d.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-04-28 07:23:06 +0200
committerGitHub <noreply@github.com>2020-04-28 01:23:06 -0400
commit2fc5878668d8f08ec6989d07e79125d640a73d43 (patch)
tree6c4d617e8b0431ab7258de15cafba2bc5e14f547 /cli/js/lib.deno.ns.d.ts
parent15099cc0160a6f1bc5f569c44018da6f5a186138 (diff)
Change URL.port implementation to match WHATWG specifications (#4954)
Changed `URL.port` implementation to match [WHATWG specifications](https://url.spec.whatwg.org/#port-state). This PR matches the behaviour of other browsers: 1. a `TypeError` must be thrown when passing an URL with an invalid port to the constructor. 2. When setting an invalid port, using property setter, I haven't found what should happen in this case, so I mimic **Firefox** & **Node** behaviour. If an invalid port is set, it will use the previous value. **Chrome** sets the value to `'0'` if an invalid port is set. I prefer to keep the previous valid value. (I can use Chrome's behaviour if you think it's better, it's a simple value change) ``` url.port = '3000'; // valid url.port = 'deno'; // invalid assertEquals(url.port, '3000'); ``` 3. If the port value equals the current protocol default port value, `port` will be an empty string.
Diffstat (limited to 'cli/js/lib.deno.ns.d.ts')
0 files changed, 0 insertions, 0 deletions