angular/packages/core/src/render3/interfaces
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
..
container.ts perf(ivy): Improve performance of transplanted views (#33702) 2019-11-14 09:27:58 -08:00
context.ts refactor(ivy): simplify differentiation of LView, RNode, LView, LContainer, StylingContext (#28947) 2019-02-26 02:01:07 +00:00
definition.ts refactor(ivy): move hostVars/hostAttrs from instruction to DirectiveDef (#34683) 2020-01-24 12:22:10 -08:00
document.ts fix(ivy): ensure that the correct document is available (#33712) 2019-11-11 14:01:04 -08:00
i18n.ts refactor(ivy): remove superfluous bind() function (#32489) 2019-09-05 18:08:27 -04:00
injector.ts refactor(ivy): correct typings in instantiateAllDirectives (#33322) 2019-10-31 22:46:49 +00:00
node.ts refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
player.ts fix(ivy): ensure falsy styling is not applied during creation mode (#26793) 2018-10-30 19:41:56 -04:00
projection.ts fix(ivy): unable to project into multiple slots with default selector (#30561) 2019-05-31 09:52:32 -07:00
query.ts perf(ivy): match query results on the TView level (#31489) 2019-07-19 20:38:08 -07:00
renderer.ts fix(ivy): ComponentFactory.create should clear host element content (#33487) 2019-11-12 21:34:06 -08:00
sanitization.ts fix(ivy): sanitization for Host Bindings (#27939) 2019-01-08 17:17:04 -08:00
styling.ts refactor(ivy): change styling to use programmatic API on updates (#34804) 2020-01-24 12:23:19 -08:00
type_checks.ts perf(ivy): guard directive-related operations with a TNode flag (#32445) 2019-09-04 11:39:57 -07:00
view.ts refactor(ivy): Switch styling to new reconcile algorithm (#34616) 2020-01-24 12:23:00 -08:00