Do you know that there is an HTML tables API?
101–110 of 206 posts
Re: Do you know that there is an HTML tables API?
#102Abandoned? When? I still use this pretty much everywhere to create HTML tables. Do people use something else now?
Re: Do you know that there is an HTML tables API?
#103Earlier quoted context omitted.
I mean, you can just remove all the user agent styles and then is just as stylable as .
Why would marketing want to pay for the extra (and to their mind entirely pointless) work required to capture semantics? (I’m not saying I like the world we live in, but I don’t see a likely alternative.)
Re: Do you know that there is an HTML tables API?
#104Phew, 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.
What is discouraged is using tables as invisible layout grids - and that was their primary de-facto usecase before CSS and grid layouts. But that had always been a hack, even though a necessary one.
Re: Do you know that there is an HTML tables API?
#105Interesting, 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!
that's like saying in spoken language "don't ever use pronouns, or even first or nicknames, use full given names"
Re: Do you know that there is an HTML tables API?
#106Interesting, 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!
This one hurts the most. Save a few bytes for an ungodly amount of mental friction.
Re: Do you know that there is an HTML tables API?
#107Earlier quoted context omitted.
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?
#108Not quite sure what the author means by that. Re-rendering pnly happens when the current task queue elemt has been processed. Never while JS is running (aside from webworker and the like). I would honestly be surprised if this API had much (if any) performance benefits over createElement.
Re: Do you know that there is an HTML tables API?
#109Abandoned? When? I still use this pretty much everywhere to create HTML tables. Do people use something else now?
People often use declarative UI frameworks such as React, Svelte etc. when they want to build things dynamically in JS like that now, so imperative DOM manipulation APIs have unsurprisingly become a little more niche.
Re: Do you know that there is an HTML tables API?
#110Tables died (thankfully) to make room for flex and grid. I can't see any use case for them at all anymore.
Tables built with flex and grid absolutely can be made accessible with WAI-ARIA, but native table elements are harder to mess up.