Skip to content

Commit c565e9e

Browse files
committed
[TwigComponent] Fix escaping of Alpine.js attribute keys containing numeric characters
Alpine.js attribute keys like `@input.debounce.500ms` (see https://alpinejs.dev/directives/on#debounce) will now be correctly handled without being escaped.
1 parent 9d7ec20 commit c565e9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/TwigComponent/src/ComponentAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function __toString(): string
8080
// xml:*, xmlns:*,
8181
// - special syntax names (Vue.js, Svelte, Alpine.js, ...)
8282
// v-*, x-*, @*, :*
83-
if (!ctype_alpha(str_replace(['-', '_', ':', '@', '.'], '', $key))) {
83+
if (!ctype_alnum(str_replace(['-', '_', ':', '@', '.'], '', $key))) {
8484
$key = (string) $this->escaper->escape($key, 'html_attr');
8585
}
8686

0 commit comments

Comments
 (0)