(lView: LView, tNode: TNode, attrName: string, value: any)
| 365 | } |
| 366 | |
| 367 | function setNgReflectProperty(lView: LView, tNode: TNode, attrName: string, value: any) { |
| 368 | const environment = lView[ENVIRONMENT]; |
| 369 | if (!environment.ngReflect) { |
| 370 | return; |
| 371 | } |
| 372 | const element = getNativeByTNode(tNode, lView) as RElement | RComment; |
| 373 | const renderer = lView[RENDERER]; |
| 374 | attrName = normalizeDebugBindingName(attrName); |
| 375 | const debugValue = normalizeDebugBindingValue(value); |
| 376 | if (tNode.type & TNodeType.AnyRNode) { |
| 377 | if (value == null) { |
| 378 | renderer.removeAttribute(element as RElement, attrName); |
| 379 | } else { |
| 380 | renderer.setAttribute(element as RElement, attrName, debugValue); |
| 381 | } |
| 382 | } else { |
| 383 | const textContent = escapeCommentText( |
| 384 | `bindings=${JSON.stringify({[attrName]: debugValue}, null, 2)}`, |
| 385 | ); |
| 386 | renderer.setValue(element as RComment, textContent); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | export function setNgReflectProperties( |
| 391 | lView: LView, |
no test coverage detected