@@ -65,12 +65,24 @@ function validate_element(node, context) {
65
65
error ( attribute , 'invalid-attribute-name' , attribute . name ) ;
66
66
}
67
67
68
- if ( attribute . name === 'is' && context . state . options . namespace !== 'foreign' ) {
69
- warn ( context . state . analysis . warnings , attribute , context . path , 'avoid-is' ) ;
70
- } else if ( attribute . name === 'slot' ) {
68
+ if ( attribute . name . startsWith ( 'on' ) && attribute . name . length > 2 ) {
69
+ if (
70
+ attribute . value === true ||
71
+ is_text_attribute ( attribute ) ||
72
+ attribute . value . length > 1
73
+ ) {
74
+ error ( attribute , 'invalid-event-attribute-value' ) ;
75
+ }
76
+ }
77
+
78
+ if ( attribute . name === 'slot' ) {
71
79
/** @type {import('#compiler').RegularElement | import('#compiler').SvelteElement | import('#compiler').Component | import('#compiler').SvelteComponent | import('#compiler').SvelteSelf | undefined } */
72
80
validate_slot_attribute ( context , attribute ) ;
73
81
}
82
+
83
+ if ( attribute . name === 'is' && context . state . options . namespace !== 'foreign' ) {
84
+ warn ( context . state . analysis . warnings , attribute , context . path , 'avoid-is' ) ;
85
+ }
74
86
} else if ( attribute . type === 'AnimateDirective' ) {
75
87
const parent = context . path . at ( - 2 ) ;
76
88
if ( parent ?. type !== 'EachBlock' ) {
@@ -316,13 +328,6 @@ function is_tag_valid_with_parent(tag, parent_tag) {
316
328
* @type {import('zimmerframe').Visitors<import('#compiler').SvelteNode, import('./types.js').AnalysisState> }
317
329
*/
318
330
export const validation = {
319
- Attribute ( node ) {
320
- if ( node . name . startsWith ( 'on' ) && node . name . length > 2 ) {
321
- if ( node . value === true || is_text_attribute ( node ) || node . value . length > 1 ) {
322
- error ( node , 'invalid-event-attribute-value' ) ;
323
- }
324
- }
325
- } ,
326
331
BindDirective ( node , context ) {
327
332
validate_no_const_assignment ( node , node . expression , context . state . scope , true ) ;
328
333
0 commit comments