Open ottomated opened 1 month ago
Related #5903
It allows something like this. Maybe a naming convention which makes sense (not this obviously) is using this "feature" somewhere. I think
<Component "=;123"={"foo"} />
should work though if this is going to be allowed.
But you can easily pass a prop with any name using spreading:
let props = { "=;123": 42 };
<Component {...props} />
I think
<Component "=;123"={"foo"} />
should work though if this is going to be allowed.
It will break the "compatibility" with HTML, and no one uses such names because they only cause headaches in other places. Those who do need it can still use prop spreading, prop aliasing, rest props, etc.
I think it's fine to allow some special characters here, but definitely not =
. <Component ;123="foo" />
surprisingly does compile.
The HTML standard disallows space, "
, '
, >
, /
, =
, and obviously noncharacters. Anything other can be used in the attribute name.
In addition, given that spreading works with anything, I don't think anything should be done here.
Describe the bug
This is syntactically valid:
but obviously, this is not:
Svelte should throw an error on invalid prop names here.
Reproduction
REPL
Logs
No response
System Info
Severity
annoyance