]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(hydration): handle camel-case tag name when performing match assertion (#3247)
authorHcySunYang <HcySunYang@outlook.com>
Fri, 26 Mar 2021 15:59:50 +0000 (23:59 +0800)
committerGitHub <noreply@github.com>
Fri, 26 Mar 2021 15:59:50 +0000 (11:59 -0400)
fix #3243

packages/runtime-core/__tests__/hydration.spec.ts
packages/runtime-core/src/hydration.ts

index 3f9feb4ea77daa4ac3dcab98124f16cfba2849b1..a12131454a6f530d49e228d5503380f5cab9ba56 100644 (file)
@@ -626,6 +626,15 @@ describe('SSR hydration', () => {
     expect(spy).toHaveBeenCalled()
   })
 
+  test('elements with camel-case in svg ', () => {
+    const { vnode, container } = mountWithHydration(
+      '<animateTransform></animateTransform>',
+      () => h('animateTransform')
+    )
+    expect(vnode.el).toBe(container.firstChild)
+    expect(`Hydration node mismatch`).not.toHaveBeenWarned()
+  })
+
   test('SVG as a mount container', () => {
     const svgContainer = document.createElement('svg')
     svgContainer.innerHTML = '<g></g>'
index 8f30cadb2903239ed1964fd60d3ebff8abbc214d..0085ce6eea131c9dac92ecacb1c41222bcfe03c9 100644 (file)
@@ -158,7 +158,8 @@ export function createHydrationFunctions(
         if (shapeFlag & ShapeFlags.ELEMENT) {
           if (
             domType !== DOMNodeTypes.ELEMENT ||
-            vnode.type !== (node as Element).tagName.toLowerCase()
+            (vnode.type as string).toLowerCase() !==
+              (node as Element).tagName.toLowerCase()
           ) {
             nextNode = onMismatch()
           } else {