]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: fix class module transition class typing
authorEvan You <yyx990803@gmail.com>
Fri, 29 Nov 2019 16:53:54 +0000 (11:53 -0500)
committerEvan You <yyx990803@gmail.com>
Fri, 29 Nov 2019 16:53:54 +0000 (11:53 -0500)
packages/runtime-dom/src/modules/class.ts

index 34cb5d8db61e7f3e9ade91d1b9dab8f994ea70ff..b7ab9b19d39f22697e994c7a35b772fe6659f0f9 100644 (file)
@@ -2,20 +2,17 @@ import { ElementWithTransition } from '../components/Transition'
 
 // compiler should normalize class + :class bindings on the same element
 // into a single binding ['staticClass', dynamic]
-export function patchClass(
-  el: ElementWithTransition,
-  value: string,
-  isSVG: boolean
-) {
-  // if this is an element during a transition, take the temporary transition
-  // classes into account.
-  if (el._vtc) {
-    value = [value, ...el._vtc].join(' ')
-  }
+export function patchClass(el: Element, value: string, isSVG: boolean) {
   // directly setting className should be faster than setAttribute in theory
   if (isSVG) {
     el.setAttribute('class', value)
   } else {
+    // if this is an element during a transition, take the temporary transition
+    // classes into account.
+    const transtionClasses = (el as ElementWithTransition)._vtc
+    if (transtionClasses) {
+      value = [value, ...transtionClasses].join(' ')
+    }
     el.className = value
   }
 }