Re:VanJS: A 0.9KB JavaScript UI framework
by recursive on Wednesday December 20, 2023 @05:10PM
(#38714298)
Jsx never achieves plain-old-html in my view. <div /> is legal but <br> isn't.
Re:VanJS: A 0.9KB JavaScript UI framework
by nicoburns on Wednesday December 20, 2023 @05:42PM
(#38714638)
<br /> is which matches xhtml (if not html5)
Re:VanJS: A 0.9KB JavaScript UI framework
by recursive on Wednesday December 20, 2023 @06:20PM
(#38714958)
Html 5 has displaced XHTML for decades. And notably, XHTML is not html. <br /> is valid html5, but the trailing slash is meaningless. In JSX, it's required.
Re:VanJS: A 0.9KB JavaScript UI framework
by jraph on Wednesday December 20, 2023 @08:12PM
(#38715923)
XHTML5 is a thing.
Re:VanJS: A 0.9KB JavaScript UI framework
by recursive on Wednesday December 20, 2023 @08:32PM
(#38716037)
This is news to me. From what I can find (which is not much), it seems like XHTML5 is a further constraint on HTML5. So legal XHTML5 is legal HTML5.
https://en.wikipedia.org/wiki/HTML5#XHTML_5_(XML-serialized_...
If that's true, that means <div /> is not valid XHTML5 because 1) trailing slashes don't close tags in html and 2) div elements require a closing tag.
And if that's true, then it's still different from JSX. But this XHTML5 thing might be surpassing my comprehension.
Re:VanJS: A 0.9KB JavaScript UI framework
by jraph on Thursday December 21, 2023 @04:13AM
(#38718471)
> So legal XHTML5 is legal HTML5.
Almost. You would need to make sure to write polyglot markup [1].
> And if that's true, then it's still different from JSX
Absolutely.
Re:VanJS: A 0.9KB JavaScript UI framework
by ping-monkey on Wednesday December 20, 2023 @05:50PM
(#38714713)
If you like JSX, good for you. But tbh it's neither necessary nor the best solution...
Re:VanJS: A 0.9KB JavaScript UI framework
by Hammershaft on Thursday December 21, 2023 @04:09AM
(#38718450)
Writing the dom cleanly with code with native data structures using clojurescript's hiccup is definitely an improvement.
JSX manages to feel just about right: it's plain-old-HTML when you want it to be, and plain-old-Javascript when you need an out.
Still... I wouldn't mind writing in a truly standard language. You're "really" writing the DOM, and HTML and DOM are this godawful bastardization of a user-interface description language. I'd be slightly less grumpy to have a good DOM-writing library, and deal with its ugliness, rather than mix-and-match the domain-specific-language in with my actual coding language.
I'd written myself a good Java version of this type of thing, and I found it kinda pleasant -- especially since it let me do HTML structure checking via the Java type checking. Typescript is -- God help me -- actually a pretty good language, and I'd be OK with actually writing my user interface structure in it, with the help of a good library.
At least then I'm writing in only one language. That saves me time to go out and learn the godawful bodge of CSS to make it look pretty.