Live data from Hacker News

Do you know that there is an HTML tables API?

christianheilmann.com

61–70 of 206 posts

Re: Do you know that there is an HTML tables API?

#62
post #28

Earlier quoted context omitted.

A bike-shedding thread on top as usual.

Yeah I see this a lot on HN. I think people feel the need to make precise and accurate statements about things. I think a lot of them, if they'd deep breath and waited 30 minutes, they wouldn't comment.

The internet is filled with pedantics, creeps and dogs posing as cats. The whole "take a breath" thing was early abandoned in favor of the now traditional "reply until the other party gives up" approach, which requires you to really dig into their messages and point out spelling mistakes, fallacies, and for programmers, variable names.

Re: Do you know that there is an HTML tables API?

#63
post #42

Earlier quoted context omitted.

Yep, didn’t realize this was unknown by enough web developers to warrant an article.

I see new frontend developers using for building buttons, and I've even seen people using for doing titles! Us greybeards don't know how much apparent knowledge we're sitting on, it seems.

[deleted]

Re: Do you know that there is an HTML tables API?

#64
post #50
post #34

Abandoned? When? I still use this pretty much everywhere to create HTML tables. Do people use something else now?

Yes, React

And what does that use internally to manage tables? Just because there is layer between you and the API, it doesn't mean API is abandoned.

Re: Do you know that there is an HTML tables API?

#65
post #50
post #34

Abandoned? When? I still use this pretty much everywhere to create HTML tables. Do people use something else now?

Yes, React

Why would it matter what library you use? I'm using React, I do whenever I need to display tabular data, React or no React as no impact on when I'd use .

Re: Do you know that there is an HTML tables API?

#66
post #15

Interesting, but the JavaScript examples hurt: let table = [ ['one','two','three'], ['four','five','six'] ]; let b = document.body; let t = document.createElement('table'); b.appendChild(t); table.forEach((row,ri) => { let r = t.insertRow(ri); row.forEach((l,i) => { let c = r.insertCell(i); c.innerText = l; }) }); Use full words for variable names!

I think the short names aren't anywhere near as bad for readability as using (ri,i) as a table index.

If you're going to use short names at least make it clear which belong together. Especially don't use different lengths when things ought to be similar.

    data.forEach((row,i) => row.forEach((ele,j) => ... ))

Re: Do you know that there is an HTML tables API?

#68
post #56

Earlier quoted context omitted.

The worst thing on the modern web is people using divs for table data. What do you mean this table isn’t sortable? M365 Admin is the worst offender I’ve come across on this. Just terrible table implementations on almost every page.

Is there a term for the opposite of cargo culting? Where everyone avoids something, but no one remembers why? Because that’s basically where HTML tables have ended up.

I think this is something like a "delayed cargo culting", or "cargo culting based on outdated facts". I think it's basically the same as the hypothesis from the "Monkey Ladder Experiment", where monkeys got punished when trying to get a banana, and eventually all the monkeys were replaced with monkeys that didn't realize why the banana was off-limits, yet persisted in trying to "help" other monkeys trying to prevent them from getting the banana.

I'm not sure if I read that that specific experiment was debunked or not, but it certainly sounds familiar to how some developer trends get propagated even though the ground truth as changed.

Re: Do you know that there is an HTML tables API?

#69
> Without having to re-render the whole table on each change.

That's nice, but isn't that what the standard DOM methods are already doing? Or does that API have any additional abilities?

Nevertheless, that's really cool and potentially saves a lot of tedious and error-prone DOM navigation.

Re: Do you know that there is an HTML tables API?

#70
post #36
post #32

Earlier quoted context omitted.

Same. I use this all the time, have for decades. Had no idea other people didn’t.

Just a catchy title. Not abandoned etc. This is the only API available to manipulate HTML table tags.

appendChild, replaceChildren, etc work fine with tables?
Post reply on HN