The on:submit|preventDefault syntax is optional. We could use the regular event.preventDefault(); call in the handleSubmit() function to keep the HTML cleaner.
In case of the htmlFor, thanks for pointing that out. I copied the initial source code from the React website to make sure I don't miss any feature in the Svelte version. I've updated the blog post and the interactive demo to use for.
Really?
on:submit|preventDefault
Is this a new incredibly ugly way to define inline JS? Is that a...pipe in there?
htmlFor
Never seen that HTML attr before 🤔
More accurate critic would be: svelte is not html at all.
Rich Harris introduce this language as htmlx github.com/htmlx-org/HTMLx.
If it has different parser from html, it is a different language.
Hi Avon,
Thanks for your feedback.
The
on:submit|preventDefault
syntax is optional. We could use the regularevent.preventDefault();
call in thehandleSubmit()
function to keep the HTML cleaner.In case of the
htmlFor
, thanks for pointing that out. I copied the initial source code from the React website to make sure I don't miss any feature in the Svelte version. I've updated the blog post and the interactive demo to usefor
.Good to know; appreciate you clarifying!