bi-03 — Analysis

Required invariants

  1. Every byte sequence produces a DOM. There is no parse-failure path. "Parse error" is a diagnostic annotation, not control flow.
  2. Two conforming implementations produce the same DOM for broken markup. This is the entire reason error recovery is specified, and the largest interop win in the platform's history.
  3. Insertion location is decided separately from insertion mode. Foster parenting is a property of where, not of which mode — the lab's Case A turns on exactly this.
  4. The tokenizer's state depends on the tree builder. Content models (RCDATA, RAWTEXT, script data) mean the two machines cannot be decoupled.
  5. Speculation may be wrong; it may never be observable. Preload and background scanners create no nodes, run no script, and change no parser state.
  6. Author code never observes a half-built tree. The construction site queues tasks rather than mutating directly.

The measurable shape of the problem

QuantityValueWhat it tells you
Tokenizer states76content models and legacy escaping, not core parsing
Insertion modes217 are tables; 3 are framesets
Parser directory files~95you need about six of them

Seven of twenty-one insertion modes are table-related. That ratio is the honest measure of what table markup cost the platform, and it is a better argument than any anecdote.

Failure modes

BreakConsequenceFirst test to fail
Remove foster parentinglegacy table markup renders inside-outhtml5lib table cases
Remove character batchingwhitespace handling in tables becomes wrongin-table-text cases
Decouple tokenizer from tree builder<title>/<textarea> content parsed as markupRCDATA cases
Remove the <input type=hidden> exceptionhidden form fields leave their <form> on submitcompat, not conformance
Sanitiser disagrees with the parsermutation XSSnone — this is a security bug, not a test failure

Classification exercise

For each of the following, decide: essential architecture, production hardening, or accretion?

  • insertion modes — essential (the tree shape must be recovered from arbitrary input)
  • kScriptDataDoubleEscaped*accretion (1990s comment-wrapped scripts)
  • the fragment-parsing fast path — hardening (it bails out to the general algorithm; that is the tell)
  • foster parenting — essential, but only given the compatibility requirement
  • <input type=hidden> in tables — accretion, and the answer key argues the case

Getting these right, with evidence, is the skill fw-11 formalises.