perf(ivy): remove global state access from setUpAttributes (#32041)
PR Close #32041
This commit is contained in:
parent
4689ea2727
commit
a06043b703
|
@ -58,7 +58,7 @@ export function ɵɵelementStart(
|
|||
getOrCreateTNode(tView, lView[T_HOST], index, TNodeType.Element, name, attrs || null);
|
||||
|
||||
if (attrs != null) {
|
||||
const lastAttrIndex = setUpAttributes(native, attrs);
|
||||
const lastAttrIndex = setUpAttributes(renderer, native, attrs);
|
||||
if (tView.firstTemplatePass) {
|
||||
registerInitialStylingOnTNode(tNode, attrs, lastAttrIndex);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ export function ɵɵelementHostAttrs(attrs: TAttributes) {
|
|||
// errors...
|
||||
if (tNode.type === TNodeType.Element) {
|
||||
const native = getNativeByTNode(tNode, lView) as RElement;
|
||||
const lastAttrIndex = setUpAttributes(native, attrs);
|
||||
const lastAttrIndex = setUpAttributes(lView[RENDERER], native, attrs);
|
||||
if (tView.firstTemplatePass) {
|
||||
const stylingNeedsToBeRendered = registerInitialStylingOnTNode(tNode, attrs, lastAttrIndex);
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
*/
|
||||
import {AttributeMarker, TAttributes} from '../interfaces/node';
|
||||
import {CssSelector} from '../interfaces/projection';
|
||||
import {ProceduralRenderer3, RElement, isProceduralRenderer} from '../interfaces/renderer';
|
||||
import {RENDERER} from '../interfaces/view';
|
||||
import {getLView} from '../state';
|
||||
import {ProceduralRenderer3, RElement, Renderer3, isProceduralRenderer} from '../interfaces/renderer';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -34,13 +32,12 @@ import {getLView} from '../state';
|
|||
* Note that this instruction does not support assigning style and class values to
|
||||
* an element. See `elementStart` and `elementHostAttrs` to learn how styling values
|
||||
* are applied to an element.
|
||||
*
|
||||
* @param renderer The renderer to be used
|
||||
* @param native The element that the attributes will be assigned to
|
||||
* @param attrs The attribute array of values that will be assigned to the element
|
||||
* @returns the index value that was last accessed in the attributes array
|
||||
*/
|
||||
export function setUpAttributes(native: RElement, attrs: TAttributes): number {
|
||||
const renderer = getLView()[RENDERER];
|
||||
export function setUpAttributes(renderer: Renderer3, native: RElement, attrs: TAttributes): number {
|
||||
const isProc = isProceduralRenderer(renderer);
|
||||
|
||||
let i = 0;
|
||||
|
|
Loading…
Reference in New Issue