angular-cn/tools/public_api_guard
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
..
animations docs: update animations to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
common fix(common): remove deprecated support for intl API (#29250) 2019-10-17 20:44:17 -04:00
core feat: add a flag in bootstrap to enable coalesce event change detection to improve performance (#30533) 2019-11-05 18:58:25 +00:00
elements docs: update elements to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
forms refactor(forms): remove ngForm element selector (#33058) 2019-10-11 15:43:56 -07:00
http docs(http): move examples to `@usageNotes` (#26039) 2018-09-24 09:11:02 -07:00
localize fix(ivy): i18n - use `MessageId` for matching translations (#32594) 2019-09-17 09:17:44 -07:00
platform-browser feat(ivy): make Hammer support tree-shakable (#32203) 2019-08-21 11:43:51 -07:00
platform-browser-dynamic docs: update platform-browser-dynamic to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
platform-server docs: update platform-server to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
platform-webworker fix(ivy): ensure that the correct `document` is available (#33712) 2019-11-11 14:01:04 -08:00
platform-webworker-dynamic feat(platform-webworker): deprecate platform-webworker (#30642) 2019-05-23 15:09:48 -07:00
router docs(router): make `InitialNavigation` part of the public API (#32707) 2019-09-27 14:21:13 -07:00
service-worker feat(service-worker): remove deprecated `versionedFiles` option (#32862) 2019-10-02 09:30:59 -07:00
upgrade feat(upgrade): provide unit test helpers for wiring up injectors (#16848) 2019-06-20 17:04:01 -07:00
BUILD.bazel refactor(upgrade): use Bazel packages to avoid symlinks in the source (#29466) 2019-04-02 10:38:01 -07:00
global_utils.d.ts feat(ivy): expose `window.ng.getDebugNode` helper (#32727) 2019-09-17 15:46:07 -07:00
public_api_guard.bzl build(ivy): remove the remains of ivy-jit mode (#27278) 2018-11-27 10:30:58 -08:00