From d0cb4cee21f3ceef4f93e414d98c0224f4eef84b Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Thu, 22 Oct 2026 20:26:16 +0100 Subject: [PATCH 01/10] Add reactivity, candidate loop ordering, CSS/microsyntax, and WPT review rules to html-spec-review --- skills/html-spec-review/SKILL.md | 40 +++++++++++++++++++ .../scripts/check_algorithms.py | 13 +++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/skills/html-spec-review/SKILL.md b/skills/html-spec-review/SKILL.md index 9e48c51..6422c2a 100644 --- a/skills/html-spec-review/SKILL.md +++ b/skills/html-spec-review/SKILL.md @@ -77,6 +77,7 @@ Refer to this skill when authoring spec text, reviewing pull requests, or conduc ### 2.4. Phrasing Conventions - Use standard Infra conjugation: `the result of getting the popcorn given args` (not "the result of calling get the popcorn with..."). - Assertions: `Assert: x is non-null.` (Always wrap in `Assert:`, never bare `Assert:`). +- Loop control: Always wrap `continue` and `break` in `` (`continue`, `break`), never bare `continue` or `break`. - Context: `this` (never bare "this"). ### 2.5. Scope Leaks & Branch-Bound Variables (`ALGO-UNBOUND-VAR-OUTER-SCOPE`) @@ -166,6 +167,20 @@ Refer to this skill when authoring spec text, reviewing pull requests, or conduc 5. In-flight aborted traversals - Ensure the fallback branch creates synthetic fallback structs or documents the intentional omission with matching WPT tests. +### 3.7. Reactivity & Mutation-Hook Parity Audit +- **Failure Mode**: An algorithm begins reading a new DOM attribute, sibling/parent attribute, CSS `computed value` (e.g., `'object-fit'`), or layout box dimension (`content box`), but the corresponding reactivity hooks (`relevant mutations`, `attribute change steps`, `HTML element insertion/removing steps`, `react to changes in the environment`) are either not updated or use mismatched guard conditions. +- **Review Rule**: + 1. **Completeness**: Verify that dynamically mutating any newly read attribute, sibling element, or CSS property triggers the appropriate update algorithm. + 2. **Guard Condition Parity**: Verify that the mutation trigger uses the *exact same guard condition* as the algorithm that consumes the input. For example, if `parse a sizes attribute` only inspects `'object-fit'` when `img is being rendered`, then `relevant mutations` must only trigger on `'object-fit'` changes *while the element is `being rendered`* (otherwise mutating `object-fit` on a `display: none` image triggers a bogus update and sets `img.complete = false`). + 3. **Side-Effect & Event Flag Parity**: Verify that new mutation triggers set auxiliary flags (such as the *maybe omit events* flag in `update the image data`) consistently with analogous existing triggers. + 4. **Internal Slot Reset on Fallback or Removal**: When an algorithm iterates over candidate child/sibling elements (``) and updates an internal association slot on the host element (`dimension attribute source`), ensure the slot is reset to its default at algorithm entry (when no candidate matches or when falling back to ``) and in `HTML element removing steps` when disconnected. + +### 3.8. Side-Effect & Layout-Dependency Ordering in Candidate Loops +- **Failure Mode**: In algorithms that iterate over candidate elements (``, `