diff --git a/packages/compiler-dom/__tests__/transforms/vOn.spec.ts b/packages/compiler-dom/__tests__/transforms/vOn.spec.ts index a61f0c1e..77b35a0d 100644 --- a/packages/compiler-dom/__tests__/transforms/vOn.spec.ts +++ b/packages/compiler-dom/__tests__/transforms/vOn.spec.ts @@ -9,7 +9,7 @@ import { Property } from '@vue/compiler-core' import { transformOn } from '../../src/transforms/vOn' -import { V_ON_MODIFIERS_GUARD, V_ON_KEYS_GUARD } from '../../src/runtimeHelpers' +import { V_ON_WITH_MODIFIERS, V_ON_WITH_KEYS } from '../../src/runtimeHelpers' import { transformElement } from '../../../compiler-core/src/transforms/transformElement' import { transformExpression } from '../../../compiler-core/src/transforms/transformExpression' import { createObjectMatcher } from '../../../compiler-core/__tests__/testUtils' @@ -38,7 +38,7 @@ describe('compiler-dom: transform v-on', () => { expect(prop).toMatchObject({ type: NodeTypes.JS_PROPERTY, value: { - callee: V_ON_MODIFIERS_GUARD, + callee: V_ON_WITH_MODIFIERS, arguments: [{ content: '_ctx.test' }, '["stop","prevent"]'] } }) @@ -53,7 +53,7 @@ describe('compiler-dom: transform v-on', () => { type: NodeTypes.JS_PROPERTY, value: createObjectMatcher({ handler: { - callee: V_ON_MODIFIERS_GUARD, + callee: V_ON_WITH_MODIFIERS, arguments: [{ content: '_ctx.test' }, '["stop"]'] }, options: createObjectMatcher({ @@ -74,10 +74,10 @@ describe('compiler-dom: transform v-on', () => { type: NodeTypes.JS_PROPERTY, value: createObjectMatcher({ handler: { - callee: V_ON_KEYS_GUARD, + callee: V_ON_WITH_KEYS, arguments: [ { - callee: V_ON_MODIFIERS_GUARD, + callee: V_ON_WITH_MODIFIERS, arguments: [{ content: '_ctx.test' }, '["stop","ctrl"]'] }, '["a"]' @@ -98,7 +98,7 @@ describe('compiler-dom: transform v-on', () => { expect(prop).toMatchObject({ type: NodeTypes.JS_PROPERTY, value: { - callee: V_ON_MODIFIERS_GUARD, + callee: V_ON_WITH_MODIFIERS, arguments: [{ content: '_ctx.test' }, '["exact"]'] } }) @@ -111,7 +111,7 @@ describe('compiler-dom: transform v-on', () => { expect(prop).toMatchObject({ type: NodeTypes.JS_PROPERTY, value: { - callee: V_ON_KEYS_GUARD, + callee: V_ON_WITH_KEYS, arguments: [{ content: '_ctx.test' }, '["enter"]'] } }) diff --git a/packages/compiler-dom/src/runtimeHelpers.ts b/packages/compiler-dom/src/runtimeHelpers.ts index 382403c0..b9740ec8 100644 --- a/packages/compiler-dom/src/runtimeHelpers.ts +++ b/packages/compiler-dom/src/runtimeHelpers.ts @@ -6,8 +6,8 @@ export const V_MODEL_TEXT = Symbol(__DEV__ ? `vModelText` : ``) export const V_MODEL_SELECT = Symbol(__DEV__ ? `vModelSelect` : ``) export const V_MODEL_DYNAMIC = Symbol(__DEV__ ? `vModelDynamic` : ``) -export const V_ON_MODIFIERS_GUARD = Symbol(__DEV__ ? `vOnModifiersGuard` : ``) -export const V_ON_KEYS_GUARD = Symbol(__DEV__ ? `vOnKeysGuard` : ``) +export const V_ON_WITH_MODIFIERS = Symbol(__DEV__ ? `vOnModifiersGuard` : ``) +export const V_ON_WITH_KEYS = Symbol(__DEV__ ? `vOnKeysGuard` : ``) registerRuntimeHelpers({ [V_MODEL_RADIO]: `vModelRadio`, @@ -15,6 +15,6 @@ registerRuntimeHelpers({ [V_MODEL_TEXT]: `vModelText`, [V_MODEL_SELECT]: `vModelSelect`, [V_MODEL_DYNAMIC]: `vModelDynamic`, - [V_ON_MODIFIERS_GUARD]: `withModifiers`, - [V_ON_KEYS_GUARD]: `withKeys` + [V_ON_WITH_MODIFIERS]: `withModifiers`, + [V_ON_WITH_KEYS]: `withKeys` }) diff --git a/packages/compiler-dom/src/transforms/vOn.ts b/packages/compiler-dom/src/transforms/vOn.ts index 7df8fdbb..53085d85 100644 --- a/packages/compiler-dom/src/transforms/vOn.ts +++ b/packages/compiler-dom/src/transforms/vOn.ts @@ -7,7 +7,7 @@ import { createSimpleExpression, NodeTypes } from '@vue/compiler-core' -import { V_ON_MODIFIERS_GUARD, V_ON_KEYS_GUARD } from '../runtimeHelpers' +import { V_ON_WITH_MODIFIERS, V_ON_WITH_KEYS } from '../runtimeHelpers' import { makeMap } from '@vue/shared' const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`) @@ -39,7 +39,7 @@ export const transformOn: DirectiveTransform = (dir, node, context) => { // built-in modifiers that are not keys const nonKeyModifiers = runtimeModifiers.filter(isNonKeyModifier) if (nonKeyModifiers.length) { - handlerExp = createCallExpression(context.helper(V_ON_MODIFIERS_GUARD), [ + handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ handlerExp, JSON.stringify(nonKeyModifiers) ]) @@ -53,7 +53,7 @@ export const transformOn: DirectiveTransform = (dir, node, context) => { !key.isStatic || isKeyboardEvent(key.content)) ) { - handlerExp = createCallExpression(context.helper(V_ON_KEYS_GUARD), [ + handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ handlerExp, JSON.stringify(keyModifiers) ])