angular-docs-cn/packages/core/test/render3
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
..
instructions refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
ivy build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
jit fix(core): require 'static' flag on queries in typings (#30639) 2019-05-24 16:55:00 -04:00
perf refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
styling_next refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
util refactor(ivy): Delete all styling code. (Part of next SHA) (#34616) 2020-01-24 12:22:44 -08:00
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
basic_perf.ts refactor(core): rename ngFactoryDef to ɵfac (#33116) 2019-10-14 20:27:25 +00:00
change_detection_spec.ts refactor(core): rename ngFactoryDef to ɵfac (#33116) 2019-10-14 20:27:25 +00:00
common_with_def.ts fix(common): reflect input type in NgIf context (#33997) 2019-12-02 11:34:26 -08:00
component_ref_spec.ts refactor(ivy): Switch styling to new reconcile algorithm (#34616) 2020-01-24 12:23:00 -08:00
component_spec.ts refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
control_flow_spec.ts refactor(ivy): rename `tView.firstTemplatePass` to `tView.firstCreatePass` (#31270) 2019-11-04 21:39:23 +00:00
di_spec.ts refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
domino.d.ts feat(core): Moving Renderer3 into @angular/core (#20855) 2017-12-21 21:40:58 -08:00
global_utils_spec.ts refactor(ivy): remove all old styling code prior to refactor (#31193) 2019-07-23 15:45:32 -07:00
i18n_spec.ts feat(ivy): support `ng-content` in runtime i18n translations (#30782) 2019-06-05 09:04:13 -07:00
imported_renderer2.ts refactor: Move `dom_adapter.ts` to `@angular/common` (#32154) 2019-08-29 21:51:56 -07:00
instructions_spec.ts refactor(ivy): Switch styling to new reconcile algorithm (#34616) 2020-01-24 12:23:00 -08:00
integration_spec.ts refactor(ivy): delete `ɵɵallocHostVars` instruction (#34708) 2020-01-24 12:22:10 -08:00
jit_environment_spec.ts refactor(ivy): include generic type for `ModuleWithProviders` in .d.ts files (#34235) 2019-12-10 16:34:47 -08:00
lifecycle_spec.ts refactor(core): rename ngFactoryDef to ɵfac (#33116) 2019-10-14 20:27:25 +00:00
listeners_spec.ts perf(ivy): chain listener instructions (#33720) 2019-11-12 09:59:13 -08:00
load_domino.ts build: add a before-all-other bootstrap script that patches require (#34736) 2020-01-15 14:58:07 -05:00
metadata_spec.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
node_selector_matcher_spec.ts refactor(ivy): delete `ɵɵelementHostAttrs` instruction (#34717) 2020-01-24 12:22:25 -08:00
outputs_spec.ts refactor(core): rename ngFactoryDef to ɵfac (#33116) 2019-10-14 20:27:25 +00:00
perfCounter_spec.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
pipe_spec.ts refactor(core): rename ngPipeDef to ɵpipe (#33142) 2019-10-14 23:08:10 +00:00
providers_spec.ts refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
pure_function_spec.ts refactor(core): rename ngFactoryDef to ɵfac (#33116) 2019-10-14 20:27:25 +00:00
query_spec.ts perf(ivy): move local references into consts array (#33129) 2019-11-04 16:30:53 +00:00
render_util.ts fix(ivy): ComponentFactory.create should clear host element content (#33487) 2019-11-12 21:34:06 -08:00
renderer_factory_spec.ts refactor(core): rename ngFactoryDef to ɵfac (#33116) 2019-10-14 20:27:25 +00:00
testing_spec.ts refactor(core): remove withBody from public testing API (#25171) 2018-07-31 15:09:32 -07:00
view_container_ref_spec.ts perf(ivy): move local references into consts array (#33129) 2019-11-04 16:30:53 +00:00
view_utils_spec.ts fix(ivy): Run ChangeDetection on transplanted views (#33644) 2019-11-12 13:53:54 -08:00