Live data from Hacker News

Tags to make HTML work like you expect

blog.jim-nielsen.com

11–20 of 248 posts

Re: Tags to make HTML work like you expect

#11

> s/lange/lang/ > Don’t need the “.0”. In fact, the atrocious incomplete spec of this stuff https://www.w3.org/TR/css-viewport-1/ > specifies using strtod to parse the number, which is locale dependent , so in theory on a locale that uses a different decimal separator (e.g. French), the “.0” will be ignored. I have yet to test whether misbehaves (parsing as 1 instead of 1½) with LC_NUMERIC=fr_FR.UTF-8 on any user age…

Wow. This reminds me of Google Sheets formulas, where function parameters are separated with , or ; depending on locale.

The behaviour predates Google Sheets and likely comes from Excel (whose behavior Sheets emulate/reverse engineer in many places). And I wouldn't be surprised if Excel got it from Lotus.

Re: Tags to make HTML work like you expect

#12

Note that and auto-close and don't need to be terminated. Also, wrapping the tags in an actual is optional. You also don't need the quotes as long the attribute doesn't have spaces or the like; is OK. (kind of pointless as the average website fetches a bazillion bytes of javascript for every page load nowadays, but sometimes slimming things down as much as possible can be fun and satisfying)

This kind of thing will always just feel shoddy to me. It is not much work to properly close a tag. The number of bytes saved is negligible, compared to basically any other aspect of a website. Avoiding not needed div spam already would save more. Or for example making sure CSS is not bloated. And of course avoiding downloading 3MB of JS.

What this achieves is making the syntax more irregular and harder to parse. I wish all these tolerances wouldn't exist in HTML5 and browsers simply showed an error, instead of being lenient. It would greatly simplify browser code and HTML spec.

Re: Tags to make HTML work like you expect

#13
post #7

It's 2025, the end of it. Is this really necessary to share?

Every day you can expect 10000 people learning a thing you thought everyone knew: https://xkcd.com/1053/

To quote the alt text: "Saying 'what kind of an idiot doesn't know about the Yellowstone supervolcano' is so much more boring than telling someone about the Yellowstone supervolcano for the first time."

Re: Tags to make HTML work like you expect

#14
post #5

I often reach for the HTML5 boilerplate for things like this: https://github.com/h5bp/html5-boilerplate/blob/main/dist/ind...

There is some irony in then-Facebook's proprietary metadata lines being in there (the "og:..." lines). Now with their name being "Meta", it looks even more proprietary than before. Maybe the name was never about the Metaverse at all...

Are they proprietary? How? Isn't open graph a standard and widely implemented by many parties, including many open source softwares?

Re: Tags to make HTML work like you expect

#16

> s/lange/lang/ > Don’t need the “.0”. In fact, the atrocious incomplete spec of this stuff https://www.w3.org/TR/css-viewport-1/ > specifies using strtod to parse the number, which is locale dependent , so in theory on a locale that uses a different decimal separator (e.g. French), the “.0” will be ignored. I have yet to test whether misbehaves (parsing as 1 instead of 1½) with LC_NUMERIC=fr_FR.UTF-8 on any user age…

Wow. This reminds me of Google Sheets formulas, where function parameters are separated with , or ; depending on locale.

Not to mention the functions are also translated to the other language. I think both these are the fault of Excel to be honest. I had this problem long before Google came around.

And it's really irritating when you have the computer read something out to you that contains numbers. 53.1 km reads like you expect but 53,1 km becomes "fifty-three (long pause) one kilometer".

Re: Tags to make HTML work like you expect

#17

Note that and auto-close and don't need to be terminated. Also, wrapping the tags in an actual is optional. You also don't need the quotes as long the attribute doesn't have spaces or the like; is OK. (kind of pointless as the average website fetches a bazillion bytes of javascript for every page load nowadays, but sometimes slimming things down as much as possible can be fun and satisfying)

This kind of thing will always just feel shoddy to me. It is not much work to properly close a tag. The number of bytes saved is negligible, compared to basically any other aspect of a website. Avoiding not needed div spam already would save more. Or for example making sure CSS is not bloated. And of course avoiding downloading 3MB of JS. What this achieves is making the syntax more irregular and harder to parse. I w…

You're not alone, this is called XHTML and it was tried but not enough people wanted to use it

Re: Tags to make HTML work like you expect

#18

> s/lange/lang/ > Don’t need the “.0”. In fact, the atrocious incomplete spec of this stuff https://www.w3.org/TR/css-viewport-1/ > specifies using strtod to parse the number, which is locale dependent , so in theory on a locale that uses a different decimal separator (e.g. French), the “.0” will be ignored. I have yet to test whether misbehaves (parsing as 1 instead of 1½) with LC_NUMERIC=fr_FR.UTF-8 on any user age…

Wow. This reminds me of Google Sheets formulas, where function parameters are separated with , or ; depending on locale.

Oh, good to know that it depends on locale, I always wondered about that behavior!

Re: Tags to make HTML work like you expect

#19
Anyone else prefer to use web components without bundling?

I probably should not admit this, but I have been using Lit Elements with raw JavaScript code. Because I stopped using autocomplete awhile ago.

I guess not using TypeScript at this point is basically the equivalent for many people these days of saying that I use punch cards.

Re: Tags to make HTML work like you expect

#20

Note that and auto-close and don't need to be terminated. Also, wrapping the tags in an actual is optional. You also don't need the quotes as long the attribute doesn't have spaces or the like; is OK. (kind of pointless as the average website fetches a bazillion bytes of javascript for every page load nowadays, but sometimes slimming things down as much as possible can be fun and satisfying)

This kind of thing will always just feel shoddy to me. It is not much work to properly close a tag. The number of bytes saved is negligible, compared to basically any other aspect of a website. Avoiding not needed div spam already would save more. Or for example making sure CSS is not bloated. And of course avoiding downloading 3MB of JS. What this achieves is making the syntax more irregular and harder to parse. I w…

I agree for sure, but that's a problem with the spec, not the website. If there are multiple ways of doing something you might as well do the minimal one. The parser will have always to be able to handle all the edge cases no matter what anyway.

You might want always consistently terminate all tags and such for aesthetic or human-centered (reduced cognitive load, easier scanning) reasons though, I'd accept that.

Post reply on HN