Skip to content

Commit 9036f88

Browse files
authored
fix(hydration): handle camel-case tag name when performing match assertion (#3247)
fix #3243
1 parent 420c8f4 commit 9036f88

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

+9
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,15 @@ describe('SSR hydration', () => {
626626
expect(spy).toHaveBeenCalled()
627627
})
628628

629+
test('elements with camel-case in svg ', () => {
630+
const { vnode, container } = mountWithHydration(
631+
'<animateTransform></animateTransform>',
632+
() => h('animateTransform')
633+
)
634+
expect(vnode.el).toBe(container.firstChild)
635+
expect(`Hydration node mismatch`).not.toHaveBeenWarned()
636+
})
637+
629638
test('SVG as a mount container', () => {
630639
const svgContainer = document.createElement('svg')
631640
svgContainer.innerHTML = '<g></g>'

packages/runtime-core/src/hydration.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ export function createHydrationFunctions(
158158
if (shapeFlag & ShapeFlags.ELEMENT) {
159159
if (
160160
domType !== DOMNodeTypes.ELEMENT ||
161-
vnode.type !== (node as Element).tagName.toLowerCase()
161+
(vnode.type as string).toLowerCase() !==
162+
(node as Element).tagName.toLowerCase()
162163
) {
163164
nextNode = onMismatch()
164165
} else {

0 commit comments

Comments
 (0)