Earlier quoted context omitted.
A bike-shedding thread on top as usual.
Code quality is not bike shedding.
Do you know that there is an HTML tables API?
51–60 of 206 posts
Re: Do you know that there is an HTML tables API?
#52Earlier 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.
Re: Do you know that there is an HTML tables API?
#53Interesting, 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!
A bike-shedding thread on top as usual.
Re: Do you know that there is an HTML tables API?
#54Phew, 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
Yep, didn’t realize this was unknown by enough web developers to warrant an article.
Re: Do you know that there is an HTML tables API?
#55It is similar as with buttons ( https://news.ycombinator.com/item?id=45774182 ). Not sure when it was (10-15 years ago), but at some point everything became s. So, instead of semantic markup, HTML became a UI toolbox.
I think it was inevitable. Most of the funded content on the web is marketing/sales-driven, and companies paying for marketing content want it to be displayed in a specific way. It’d be interesting to have a parallel DocBook web for technical content, where consumers of that content could apply their own styles to render it in a way that’s best for them.
Re: Do you know that there is an HTML tables API?
#56I was using it just half a year ago, after either reading MDN or reading what AI suggested. Which means, this API is not obscure and not forgotten. Using `rows` and `cells` is very convenient for keyboard navigation across table cells. https://github.com/ClickHouse/ClickHouse/blob/master/program...
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.
Re: Do you know that there is an HTML tables API?
#57Tables died (thankfully) to make room for flex and grid. I can't see any use case for them at all anymore.
Re: Do you know that there is an HTML tables API?
#58Re: Do you know that there is an HTML tables API?
#59Earlier quoted context omitted.
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?
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.
Re: Do you know that there is an HTML tables API?
#60Interesting, 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!
Really? The variable name lengths? Not that the code is clearer as: const te = document.createElement('table'); document.body.appendChild(te); [ ['one', 'two', 'three'], ['four', 'five', 'six' ], ].forEach((r, i) => { const re = te.insertRow(i); r.forEach((c, j) => { re.insertCell(j).innerText = c; }) }); My personal stance on short variable names is that they are fine as long as their scope is very limited, which is…