perf(ivy): apply [style]/[class] bindings directly to style/className (#33336)
This patch ensures that the `[style]` and `[class]` based bindings are directly applied to an element's style and className attributes. This patch optimizes the algorithm so that it... - Doesn't construct an update an instance of `StylingMapArray` for `[style]` and `[class]` bindings - Doesn't apply `[style]` and `[class]` based entries using `classList` and `style` (direct attributes are used instead) - Doesn't split or iterate over all string-based tokens in a string value obtained from a `[class]` binding. This patch speeds up the following cases: - `<div [class]>` and `<div class="..." [class]>` - `<div [style]>` and `<div style="..." [style]>` The overall speec increase is by over 5x. PR Close #33336
This commit is contained in:

committed by
Andrew Kushnir

parent
ee4fc12e42
commit
dcdb433b7d
@ -326,7 +326,10 @@ export class StylingBuilder {
|
||||
valueConverter: ValueConverter, isClassBased: boolean,
|
||||
stylingInput: BoundStylingEntry): StylingInstruction {
|
||||
// each styling binding value is stored in the LView
|
||||
let totalBindingSlotsRequired = 1;
|
||||
// map-based bindings allocate two slots: one for the
|
||||
// previous binding value and another for the previous
|
||||
// className or style attribute value.
|
||||
let totalBindingSlotsRequired = 2;
|
||||
|
||||
// these values must be outside of the update block so that they can
|
||||
// be evaluated (the AST visit call) during creation time so that any
|
||||
|
Reference in New Issue
Block a user