( container: HTMLElement, track: string, )
| 993 | |
| 994 | /** Seed row counts from strip-only track (not DOM — avoids counting fallback partial rows) */ |
| 995 | export function initTableRowCountsFromTrack( |
| 996 | container: HTMLElement, |
| 997 | track: string, |
| 998 | ): void { |
| 999 | const table = container.querySelector("table"); |
| 1000 | if (!table) { |
| 1001 | return; |
| 1002 | } |
| 1003 | |
| 1004 | const tableStart = findTableStart(track); |
| 1005 | if (tableStart === -1) { |
| 1006 | return; |
| 1007 | } |
| 1008 | |
| 1009 | const tableEnd = firstCompleteTableEnd(track, tableStart); |
| 1010 | const tableSection = |
| 1011 | tableEnd === -1 |
| 1012 | ? track.slice(tableStart) |
| 1013 | : track.slice(tableStart, tableEnd); |
| 1014 | const parts = splitTableStream(tableSection); |
| 1015 | table.dataset.shTheadRowCount = String(parts.theadComplete.length); |
| 1016 | table.dataset.shRowCount = String(parts.tbodyComplete.length); |
| 1017 | table.style.tableLayout = "fixed"; |
| 1018 | table.dataset.shLayoutFixed = "1"; |
| 1019 | } |
| 1020 | |
| 1021 | /** Seed row counts after a full render so incremental patches stay in sync */ |
| 1022 | export function initTableRowCounts(container: HTMLElement): void { |
no test coverage detected