| 252 | } |
| 253 | |
| 254 | function drawTable(section, spec) { |
| 255 | const host = $(section, 'table'); |
| 256 | host.replaceChildren(); |
| 257 | if (!spec) return; |
| 258 | |
| 259 | const table = el('table'); |
| 260 | const thead = el('thead'); |
| 261 | const headRow = el('tr'); |
| 262 | for (const column of spec.columns) { |
| 263 | const th = el('th', null, column); |
| 264 | th.scope = 'col'; |
| 265 | headRow.append(th); |
| 266 | } |
| 267 | thead.append(headRow); |
| 268 | |
| 269 | const tbody = el('tbody'); |
| 270 | for (const row of spec.rows) { |
| 271 | const tr = el('tr'); |
| 272 | row.forEach((cell, i) => { |
| 273 | const node = el(i === 0 ? 'th' : 'td', null, String(cell)); |
| 274 | if (i === 0) node.scope = 'row'; |
| 275 | tr.append(node); |
| 276 | }); |
| 277 | tbody.append(tr); |
| 278 | } |
| 279 | table.append(thead, tbody); |
| 280 | host.append(table); |
| 281 | } |
| 282 | |
| 283 | function drawStat(section, stat) { |
| 284 | const host = $(section, 'stat'); |