MCPcopy Create free account
hub / github.com/angular/angular / writeDirectClass

Function writeDirectClass

packages/core/src/render3/dom_node_manipulation.ts:159–167  ·  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

157 * @param newValue The new class list to write.
158 */
159function writeDirectClass(renderer: Renderer, element: RElement, newValue: string) {
160 ngDevMode && assertString(newValue, "'newValue' should be a string");
161 if (newValue === '') {
162 // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
163 renderer.removeAttribute(element, 'class');
164 } else {
165 renderer.setAttribute(element, 'class', newValue);
166 }
167}
168
169/** Sets up the static DOM attributes on an `RNode`. */
170export 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