MCPcopy Index your code
hub / github.com/angular/angular / computeStaticStyling

Function computeStaticStyling

packages/core/src/render3/styling/static_styling.ts:26–52  ·  view source on GitHub ↗
(
  tNode: TNode,
  attrs: TAttributes | null,
  writeToHost: boolean,
)

Source from the content-addressed store, hash-verified

24 * - `true` Write to `TNode.styles` / `TNode.classes`
25 */
26export function computeStaticStyling(
27 tNode: TNode,
28 attrs: TAttributes | null,
29 writeToHost: boolean,
30): void {
31 ngDevMode &&
32 assertFirstCreatePass(getTView(), 'Expecting to be called in first template pass only');
33 let styles: string | null = writeToHost ? tNode.styles : null;
34 let classes: string | null = writeToHost ? tNode.classes : null;
35 let mode: AttributeMarker | 0 = 0;
36 if (attrs !== null) {
37 for (let i = 0; i < attrs.length; i++) {
38 const value = attrs[i];
39 if (typeof value === 'number') {
40 mode = value;
41 } else if (mode == AttributeMarker.Classes) {
42 classes = concatStringsWithSpace(classes, value as string);
43 } else if (mode == AttributeMarker.Styles) {
44 const style = value as string;
45 const styleValue = attrs[++i] as string;
46 styles = concatStringsWithSpace(styles, style + ': ' + styleValue + ';');
47 }
48 }
49 }
50 writeToHost ? (tNode.styles = styles) : (tNode.stylesWithoutHost = styles);
51 writeToHost ? (tNode.classes = classes) : (tNode.classesWithoutHost = classes);
52}

Callers 3

domOnlyFirstCreatePassFunction · 0.90

Calls 3

assertFirstCreatePassFunction · 0.90
getTViewFunction · 0.90
concatStringsWithSpaceFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…