(keyValueArray: KeyValueArray<any>, key: unknown, value: any)
| 776 | * @param value The value to set. |
| 777 | */ |
| 778 | export function classKeyValueArraySet(keyValueArray: KeyValueArray<any>, key: unknown, value: any) { |
| 779 | // We use `classList.add` to eventually add the CSS classes to the DOM node. Any value passed into |
| 780 | // `add` is stringified and added to the `class` attribute, e.g. even null, undefined or numbers |
| 781 | // will be added. Stringify the key here so that our internal data structure matches the value in |
| 782 | // the DOM. The only exceptions are empty strings and strings that contain spaces for which |
| 783 | // the browser throws an error. We ignore such values, because the error is somewhat cryptic. |
| 784 | const stringKey = String(key); |
| 785 | if (stringKey !== '' && !stringKey.includes(' ')) { |
| 786 | keyValueArraySet(keyValueArray, stringKey, value); |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | /** |
| 791 | * Update map based styling. |
nothing calls this directly
no test coverage detected