diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts index 4dfb2eed5..0b6647b3a 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts @@ -179,6 +179,7 @@ export function convertHtmlxToJsx( node as Attribute, parent, options.preserveAttributeCase, + options.svelte5Plus, element ); break; @@ -189,7 +190,14 @@ export function convertHtmlxToJsx( handleEventHandler(str, node as BaseDirective, element); break; case 'Let': - handleLet(str, node, parent, options.preserveAttributeCase, element); + handleLet( + str, + node, + parent, + options.preserveAttributeCase, + options.svelte5Plus, + element + ); break; case 'Text': handleText(str, node as Text, parent); diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts index ff29f73ad..12f3396ee 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts @@ -55,6 +55,7 @@ export function handleAttribute( attr: Attribute, parent: BaseNode, preserveCase: boolean, + svelte5Plus: boolean, element: Element | InlineComponent ): void { if ( @@ -112,7 +113,8 @@ export function handleAttribute( if ( !preserveCase && !svgAttributes.find((x) => x == name) && - !(element instanceof Element && element.tagName.includes('-')) + !(element instanceof Element && element.tagName.includes('-')) && + !(svelte5Plus && name.startsWith('on')) ) { return name.toLowerCase(); } else { diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Let.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Let.ts index 1848f6a63..579001ea0 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Let.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Let.ts @@ -15,6 +15,7 @@ export function handleLet( node: BaseNode, parent: BaseNode, preserveCase: boolean, + svelte5Plus: boolean, element: Element | InlineComponent ): void { if (element instanceof InlineComponent) { @@ -47,6 +48,7 @@ export function handleLet( }, parent, preserveCase, + svelte5Plus, element ); }