From 3f3e42b8cb0fec9ab21fa86281dfd9cd45c6992d Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 26 May 2019 15:38:55 +0800 Subject: [PATCH] wip: compare perf --- packages/runtime-core/src/createRenderer.ts | 4 ++-- packages/runtime-dom/src/patchProp.ts | 2 +- packages/runtime-dom/src/rendererOptions.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/runtime-core/src/createRenderer.ts b/packages/runtime-core/src/createRenderer.ts index 74ddf2b3..d700809d 100644 --- a/packages/runtime-core/src/createRenderer.ts +++ b/packages/runtime-core/src/createRenderer.ts @@ -193,7 +193,7 @@ export function createRenderer(options: RendererOptions) { if (patchFlag & CLASS) { // TODO handle full class API, potentially optimize at compilation stage? if (oldProps.class !== newProps.class) { - el.className = newProps.class + hostPatchProp(el, 'class', newProps.class, null, false) } } @@ -201,7 +201,7 @@ export function createRenderer(options: RendererOptions) { // this flag is matched when the element has dynamic style bindings // TODO separate static and dynamic styles? if (patchFlag & STYLE) { - hostPatchProp(el, 'style', oldProps.style, newProps.style, false) + hostPatchProp(el, 'style', newProps.style, oldProps.style, false) } // props diff --git a/packages/runtime-dom/src/patchProp.ts b/packages/runtime-dom/src/patchProp.ts index 98c5b5a5..56a3a2e9 100644 --- a/packages/runtime-dom/src/patchProp.ts +++ b/packages/runtime-dom/src/patchProp.ts @@ -9,8 +9,8 @@ import { VNode } from '@vue/runtime-core' export function patchProp( el: Element, key: string, - prevValue: any, nextValue: any, + prevValue: any, isSVG: boolean, prevChildren?: VNode[], unmountChildren?: any diff --git a/packages/runtime-dom/src/rendererOptions.ts b/packages/runtime-dom/src/rendererOptions.ts index e71a72ce..05757a9c 100644 --- a/packages/runtime-dom/src/rendererOptions.ts +++ b/packages/runtime-dom/src/rendererOptions.ts @@ -6,7 +6,7 @@ const svgNS = 'http://www.w3.org/2000/svg' export const DOMRendererOptions: RendererOptions = { patchProp, - insert: (parent: Node, child: Node, anchor?: Node) => { + insert: (child: Node, parent: Node, anchor?: Node) => { if (anchor != null) { parent.insertBefore(child, anchor) } else {