News for hackers. Stuff that matters.
Re:The case against self-closing tags in HTML by jraph on Thursday July 06, 2023 @10:52AM (#36616881)
Yeah, I was not at ease with this kind of stuff but I more and more like it.

I'm hesitating between using a fully XML compliant code to be able to automatically spot stupid mistakes thanks to the parser, or this. If I'm not validating the XML I don't see much point in writing these extra tags. It's just less data to transfer. Compression is a thing but still.

I do see one point: the version with the extra tags is closer to the actual representation of the document in the browser. You have to explain to newcomers that a full DOM with html, head and body elements will be rendered even if they are not present in the source code, with consequences for CSS and JavaScript to style and manipulate the document. The speech is just easier when the source matches the DOM.

For the missing tag endings, it requires quite deeper knowledge about parsing HTML to read a document. It's clear that it makes taking notes faster, but the code is perhaps less clear to someone who has not read it. Still a bit hesitant on this.

Nitpick: you might need <meta charset=utf8> before the title.

Re:The case against self-closing tags in HTML by abathur on Thursday July 06, 2023 @11:11AM (#36617227)
If an extra tool is fine, a really common trope in the world of minimal markup languages/libraries/DSLs are ways to write low-furniture html/xml and generate the delivery files.

DMark (https://denisdefreyne.github.io/d-mark/) is the only one I've used, but IIRC there are probably ~dozens of these out there (and many eschew furniture more than DMark).

Re:The case against self-closing tags in HTML by jraph on Thursday July 06, 2023 @11:32AM (#36617580)
I didn't know about DMark. I actually designed a syntax that provides a way to implement custom tags, but this is not quite easy.

While my syntax is even lighter than this, it's reasonable and DMark seems to be very easy and enjoyable to extend. And I say this as someone who doesn't know Ruby and for whom Ruby hasn't clicked (yet?). I'll definitely have to check it out, either to adopt it or to improve my own thing, ten years later.

Thanks for mentioning it, there's taste in this design. Very nice.

Re:The case against self-closing tags in HTML by abathur on Thursday July 06, 2023 @08:54PM (#36625555)
It is. I found it several years back but I finally built something on it recently and extending it was pretty simple (as someone who likewise doesn't know ruby, though I've written a little for Chef recipes).

I ended up writing a python parser for it (mainly just to get access to a different css parser), and the author also has a rust parser.

Re:The case against self-closing tags in HTML by afiori on Thursday July 06, 2023 @11:08AM (#36617184)
A good minimizer for the html could remove the optional tags
Re:The case against self-closing tags in HTML by jraph on Thursday July 06, 2023 @11:14AM (#36617276)
Yep, that would be a solution for any project which has a build pipeline (anyway).

For the better or the worse, when I deal with HTML directly, I usually just copy the HTML pages as they are on the server and have no mandatory Javascript, if at all. It's easier, and it's also "free backup on production".

Re:The case against self-closing tags in HTML by nicbou on Thursday July 06, 2023 @12:09PM (#36618179)
Are there specific ones you recommend? Currently I just use CloudFlare's, but I'd love to squeeze a few extra kb out of my static pages.
Re:The case against self-closing tags in HTML by marcosdumay on Thursday July 06, 2023 @01:36PM (#36619749)
I do think a maximizer that fills the optional tags in would be more useful.

(Yeah, that's called a pretty printer, but the symmetry is nice.)

Re:The case against self-closing tags in HTML by sebazzz on Thursday July 06, 2023 @01:38PM (#36619780)
> Yeah, I was not at ease with this kind of stuff but I more and more like it.

Found the person omitting semicolons in Javascript ;-)

Re:The case against self-closing tags in HTML by jraph on Thursday July 06, 2023 @05:33PM (#36623393)
Ah :-P Yeah, it would make sense.

I didn't like semicolon omission at first, actually I still prefer with the semicolons and I believe ASI was a mistake, but I mostly don't care.