by reactordev · 1y ago · 0 comments
WASM should be left to things like IPC/Canvas/WebGPU stuff, not things easily done with document.querySelector
No offense, but this is using a bomb to kill a fly.
I know it says this is just a demo but people will find this and do this thinking it’s normal.
Not great, not terrible.
https://html.spec.whatwg.org/#email-state-(type=email)
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
But it is true that you can implement it with a FSM(which is what firefox does). Webkit uses a regex as well I think.What kind of validation are you going to do without a regular expression?
> I’m using form validation as a placeholder. It shows all the crucial aspects to use WASM instead of JS, like wiring up DOM events to Rust functions, and then reacting to those events.
https://developer.mozilla.org/en-US/docs/Learn_web_developme...
Of course there's always the argument that you'd add more javascript to "framework-ize" this a bit more, but the rust code is just targeting the DOM with IDs, so I don't think it's fair to compare it to any "framework-y" solution.