1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/cli/js/web
Marcos Casagrande 2fc5878668
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.
2020-04-28 01:23:06 -04:00
..
streams BREAKING: Remove Deno.symbols namespace (#4936) 2020-04-28 01:06:03 +02:00
abort_controller.ts Add support for AbortController/AbortSignal (#4757) 2020-04-15 10:10:49 -04:00
abort_signal.ts Add support for AbortController/AbortSignal (#4757) 2020-04-15 10:10:49 -04:00
base64.ts move Web APIs to cli/js/web/ 2020-03-05 18:48:55 +01:00
blob.ts Rewrite streams (#4842) 2020-04-22 10:06:51 -04:00
body.ts Rewrite streams (#4842) 2020-04-22 10:06:51 -04:00
console.ts fix(console): don't throw RangeError when an invalid date is passed (#4929) 2020-04-27 13:39:39 -04:00
console_table.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
custom_event.ts refactor: Event and EventTarget implementations (#4707) 2020-04-11 11:42:02 -04:00
decode_utf8.ts move Web APIs to cli/js/web/ 2020-03-05 18:48:55 +01:00
dom_exception.ts refactor: Event and EventTarget implementations (#4707) 2020-04-11 11:42:02 -04:00
dom_file.ts dedup various type definitions (#4741) 2020-04-14 09:23:07 -04:00
dom_iterable.ts refactor: Event and EventTarget implementations (#4707) 2020-04-11 11:42:02 -04:00
dom_types.d.ts Rewrite streams (#4842) 2020-04-22 10:06:51 -04:00
dom_util.ts dedup URLSearchParams, URL, Location, DOMStringList (#4719) 2020-04-11 17:19:36 -04:00
event.ts refactor: Event and EventTarget implementations (#4707) 2020-04-11 11:42:02 -04:00
event_target.ts refactor: Event and EventTarget implementations (#4707) 2020-04-11 11:42:02 -04:00
fetch.ts BREAKING CHANGE: rename Deno.toAsyncIterator() to Deno.iter() (#4848) 2020-04-22 21:30:45 +02:00
form_data.ts dedup various type definitions (#4741) 2020-04-14 09:23:07 -04:00
headers.ts dedup Headers types (#4736) 2020-04-13 22:46:23 -04:00
location.ts dedup URLSearchParams, URL, Location, DOMStringList (#4719) 2020-04-11 17:19:36 -04:00
performance.ts Remove doc strings from cli/js TS files (#4329) 2020-03-13 10:22:22 +01:00
promise.ts console: print promise details (#4524) 2020-03-30 19:01:19 -04:00
README.md docs: add README to cli/js/web/ (#4578) 2020-04-06 13:06:11 +02:00
request.ts Rewrite streams (#4842) 2020-04-22 10:06:51 -04:00
text_encoding.ts dedup type declarations (#4718) 2020-04-11 16:25:31 -04:00
timers.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
url.ts Change URL.port implementation to match WHATWG specifications (#4954) 2020-04-28 01:23:06 -04:00
url_search_params.ts fix(#2142) make URLSearchParams more standardized (#4695) 2020-04-23 10:30:32 -04:00
util.ts fix(console): don't throw RangeError when an invalid date is passed (#4929) 2020-04-27 13:39:39 -04:00
workers.ts feat: support Deno namespace in Worker API (#4784) 2020-04-16 23:40:29 +02:00

Deno Web APIs

This directory facilities Web APIs that are available in Deno.

Please note, that some of implementations might not be completely aligned with specification.

Some of the Web APIs are using ops under the hood, eg. console, performance.

Implemented Web APIs

  • Blob: for representing opaque binary data
  • Console: for logging purposes
  • CustomEvent, EventTarget and EventListener: to work with DOM events
    • Implementation notes: There is no DOM hierarchy in Deno, so there is no tree for Events to bubble/capture through.
  • URL and URLSearchParams: to construct and parse URLSs
  • fetch, Request, Response, Body and Headers: modern Promise-based HTTP Request API
  • FormData: access to a multipart/form-data serialization
  • Location: parsing the current script's URL
    • Implementation notes: the globalThis.location object cannot be manipulated using assign(), reload() and replace() methods. They are not implemented.
  • Performance: retrieving current time with a high precision
  • setTimeout, setInterval, clearTimeout: scheduling callbacks in future and clearInterval
  • Worker: executing additional code in a separate thread
    • Implementation notes: Blob URLs are not supported, object ownership cannot be transferred, posted data is serialized to JSON instead of structured cloning.