Body rows without an explicit wrapper
(tableSection: string)
| 513 | |
| 514 | /** Body rows without an explicit <tbody> wrapper */ |
| 515 | function sliceImplicitTbody(tableSection: string): string { |
| 516 | const afterThead = tableSection.match(/<\/thead>/i); |
| 517 | if (!afterThead && /<thead\b/i.test(tableSection)) { |
| 518 | // Open thead — rows still belong to header, not implicit tbody |
| 519 | return ""; |
| 520 | } |
| 521 | |
| 522 | const start = afterThead |
| 523 | ? afterThead.index! + afterThead[0].length |
| 524 | : tableSection.search(/<tr\b/i); |
| 525 | if (start === -1) { |
| 526 | return ""; |
| 527 | } |
| 528 | const slice = tableSection.slice(start); |
| 529 | const tableEnd = slice.search(/<\/table>/i); |
| 530 | return tableEnd === -1 ? slice : slice.slice(0, tableEnd); |
| 531 | } |
| 532 | |
| 533 | function splitTableStream(tableSection: string): TableStreamParts { |
| 534 | const theadPart = sliceTagSection(tableSection, "thead"); |