@@ -7,6 +7,7 @@ type Style = string | Record<string, string | string[]> | null
7
7
8
8
export function patchStyle ( el : Element , prev : Style , next : Style ) {
9
9
const style = ( el as HTMLElement ) . style
10
+ const currentDisplay = style . display
10
11
const isCssString = isString ( next )
11
12
if ( next && ! isCssString ) {
12
13
if ( prev && ! isString ( prev ) ) {
@@ -20,7 +21,6 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
20
21
setStyle ( style , key , next [ key ] )
21
22
}
22
23
} else {
23
- const currentDisplay = style . display
24
24
if ( isCssString ) {
25
25
if ( prev !== next ) {
26
26
// #9821
@@ -33,12 +33,12 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
33
33
} else if ( prev ) {
34
34
el . removeAttribute ( 'style' )
35
35
}
36
- // indicates that the `display` of the element is controlled by `v-show`,
37
- // so we always keep the current `display` value regardless of the `style`
38
- // value, thus handing over control to `v-show`.
39
- if ( vShowOldKey in el ) {
40
- style . display = currentDisplay
41
- }
36
+ }
37
+ // indicates that the `display` of the element is controlled by `v-show`,
38
+ // so we always keep the current `display` value regardless of the `style`
39
+ // value, thus handing over control to `v-show`.
40
+ if ( vShowOldKey in el ) {
41
+ style . display = currentDisplay
42
42
}
43
43
}
44
44
0 commit comments