Skip to content

Commit 59a6eb5

Browse files
committed
fix: do not handle false + move into lower branch
1 parent 4f2deb3 commit 59a6eb5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/runtime-dom/__tests__/patchStyle.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ describe(`runtime-dom: style patching`, () => {
3939
const el = document.createElement('div')
4040
patchProp(el, 'style', null, {
4141
color: undefined,
42-
'--color': false,
4342
borderRadius: null
4443
})
4544
expect(el.style.cssText.replace(/\s/g, '')).toBe('')
45+
4646
patchProp(
4747
el,
4848
'style',
4949
{ color: 'red' },
50-
{ color: undefined, '--color': false, borderRadius: false }
50+
{ color: null, borderRadius: undefined }
5151
)
5252
expect(el.style.cssText.replace(/\s/g, '')).toBe('')
5353
})

packages/runtime-dom/src/modules/style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ function setStyle(
4242
name: string,
4343
val: string | string[]
4444
) {
45-
val = val == null || (val as any) === false ? '' : val
4645
if (isArray(val)) {
4746
val.forEach(v => setStyle(style, name, v))
4847
} else {
48+
if (val == null) val = ''
4949
if (name.startsWith('--')) {
5050
// custom property definition
5151
style.setProperty(name, val)

0 commit comments

Comments
 (0)