angular-docs-cn/packages/core/src
Miško Hevery 9bd9590767 refactor(ivy): change styling to use programmatic API on updates (#34804)
Previously we would write to class/style as strings `element.className` and `element.style.cssText`. Turns out that approach is good for initial render but not good for updates. Updates using this approach are problematic because we have to check to see if there was an out of bound write to style and than perform reconciliation. This also requires the browser to bring up CSS parser which is expensive.

Another problem with old approach is that we had to queue the DOM writes and flush them twice. Once on element advance instruction and once in `hostBindings`. The double flushing is expensive but it also means that a directive can observe that styles are not yet written (they are written after directive executes.)

The new approach uses `element.classList.add/remove` and `element.style.setProperty/removeProperty` API for updates only (it continues to use `element.className` and `element.style.cssText` for initial render as it is cheaper.) The other change is that the styling changes are applied immediately (no queueing). This means that it is the instruction which computes priority. In some circumstances it may result in intermediate writes which are than overwritten with new value. (This should be rare)

Overall this change deletes most of the previous code and replaces it with new simplified implement. The simplification results in code savings.

PR Close #34804
2020-01-24 12:23:19 -08:00
..
change_detection refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
compiler fix(ivy): throw a better error when DI can't inject a ctor param (#33739) 2019-12-09 11:37:10 -08:00
debug fix(ivy): ensure eventListeners added outside angular context are not called... (#34514) 2020-01-22 15:38:13 -08:00
di build: typescript 3.7 support (#33717) 2020-01-14 16:42:21 -08:00
i18n feat(common): expose getLocaleCurrencyCode publicly (#34810) 2020-01-23 13:18:53 -08:00
interface refactor(ivy): move `hostVars`/`hostAttrs` from instruction to `DirectiveDef` (#34683) 2020-01-24 12:22:10 -08:00
linker fix(core): make QueryList implement Iterable in the type system (#33536) 2019-11-19 13:43:53 -08:00
metadata docs(core): add new example for HostListener (#34228) 2019-12-09 10:38:01 -08:00
reflection perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
render refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
render3 refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
sanitization refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
testability build: update zone.js to 0.9.0 (#28219) 2019-03-26 12:50:38 -07:00
util refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
view refactor(core): remove duplicate InjectableType declaration (#34679) 2020-01-09 16:05:20 -08:00
zone feat: add a flag in bootstrap to enable coalesce event change detection to improve performance (#30533) 2019-11-05 18:58:25 +00:00
application_init.ts docs: expand doc for app_initializer token (#34760) 2020-01-14 13:32:32 -08:00
application_module.ts feat(common): allow default currency code to be configurable (#32584) 2020-01-13 09:57:06 -08:00
application_ref.ts fix(ivy): ensure that `LOCALE_ID` is set after app initializers (#34830) 2020-01-17 16:23:49 -05:00
application_tokens.ts docs: convert all `@experimental` tags to `@publicApi` tags (#26595) 2018-10-19 14:35:52 -07:00
change_detection.ts
codegen_private_exports.ts fix(ivy): align NgModule registration timing with ViewEngine (#30244) 2019-05-13 11:13:25 -07:00
console.ts
core.externs.js fix(core): remove deprecated and defunct wtf* apis (#33949) 2019-11-25 18:39:18 -05:00
core.ts feat(common): allow default currency code to be configurable (#32584) 2020-01-13 09:57:06 -08:00
core_private_export.ts feat(common): expose getLocaleCurrencyCode publicly (#34810) 2020-01-23 13:18:53 -08:00
core_render3_private_export.ts refactor(ivy): move `hostVars`/`hostAttrs` from instruction to `DirectiveDef` (#34683) 2020-01-24 12:22:10 -08:00
di.ts refactor(ivy): create Injector interface; remove dependency on Ivy (#28066) 2019-01-11 16:24:03 -08:00
error_handler.ts refactor(ivy): refactor more files in DI to prepare it for bazel packages (#28098) 2019-01-14 09:55:30 -08:00
errors.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
event_emitter.ts docs(core): mark `EventEmitter#__isAsync` as internal to hide from API docs (#31378) 2019-10-03 10:24:34 -07:00
ivy_switch.ts refactor(ivy): obviate the Bazel component of the ivy_switch (#26550) 2018-10-19 09:23:05 -07:00
linker.ts
metadata.ts docs: fix and add decorator api doc (#28986) 2019-03-04 11:47:30 -08:00
platform_core_providers.ts docs: convert all `@experimental` tags to `@publicApi` tags (#26595) 2018-10-19 14:35:52 -07:00
r3_symbols.ts refactor(ivy): generate ngFactoryDef for injectables (#32433) 2019-10-02 13:04:26 -07:00
render.ts refactor(core): remove deprecated Renderer (#33019) 2019-10-08 09:23:00 -07:00
version.ts docs: update core to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
zone.ts feat(router): warn if navigation triggered outside Angular zone (#24959) 2018-09-05 09:35:14 -07:00