( lView: LView, createOpCodes: I18nCreateOpCodes, parentRNode: RElement | null, insertInFrontOf: RElement | null, )
| 202 | * @param insertInFrontOf DOM node that should be used as an anchor. |
| 203 | */ |
| 204 | export function applyCreateOpCodes( |
| 205 | lView: LView, |
| 206 | createOpCodes: I18nCreateOpCodes, |
| 207 | parentRNode: RElement | null, |
| 208 | insertInFrontOf: RElement | null, |
| 209 | ): void { |
| 210 | const renderer = lView[RENDERER]; |
| 211 | for (let i = 0; i < createOpCodes.length; i++) { |
| 212 | const opCode = createOpCodes[i++] as any; |
| 213 | const text = createOpCodes[i] as string; |
| 214 | const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT; |
| 215 | const appendNow = |
| 216 | (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY; |
| 217 | const index = opCode >>> I18nCreateOpCode.SHIFT; |
| 218 | let rNode = lView[index]; |
| 219 | let lastNodeWasCreated = false; |
| 220 | if (rNode === null) { |
| 221 | // We only create new DOM nodes if they don't already exist: If ICU switches case back to a |
| 222 | // case which was already instantiated, no need to create new DOM nodes. |
| 223 | rNode = lView[index] = _locateOrCreateNode( |
| 224 | lView, |
| 225 | index, |
| 226 | text, |
| 227 | isComment ? Node.COMMENT_NODE : Node.TEXT_NODE, |
| 228 | ); |
| 229 | lastNodeWasCreated = wasLastNodeCreated(); |
| 230 | } |
| 231 | if (appendNow && parentRNode !== null && lastNodeWasCreated) { |
| 232 | nativeInsertBefore(renderer, parentRNode, rNode, insertInFrontOf, false); |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Apply `I18nMutateOpCodes` OpCodes. |
no test coverage detected
searching dependent graphs…