diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-08-13 21:30:24 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-08-13 21:30:24 +0530 |
| commit | 6b34847b9d461ae0f595ca3a8f0bcbd1ab6030ab (patch) | |
| tree | 3375956e65b32fc55ab03aa0c9b9d666af77ed6d /src/index.ts | |
| parent | 6411d58b48682c65165a1e717a9bf837737887f3 (diff) | |
| download | css-everything-6b34847b9d461ae0f595ca3a8f0bcbd1ab6030ab.tar.gz css-everything-6b34847b9d461ae0f595ca3a8f0bcbd1ab6030ab.zip | |
feat: adds checkbox that doesn't work in example
Diffstat (limited to '')
| -rw-r--r-- | src/index.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index 765f676..aba1491 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,11 +91,16 @@ const getEvalActions = ( getVariable: async varName => getPropertyValue($element, varName), updateVariable: async (targetId, varName, value) => { const $el = targetId ? document.getElementById(targetId) : $element + const isCustomProp = varName.startsWith('--') if ($el) { const prevValue = getPropertyValue($el, varName) - ;($el as any).style.setProperty(varName, JSON.stringify(value)) + if (isCustomProp) { + ;($el as any).style.setProperty(varName, JSON.stringify(value)) + } else { + ;($el as any).style[varName] = value + } - if (JSON.stringify(value) !== prevValue) { + if (JSON.stringify(value) !== prevValue && isCustomProp) { const detail = { name: varName, value, prevValue } $el.dispatchEvent(new CustomEvent(CSSX_ON_UPDATE_EVENT, { detail })) } |
