@@ -23,25 +23,29 @@ export function* generateElementProps(
23
23
const isIntrinsicElement = node . tagType === CompilerDOM . ElementTypes . ELEMENT || node . tagType === CompilerDOM . ElementTypes . TEMPLATE ;
24
24
const canCamelize = node . tagType === CompilerDOM . ElementTypes . COMPONENT ;
25
25
26
- if ( isIntrinsicElement ) {
27
- for ( const prop of props ) {
26
+
27
+ for ( const prop of props ) {
28
+ if (
29
+ prop . type === CompilerDOM . NodeTypes . DIRECTIVE
30
+ && prop . name === 'on'
31
+ ) {
28
32
if (
29
- prop . type === CompilerDOM . NodeTypes . DIRECTIVE
30
- && prop . name === 'on'
31
- && prop . arg ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
33
+ prop . arg ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
32
34
&& ! prop . arg . loc . source . startsWith ( '[' )
33
35
&& ! prop . arg . loc . source . endsWith ( ']' )
34
36
) {
35
- yield `...{ ` ;
36
- yield * generateEventArg ( ctx , prop . arg , true ) ;
37
- yield `: ` ;
38
- yield * generateEventExpression ( options , ctx , prop ) ;
39
- yield `}, ` ;
37
+ if ( isIntrinsicElement ) {
38
+ yield `...{ ` ;
39
+ yield * generateEventArg ( ctx , prop . arg , true ) ;
40
+ yield `: ` ;
41
+ yield * generateEventExpression ( options , ctx , prop ) ;
42
+ yield `}, ` ;
43
+ }
44
+ else {
45
+ yield `...{ '${ camelize ( 'on-' + prop . arg . loc . source ) } ': {} as any }, ` ;
46
+ }
40
47
}
41
- else if (
42
- prop . type === CompilerDOM . NodeTypes . DIRECTIVE
43
- && prop . name === 'on'
44
- ) {
48
+ else {
45
49
if (
46
50
prop . arg ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
47
51
&& prop . arg . loc . source . startsWith ( '[' )
@@ -55,19 +59,6 @@ export function* generateElementProps(
55
59
}
56
60
}
57
61
}
58
- else {
59
- for ( const prop of props ) {
60
- if (
61
- prop . type === CompilerDOM . NodeTypes . DIRECTIVE
62
- && prop . name === 'on'
63
- && prop . arg ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
64
- && ! prop . arg . loc . source . startsWith ( '[' )
65
- && ! prop . arg . loc . source . endsWith ( ']' )
66
- ) {
67
- yield `...{ '${ camelize ( 'on-' + prop . arg . loc . source ) } ': {} as any }, ` ;
68
- }
69
- }
70
- }
71
62
72
63
for ( const prop of props ) {
73
64
if (
0 commit comments