Skip to content

Commit

Permalink
ignore case on event attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocean-OS committed Dec 10, 2024
1 parent 8bee23e commit c1e66fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as b from '../../../../../utils/builders.js';
export function visit_event_attribute(node, context) {
let capture = false;

let event_name = node.name.slice(2);
let event_name = node.name.slice(2).toLowerCase();
if (is_capture_event(event_name)) {
event_name = event_name.slice(0, -7);
capture = true;
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/utils/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function get_attribute_chunks(value) {
* @returns {attribute is AST.Attribute & { value: [AST.ExpressionTag] | AST.ExpressionTag }}
*/
export function is_event_attribute(attribute) {
return is_expression_attribute(attribute) && attribute.name.startsWith('on');
return is_expression_attribute(attribute) && attribute.name.toLowerCase().startsWith('on');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const DELEGATED_EVENTS = [
* @param {string} event_name
*/
export function is_delegated(event_name) {
return DELEGATED_EVENTS.includes(event_name);
return DELEGATED_EVENTS.includes(event_name.toLowerCase());
}

/**
Expand Down

0 comments on commit c1e66fa

Please sign in to comment.