| 74 | // Returns [{heading: h2El, tables: [tableEl, ...]}, ...] |
| 75 | |
| 76 | function getDomainSections(content) { |
| 77 | const sections = []; |
| 78 | let current = null; |
| 79 | content.querySelectorAll("h2, table").forEach((el) => { |
| 80 | if (el.tagName === "H2") { |
| 81 | current = el.textContent.includes("Domain:") ? { heading: el, tables: [] } : null; |
| 82 | if (current) sections.push(current); |
| 83 | } else if (el.tagName === "TABLE" && current) { |
| 84 | if (el.querySelectorAll("thead th").length >= 5) current.tables.push(el); |
| 85 | } |
| 86 | }); |
| 87 | return sections; |
| 88 | } |
| 89 | |
| 90 | // ── Controls builder (one per domain) ──────────────────────────────────── |
| 91 | |