Live data from Hacker News

Do you know that there is an HTML tables API?

christianheilmann.com

141–150 of 206 posts

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

#141

Earlier quoted context omitted.

InsertRow updates the live DOM and React just wholesale replaces it. It’s a masterstroke footgun.

Yes, your point? Anyone who spend 15 minutes learning about React learns that you don't manipulate the DOM directly, you let the rendering engine handle that for you.

Yes that’s why of instead of learning the standard apis, you have to spend 15 months learning how to debug useEffect

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

#142
post #99
post #96

Earlier quoted context omitted.

I figured that was the normal way to interact with tables, what would people do otherwise?

Using the standard DOM APIs or - if they don't care about anything - innerHTML, I suppose.

Sorry I - also - am one of those old timers who don't understand this because the shown code is all I've ever used for creating table. So, what is this "standard DOM API" if I may ask? Could you post a code example?

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

#143

Phew, this post single handedly made me feel old this morning. I started dabbling with the web just over 20 years ago but have mainly been working on the backend the past 10-15 years. I had no clue that nowadays programmers don’t know about this, so I assume it’s supplanted by modern frameworks or modern JS/CSS

I’ve been building sites since around 2000 and I’ve used HTML tables a lot (including for page layouts, remember those days?). There was a time when I thought I was fluent enough to not have to look up HTML or CSS docs for most things. But I don’t think I’ve ever actively used the DOM API that this article mentions so I learned something new today.

Surprised, as we used this a lot around 2005, when IE6 was still dominant.

If was much simpler to build tables in javascript with this rather than using document.createElement.

Perhaps this was one of those things that you just had to know about, or be working on data heavy web apps.

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

#145
post #96
post #77

Earlier quoted context omitted.

It's about the insertRow() and insertCell() methods and rows[] and cells[] fields on the table element, not the table itself.

I figured that was the normal way to interact with tables, what would people do otherwise?

createElement(‘tr’) and table.appendChild(row)

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

#146

Earlier quoted context omitted.

Yes, your point? Anyone who spend 15 minutes learning about React learns that you don't manipulate the DOM directly, you let the rendering engine handle that for you.

Yes that’s why of instead of learning the standard apis, you have to spend 15 months learning how to debug useEffect

Or just skip all of the newly released stuff and use React as it was originally made, like me and many others still do. Never suffer from having to debug "useEffect" because we literally never use it. You don't have to use the newest and shiniest toys, especially not those with footguns.

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

#147
post #142
post #99

Earlier quoted context omitted.

Using the standard DOM APIs or - if they don't care about anything - innerHTML, I suppose.

Sorry I - also - am one of those old timers who don't understand this because the shown code is all I've ever used for creating table. So, what is this "standard DOM API" if I may ask? Could you post a code example?

You can use document.createElement and document.appendChild to create every last , , and if you want. Those functions are not specific to tables, unlike the one mentioned in the blog post. They can be used to create any elements and place them in the DOM. But if you know what you are doing you can get a perfectly fine table out of that. (Not that you should.)

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

#148
post #84

Earlier quoted context omitted.

You knew about the .insertRow() and .insertCell() methods?

I made my first CRUD UI that didn't do full page refreshes with those methods.

I think most of us did the ol `$el.appendChild(document.createElement('tr'))` dance rather than using those, at least I did during the 00s for sure.

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

#149

Phew, this post single handedly made me feel old this morning. I started dabbling with the web just over 20 years ago but have mainly been working on the backend the past 10-15 years. I had no clue that nowadays programmers don’t know about this, so I assume it’s supplanted by modern frameworks or modern JS/CSS

HTML tables are cognitively if not officially deprecated these days. I made my 1996 resume in HTML using a table for layout and it was indistinguishable from the Word version when printed. Made by editing the HTML by hand too! Tables are great. I don't doubt that CSS stuff is more capable, but the old ones are still useful.

> HTML tables are cognitively if not officially deprecated these days.

According to who?

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

#150

Woah, it’s always weird to see how there’s modern web engineers that didn’t grow up during the era where entire layouts were built on tables. Not saying that it was good or bad, but just interesting.

I remember doing image maps, splitting large images up into pieces, placing them in table cells and adding links to each cell as a poor man's GUI
Post reply on HN