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

Lines changed: 2 additions & 4 deletions
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

Lines changed: 15 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy