MCPcopy
hub / github.com/angular/angular / writeDirectClass

Function writeDirectClass

packages/core/src/render3/dom_node_manipulation.ts:130–138  ·  view source on GitHub ↗

* Write `className` to `RElement`. * * This function does direct write without any reconciliation. Used for writing initial values, so * that static styling values do not pull in the style parser. * * @param renderer Renderer to use * @param element The element which needs to be updated. * @p

(renderer: Renderer, element: RElement, newValue: string)

Source from the content-addressed store, hash-verified

128 * @param newValue The new class list to write.
129 */
130function writeDirectClass(renderer: Renderer, element: RElement, newValue: string) {
131 ngDevMode && assertString(newValue, "'newValue' should be a string");
132 if (newValue === '') {
133 // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
134 renderer.removeAttribute(element, 'class');
135 } else {
136 renderer.setAttribute(element, 'class', newValue);
137 }
138}
139
140/** Sets up the static DOM attributes on an `RNode`. */
141export function setupStaticAttributes(renderer: Renderer, element: RElement, tNode: TNode) {

Callers 1

setupStaticAttributesFunction · 0.85

Calls 3

assertStringFunction · 0.90
removeAttributeMethod · 0.65
setAttributeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…