Earlier quoted context omitted.
Just a catchy title. Not abandoned etc. This is the only API available to manipulate HTML table tags.
Most people use declarative frameworks to build tables, and you could just use `innerHTML` or `append` or any other imperative DOM API to work with tables.
Do you know that there is an HTML tables API?
71–80 of 206 posts
Re: Do you know that there is an HTML tables API?
#72Phew, 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
Re: Do you know that there is an HTML tables API?
#73Earlier quoted context omitted.
It’s not about the table element, it’s about the API to construct and manipulate that element with a columns and rows interface which is largely superseded by general DOM manipulation.
Exactly like how `getElementById` replaced the direct use of the id as a JavaScript identifier.
Re: Do you know that there is an HTML tables API?
#74Earlier quoted context omitted.
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 .
Thanks Vercel & Meta for protecting us.
Re: Do you know that there is an HTML tables API?
#75Re: Do you know that there is an HTML tables API?
#76Interesting, 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!
It’s normal to use short names for things with short scopes.
In just 4 lines you have r, row, t, ri, l, i and c.
The full variables names are so short anyway that personally I'd write them out. Code does evolve and there's a risk of this suffering as a result.
Re: Do you know that there is an HTML tables API?
#77Phew, 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
Thank you for confirming I am not... crazy, just old then. I was staring at the code for minutes, trying to spot something unusual that I missed. So, this really just about the ` ` element, or do I actually not see something?
Re: Do you know that there is an HTML tables API?
#78Abandoned? When? I still use this pretty much everywhere to create HTML tables. Do people use something else now?
The idea of the author seems to be that this part of the DOM API that could benefit from backwards-compatible additions. So, by "abandoned", he hints at the headroom for building more table capabilities into the platform.
He compares it loosely to the form element API and the additions it received over the last decades.
In the case of tables, I could think of things such as a sorting, filtering API, but I can't tell whether that's what he means.
Re: Do you know that there is an HTML tables API?
#79Re: Do you know that there is an HTML tables API?
#80Topic is reminiscent of a submission from yesterday about XSLT: