diff --git a/src/platforms/web/runtime/modules/style.ts b/src/platforms/web/runtime/modules/style.ts index ff6e14da495..43bde16ef3e 100644 --- a/src/platforms/web/runtime/modules/style.ts +++ b/src/platforms/web/runtime/modules/style.ts @@ -91,7 +91,7 @@ function updateStyle(oldVnode: VNodeWithData, vnode: VNodeWithData) { } for (name in newStyle) { cur = newStyle[name] - if (cur !== oldStyle[name]) { + if (cur !== oldStyle[name] || !el.style[name]) { // ie9 setting to null has no effect, must use empty string setProp(el, name, cur == null ? '' : cur) } diff --git a/test/unit/modules/vdom/modules/style.spec.ts b/test/unit/modules/vdom/modules/style.spec.ts index ec57ae88d6e..9f694a94019 100644 --- a/test/unit/modules/vdom/modules/style.spec.ts +++ b/test/unit/modules/vdom/modules/style.spec.ts @@ -28,6 +28,14 @@ describe('vdom style module', () => { expect(elm.style.display).toBe('block') }) + it('border related style should update correctly', () => { + const vnode1 = new VNode('p', { style: { border: '10px solid red', 'border-bottom': '10px solid blue' } }) + const vnode2 = new VNode('p', { style: { 'border-right': '10px solid red', 'border-bottom': '10px solid blue' } }) + patch(null, vnode1) + const elm = patch(vnode1, vnode2) + expect(elm.style.borderBottom).toBe('10px solid blue') + }) + it('should remove elements attrs', () => { const vnode1 = new VNode('p', { style: { fontSize: '12px' } }) const vnode2 = new VNode('p', { style: { display: 'block' } }) 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