Skip to content

Commit f5ef882

Browse files
committed
fix(style): always set new styles
close #12901 close #12946
1 parent d6468c4 commit f5ef882

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/platforms/web/runtime/modules/style.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@ function updateStyle(oldVnode: VNodeWithData, vnode: VNodeWithData) {
9191
}
9292
for (name in newStyle) {
9393
cur = newStyle[name]
94-
if (cur !== oldStyle[name]) {
95-
// ie9 setting to null has no effect, must use empty string
96-
setProp(el, name, cur == null ? '' : cur)
97-
}
94+
// ie9 setting to null has no effect, must use empty string
95+
setProp(el, name, cur == null ? '' : cur)
9896
}
9997
}
10098

test/unit/modules/vdom/modules/style.spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,19 @@ describe('vdom style module', () => {
3636
expect(elm.style.fontSize).toBe('')
3737
expect(elm.style.display).toBe('block')
3838
})
39+
40+
it('border related style should update correctly', () => {
41+
const vnode1 = new VNode('p', {
42+
style: { border: '10px solid red', 'border-bottom': '10px solid blue' }
43+
})
44+
const vnode2 = new VNode('p', {
45+
style: {
46+
'border-right': '10px solid red',
47+
'border-bottom': '10px solid blue'
48+
}
49+
})
50+
patch(null, vnode1)
51+
const elm = patch(vnode1, vnode2)
52+
expect(elm.style.borderBottom).toBe('10px solid blue')
53+
})
3954
})

0 commit comments

Comments
 (0)