angular-cn/packages/platform-server/src
Pete Bacon Darwin e511bfcab5 fix(ivy): ensure that the correct `document` is available (#33712)
Most of the use of `document` in the framework is within
the DI so they just inject the `DOCUMENT` token and are done.

Ivy is special because it does not rely upon the DI and must
get hold of the document some other way. There are a limited
number of places relevant to ivy that currently consume a global
document object.

The solution is modelled on the `LOCALE_ID` approach, which has
`getLocaleId()` and `setLocaleId()` top-level functions for ivy (see
`core/src/render3/i18n.ts`).  In the rest of Angular (i.e. using DI) the
`LOCALE_ID` token has a provider that also calls setLocaleId() to
ensure that ivy has the same value.

This commit defines `getDocument()` and `setDocument() `top-level
functions for ivy. Wherever ivy needs the global `document`, it calls
`getDocument()` instead.  Each of the platforms (e.g. Browser, Server,
WebWorker) have providers for `DOCUMENT`. In each of those providers
they also call `setDocument()` accordingly.

Fixes #33651

PR Close #33712
2019-11-11 14:01:04 -08:00
..
domino_adapter.ts refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
http.ts feat: remove @angular/http dependency from @angular/platform-server (#29408) 2019-03-27 12:38:29 -07:00
location.ts refactor: Move `dom_adapter.ts` to `@angular/common` (#32154) 2019-08-29 21:51:56 -07:00
platform-server.ts feat(platform-server): add an API to transfer state from server (#19134) 2017-09-21 13:56:13 -07:00
platform_state.ts refactor: move DOCUMENT imports from platform-browser to common (#29237) 2019-03-14 16:01:57 -04:00
private_export.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
server.ts fix(ivy): ensure that the correct `document` is available (#33712) 2019-11-11 14:01:04 -08:00
server_events.ts refactor: Move `dom_adapter.ts` to `@angular/common` (#32154) 2019-08-29 21:51:56 -07:00
server_renderer.ts refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
styles_host.ts refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
tokens.ts docs: convert all `@experimental` tags to `@publicApi` tags (#26595) 2018-10-19 14:35:52 -07:00
transfer_state.ts refactor: move DOCUMENT imports from platform-browser to common (#29237) 2019-03-14 16:01:57 -04:00
utils.ts feat(platform-server): wait on returned BEFORE_APP_SERIALIZED promises (#29120) 2019-03-06 11:01:21 -08:00
version.ts docs: update platform-server to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00