( tNode: TNode, attrs: TAttributes | null, writeToHost: boolean, )
| 24 | * - `true` Write to `TNode.styles` / `TNode.classes` |
| 25 | */ |
| 26 | export 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 | } |
no test coverage detected
searching dependent graphs…