File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
packages/svelte/src/compiler/phases Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1162,7 +1162,10 @@ const common_visitors = {
11621162 } ) ;
11631163
11641164 if ( is_event_attribute ( node ) ) {
1165- context . state . analysis . uses_event_attributes = true ;
1165+ const parent = context . path . at ( - 1 ) ;
1166+ if ( parent ?. type === 'RegularElement' || parent ?. type === 'SvelteElement' ) {
1167+ context . state . analysis . uses_event_attributes = true ;
1168+ }
11661169
11671170 const expression = node . value [ 0 ] . expression ;
11681171
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export interface ComponentAnalysis extends Analysis {
6262 needs_props : boolean ;
6363 /** Set to the first event directive (on:x) found on a DOM element in the code */
6464 event_directive_node : OnDirective | null ;
65- /** true if uses event attributes (onclick) */
65+ /** true if uses event attributes (onclick) on a DOM element */
6666 uses_event_attributes : boolean ;
6767 custom_element : boolean | SvelteOptions [ 'customElement' ] ;
6868 /** If `true`, should append styles through JavaScript */
You can’t perform that action at this time.
0 commit comments