diff --git a/packages/compiler-vapor/__tests__/transforms/vOn.spec.ts b/packages/compiler-vapor/__tests__/transforms/vOn.spec.ts index 1377ab197..36455374e 100644 --- a/packages/compiler-vapor/__tests__/transforms/vOn.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/vOn.spec.ts @@ -440,26 +440,6 @@ describe('v-on', () => { expect(code).contains('fooBar') }) - test('error for vnode hooks', () => { - const onError = vi.fn() - compileWithVOn(`
`, { onError }) - expect(onError.mock.calls[0][0]).toMatchObject({ - code: ErrorCodes.X_VNODE_HOOKS, - loc: { - start: { - line: 1, - column: 11, - }, - end: { - line: 1, - column: 24, - }, - }, - }) - }) - - test.todo('vue: prefixed events') - test('should support multiple modifiers and event options w/ prefixIdentifiers: true', () => { const { code, ir, vaporHelpers } = compileWithVOn( `
`, diff --git a/packages/compiler-vapor/src/ir.ts b/packages/compiler-vapor/src/ir.ts index e72be8314..a4838f18a 100644 --- a/packages/compiler-vapor/src/ir.ts +++ b/packages/compiler-vapor/src/ir.ts @@ -220,7 +220,6 @@ export interface IRDynamicInfo { export type IRExpression = SimpleExpressionNode | string export interface IREffect { - // TODO multi-expression effect expressions: IRExpression[] operations: OperationNode[] } diff --git a/packages/compiler-vapor/src/transforms/vOn.ts b/packages/compiler-vapor/src/transforms/vOn.ts index c4017e27c..4ad6c1bc7 100644 --- a/packages/compiler-vapor/src/transforms/vOn.ts +++ b/packages/compiler-vapor/src/transforms/vOn.ts @@ -22,18 +22,7 @@ export const transformVOn: DirectiveTransform = (dir, node, context) => { } if (arg.isStatic) { - let rawName = arg.content - if (__DEV__ && rawName.startsWith('vnode')) { - context.options.onError( - createCompilerError(ErrorCodes.X_VNODE_HOOKS, arg.loc), - ) - } - - if ( - node.tagType !== ElementTypes.ELEMENT || - rawName.startsWith('vnode') || - !/[A-Z]/.test(rawName) - ) { + if (node.tagType !== ElementTypes.ELEMENT || !/[A-Z]/.test(arg.content)) { arg.content = camelize(arg.content) } } @@ -47,18 +36,9 @@ export const transformVOn: DirectiveTransform = (dir, node, context) => { ) let keyOverride: KeyOverride | undefined - - // normalize click.right and click.middle since they don't actually fire - const isStaticClick = arg.isStatic && arg.content.toLowerCase() === 'click' - if (nonKeyModifiers.includes('right')) { - if (isStaticClick) { - arg = extend({}, arg, { content: 'contextmenu' }) - } else if (!arg.isStatic) { - keyOverride = ['click', 'contextmenu'] - } - } + // normalize click.right and click.middle since they don't actually fire if (nonKeyModifiers.includes('middle')) { if (keyOverride) { // TODO error here @@ -69,6 +49,13 @@ export const transformVOn: DirectiveTransform = (dir, node, context) => { keyOverride = ['click', 'mouseup'] } } + if (nonKeyModifiers.includes('right')) { + if (isStaticClick) { + arg = extend({}, arg, { content: 'contextmenu' }) + } else if (!arg.isStatic) { + keyOverride = ['click', 'contextmenu'] + } + } const operation: SetEventIRNode = { type: IRNodeTypes.SET_EVENT,