MCPcopy Index your code
hub / github.com/angular/angular / classKeyValueArraySet

Function classKeyValueArraySet

packages/core/src/render3/instructions/styling.ts:741–751  ·  view source on GitHub ↗
(keyValueArray: KeyValueArray<any>, key: unknown, value: any)

Source from the content-addressed store, hash-verified

739 * @param value The value to set.
740 */
741export function classKeyValueArraySet(keyValueArray: KeyValueArray<any>, key: unknown, value: any) {
742 // We use `classList.add` to eventually add the CSS classes to the DOM node. Any value passed into
743 // `add` is stringified and added to the `class` attribute, e.g. even null, undefined or numbers
744 // will be added. Stringify the key here so that our internal data structure matches the value in
745 // the DOM. The only exceptions are empty strings and strings that contain spaces for which
746 // the browser throws an error. We ignore such values, because the error is somewhat cryptic.
747 const stringKey = String(key);
748 if (stringKey !== '' && !stringKey.includes(' ')) {
749 keyValueArraySet(keyValueArray, stringKey, value);
750 }
751}
752
753/**
754 * Update map based styling.

Callers

nothing calls this directly

Calls 1

keyValueArraySetFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…