@@ -7,6 +7,7 @@ type Style = string | Record<string, string | string[]> | null
77
88export function patchStyle ( el : Element , prev : Style , next : Style ) {
99 const style = ( el as HTMLElement ) . style
10+ const currentDisplay = style . display
1011 const isCssString = isString ( next )
1112 if ( next && ! isCssString ) {
1213 if ( prev && ! isString ( prev ) ) {
@@ -20,7 +21,6 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
2021 setStyle ( style , key , next [ key ] )
2122 }
2223 } else {
23- const currentDisplay = style . display
2424 if ( isCssString ) {
2525 if ( prev !== next ) {
2626 // #9821
@@ -33,12 +33,12 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
3333 } else if ( prev ) {
3434 el . removeAttribute ( 'style' )
3535 }
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
4242 }
4343}
4444
0 commit comments