Skip to content

Svelte 5: Actions from object properties are not properly escaped #9445

@brunnerh

Description

@brunnerh

Describe the bug

Actions can be defined on objects and just used via use:object.property, if the property is not a valid JS symbol, it has to be escaped which right now does not happen.

Reproduction

<script>
	const a = { 'set-color': (node, c) => node.style.color = c };
</script>
<span use:a.set-color={'red'}>Text</span>

v4 ✔️
v5

Compiled bit of code:

$.action(span, ($$node, $$props) => a.set-color($$node, $$props), () => 'red');

Logs

No response

System Info

REPL

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions