angular-cn/packages/platform-server
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
..
src fix(ivy): ensure that the correct `document` is available (#33712) 2019-11-11 14:01:04 -08:00
test feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
testing build: remove unreferenced tsconfig-build.json files (#30858) 2019-06-05 09:03:36 -07:00
BUILD.bazel build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
PACKAGE.md docs: add platform to glossary (#30731) 2019-06-12 11:46:25 -07:00
index.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
package.json feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
public_api.ts build: refactor ambient node & jasmine types so they are only included where needed (#25491) 2018-08-16 13:46:43 -07:00