| 229 | } |
| 230 | |
| 231 | function drawTable(section, spec) { |
| 232 | const host = $(section, 'table'); |
| 233 | host.replaceChildren(); |
| 234 | if (!spec) return; |
| 235 | |
| 236 | const table = el('table'); |
| 237 | const thead = el('thead'); |
| 238 | const headRow = el('tr'); |
| 239 | for (const column of spec.columns) { |
| 240 | const th = el('th', null, column); |
| 241 | th.scope = 'col'; |
| 242 | headRow.append(th); |
| 243 | } |
| 244 | thead.append(headRow); |
| 245 | |
| 246 | const tbody = el('tbody'); |
| 247 | for (const row of spec.rows) { |
| 248 | const tr = el('tr'); |
| 249 | row.forEach((cell, i) => { |
| 250 | const node = el(i === 0 ? 'th' : 'td', null, String(cell)); |
| 251 | if (i === 0) node.scope = 'row'; |
| 252 | tr.append(node); |
| 253 | }); |
| 254 | tbody.append(tr); |
| 255 | } |
| 256 | table.append(thead, tbody); |
| 257 | host.append(table); |
| 258 | } |
| 259 | |
| 260 | function drawStat(section, stat) { |
| 261 | const host = $(section, 'stat'); |