From 64dc7ff5c3678dedaa05b7fa1bd86344df99d148 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com> Date: Mon, 13 Sep 2021 19:30:56 +0800 Subject: [PATCH] fix(compiler-core): only merge true handlers Users can provide :onClick as event handler since vnode structure is flat. However, only /^on[^a-z]/ is accepted as event pros. This fix makes dedupeProperties consistent with the runtime. --- packages/compiler-core/src/transforms/transformElement.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index c471d2a4b84..f9c7d73571d 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -806,7 +806,7 @@ function dedupeProperties(properties: Property[]): Property[] { const name = prop.key.content const existing = knownProps.get(name) if (existing) { - if (name === 'style' || name === 'class' || name.startsWith('on')) { + if (name === 'style' || name === 'class' || isOn(name)) { mergeAsArray(existing, prop) } // unexpected duplicate, should have emitted error during parse