]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor(runtime-core): adjust patchProp value arguments order
authorEvan You <yyx990803@gmail.com>
Mon, 9 Mar 2020 20:15:49 +0000 (16:15 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 9 Mar 2020 20:15:49 +0000 (16:15 -0400)
BREAKING CHANGE: `RendererOptions.patchProp` arguments order has changed

  The `prevValue` and `nextValue` position has been swapped to keep it
  consistent with other functions in the renderer implementation. This
  only affects custom renderers using the `createRenderer` API.

packages/runtime-core/src/hydration.ts
packages/runtime-core/src/renderer.ts
packages/runtime-dom/src/patchProp.ts
packages/runtime-test/src/patchProp.ts

index c38ea9497467da62a36bdc3eb09a4d48f4676926..93716ebb8628325ebb10cf469634e7aee1e01aa6 100644 (file)
@@ -147,13 +147,13 @@ export function createHydrationFunctions({
         ) {
           for (const key in props) {
             if (!isReservedProp(key) && isOn(key)) {
-              patchProp(el, key, props[key], null)
+              patchProp(el, key, null, props[key])
             }
           }
         } else if (props.onClick != null) {
           // Fast path for click listeners (which is most often) to avoid
           // iterating through props.
-          patchProp(el, 'onClick', props.onClick, null)
+          patchProp(el, 'onClick', null, props.onClick)
         }
         // vnode hooks
         const { onVnodeBeforeMount, onVnodeMounted } = props
index 85efd7d32a236d01c39be5edea7f8b0cc63faa24..741beafec2d84e9a95f7513c7771f200a70734ed 100644 (file)
@@ -85,8 +85,8 @@ export interface RendererOptions<HostNode = any, HostElement = any> {
   patchProp(
     el: HostElement,
     key: string,
-    value: any,
-    oldValue: any,
+    prevValue: any,
+    nextValue: any,
     isSVG?: boolean,
     prevChildren?: VNode<HostNode, HostElement>[],
     parentComponent?: ComponentInternalInstance | null,
@@ -541,7 +541,7 @@ function baseCreateRenderer<
       if (props != null) {
         for (const key in props) {
           if (!isReservedProp(key)) {
-            hostPatchProp(el, key, props[key], null, isSVG)
+            hostPatchProp(el, key, null, props[key], isSVG)
           }
         }
         if (props.onVnodeBeforeMount != null) {
@@ -667,14 +667,14 @@ function baseCreateRenderer<
         // this flag is matched when the element has dynamic class bindings.
         if (patchFlag & PatchFlags.CLASS) {
           if (oldProps.class !== newProps.class) {
-            hostPatchProp(el, 'class', newProps.class, null, isSVG)
+            hostPatchProp(el, 'class', null, newProps.class, isSVG)
           }
         }
 
         // style
         // this flag is matched when the element has dynamic style bindings
         if (patchFlag & PatchFlags.STYLE) {
-          hostPatchProp(el, 'style', newProps.style, oldProps.style, isSVG)
+          hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG)
         }
 
         // props
@@ -694,8 +694,8 @@ function baseCreateRenderer<
               hostPatchProp(
                 el,
                 key,
-                next,
                 prev,
+                next,
                 isSVG,
                 n1.children as HostVNode[],
                 parentComponent,
@@ -814,8 +814,8 @@ function baseCreateRenderer<
           hostPatchProp(
             el,
             key,
-            next,
             prev,
+            next,
             isSVG,
             vnode.children as HostVNode[],
             parentComponent,
@@ -830,8 +830,8 @@ function baseCreateRenderer<
             hostPatchProp(
               el,
               key,
-              null,
               oldProps[key],
+              null,
               isSVG,
               vnode.children as HostVNode[],
               parentComponent,
index fa2ff3f46cea78a886af9c4059b473e16c6fd300..5799a13b1febcba04d01dbd54f0a466d1b413e52 100644 (file)
@@ -9,8 +9,8 @@ import { RendererOptions } from '@vue/runtime-core'
 export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
   el,
   key,
-  nextValue,
   prevValue,
+  nextValue,
   isSVG = false,
   prevChildren,
   parentComponent,
index 381d73b2d42afbc1eb1d59ce1805af787d43532e..9c4bfca583f7c7433c6132de18eaed75b18073a2 100644 (file)
@@ -4,8 +4,8 @@ import { isOn } from '@vue/shared'
 export function patchProp(
   el: TestElement,
   key: string,
-  nextValue: any,
-  prevValue: any
+  prevValue: any,
+  nextValue: any
 ) {
   logNodeOp({
     type: NodeOpTypes.PATCH,