From: Evan You Date: Fri, 29 Nov 2019 16:53:54 +0000 (-0500) Subject: types: fix class module transition class typing X-Git-Tag: v3.0.0-alpha.0~129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52239d137c07750c3fb599c904e6865106ac42cb;p=thirdparty%2Fvuejs%2Fcore.git types: fix class module transition class typing --- diff --git a/packages/runtime-dom/src/modules/class.ts b/packages/runtime-dom/src/modules/class.ts index 34cb5d8db6..b7ab9b19d3 100644 --- a/packages/runtime-dom/src/modules/class.ts +++ b/packages/runtime-dom/src/modules/class.ts @@ -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 } }