A cool thing that could be done in Rust is enumerate all valid properties for DOM elements, and front it with and html!() macro (for convenience). Would allow compile-time validation of the markup that's written, which is a level of trust that I haven't seen anywhere else yet.
-
-
Could probably extend this to CSS too. I haven't thought this through yet, but I wonder if there's something to be said for a mapping of CSS classes to Rust structs (instances). Type safety around class usage could have some fun implications. Also could help w/ critical styles.
Show this thread -
By the way, if someone wants to run with this idea and give it a shot, please do! I won't have time to try this out until at least January.
Show this thread -
(This is also very much me thinking about how to bring the convenience of Sheetify to Rust, but merge improve on it using the guarantees Rust's type system provides). I think something should possible! Probably worth learning from Diesel here too, as they've done this for SQL.
Show this thread -
Okay, yeah so this is more or less what I think this would look like syntactically when used. Everything under it would be strongly typed, and exposing methods like `.as_bytes()` for sending it over the wire.pic.twitter.com/Boh4h33hRM
Show this thread
End of conversation
New conversation -
-
-
https://dom.spec.whatwg.org/ for core DOM things, in general open the element's page on MDN and look for the spec links at the bottom
-
Well, I guess a small snag is that WebIDL tells you about JS attributes (http://element.foo = "bar"), not content attributes (<element foo=bar>). JS attributes often reflect content attributes but not always. You can probably scrape this data from MDN.
- 2 more replies
New conversation -
-
-
does this sort of .idl file help? not sure if you can distinguish content attributes from the def https://chromium.googlesource.com/chromium/blink/+/0f149a0ac2bd21e8ab8e3f6a98dde73594acdc56/Source/core/html …
-
These, on the other hand, seem to reflect the current standard, not including obsolete attributes https://html.spec.whatwg.org/multipage/
End of conversation
New conversation -
-
-
Typescript has type info for most javascript runtime interfaces, if that would be a reasonable way to translate.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.