Repository navigation
Conversation
…m does A fragment whose top level starts with a <col> has the column group's mode as its template's mode. Chromium's template.innerHTML then drops a table's text still pending at the fragment's end, where the standard (and parse5) writes it: <col><template><table>abc gives <col><template><table></table> </template>. When the text is not all whitespace, Chromium still re-opens the formatting elements before the table; only the text is lost. StandardParser.onEof now does the same. Such text is always in a nested <template>, as the fragment's own column group mode ignores tables and text, so no output reads it and EXTRACTOR_VERSION stays extract-tf/15. Random fragments of table and template tags now match Chromium in all 50,000 of ten runs (1 to 6 of 5,000 per run differed before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: 77777R7 <lunhoward306@gmail.com>
This was referenced Oct 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #145 (
claude/parse5-template-form); it retargets as the stack merges. This fixes the fragment-only Known gap carried in #143 and #145: Chromium drops trailing text in a template's table at the end of a fragment.Problem
The cause turned out to be narrower than the gap's description. Chromium drops the text only when both of these hold:
<col>. That puts its template's insertion mode in the column-group mode.The standard and parse5 write that text out. Chromium's
template.innerHTMLdrops it. If the text is not all whitespace, Chromium still re-opens the formatting elements before the table; only the text itself is lost.template.innerHTML<col><template><table>abc<col><template><table></table></template><col><template>abc<table></table></template><col><template><table><tr><b><i></tr>abc<col><template><b><i></i></b><b><i></i></b><table>…</table></template><b><i>holdsabc<template><table>abc(no<col>)<col>Change
packages/extract-tf/src/dom.ts,StandardParser.onEof. The rule applies only when all of these hold:tmplInsertionModeStack).When it applies:
No output changes. The fragment's column-group mode ignores tables and text at its top level, so the dropped text is always inside a nested
<template>, which nothing reads.EXTRACTOR_VERSIONstaysextract-tf/15.Tests
packages/extract-tf/test/tables.test.ts. Every expected value is Chromium'stemplate.innerHTML. On fix(extract-tf): read a <form> in a <template> as Chromium does #145's code the five "dropped" assertions fail; the four "kept" assertions pass on both versions and guard the rule's boundaries.npm run typecheck: exit 0.npm test: 145 files, 1839 tests passed.Chromium oracle
template.innerHTML): 50,000 of 50,000 match over seeds 1–10. Before, seeds 1–3 had 1, 6 and 3 mismatches in 5,000.</foreignObject>and<select>differences, plus<body>…</body>input, whichparsedeliberately reads as a selection.Review
A fresh-context reviewer found nothing blocking. It checked:
tmplInsertionModeStackorder,fragmentContextbeing null for pages, and how the foster-parenting flag is restored;<col>-led fragments, with no regressions against the old code;<body>…</body>) and<noscript>paths;Known gaps (unchanged)
</foreignObject>past an HTML<foreignObject>, and its newer<select>parsing, as listed in feat(extract-tf): build the page tree with parse5, the HTML standard's tree construction #137.<col>fragment that starts with head tags such as<title>. Chromium drops the<col>itself; we keep it. This was the same before this change and is inside template content. Fixed in fix(extract-tf): read a <title> or <base> at a template's top level as Chromium does #150, which reads<title>,<base>,<basefont>,<bgsound>and<noframes>in a template as Chromium does.🤖 Generated with Claude Code