diff --git a/skills/html-spec-review/SKILL.md b/skills/html-spec-review/SKILL.md index 9e48c51..3de2d58 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,16 @@ 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 +- When an algorithm starts reading a new DOM attribute, relative element, CSS `computed value`, or layout dimension, check that the corresponding reactivity hooks (`relevant mutations`, `attribute change steps`, `HTML element insertion/removing steps`, `react to changes in the environment`): + 1. **Trigger on all new inputs**: Dynamically mutating any newly read attribute, relative element, or CSS property triggers the update algorithm under the same guard conditions. + 2. **Match existing flags**: New mutation triggers set auxiliary flags (such as event-omission flags) consistently with existing triggers. + 3. **Image candidate selection (``/``)**: Filter `` candidates before mutating persistent state, reset host association slots on fallback or removal, update presentational hints before reading layout dimensions, and in WPT avoid inline `style` overriding presentational hints or `srcset`/`sizes` values sensitive to `window.devicePixelRatio`. + +### 3.8. Author Script Re-Entrancy & Mid-Algorithm DOM Mutations +- Any algorithm that can invoke author script mid-execution (via custom element constructors/reactions, `` inside JS comments or string literals in inline ` in Inline Scripts (WPT-EARLY-SCRIPT-CLOSE): + - Flags literal '' inside JS comments or string literals in .html/.htm WPT files, which prematurely closes the HTML inside JS comments or string literals in HTML files + if wpt_path.suffix in {'.html', '.htm'}: + self._check_early_script_close(wpt_path, test_content) + + # Check for unguarded TypeError assertions on sinks added in a spec diff + self._check_unguarded_typeerror(wpt_path, test_content, new_sinks) + # Flag any sink that has 0 matching tests for sink, tests in sink_test_map.items(): # Focus on high-value DOM/HTML insertion sinks @@ -127,6 +139,106 @@ def audit_coverage(self, spec_text: str, wpt_files: List[Path]) -> List[Coverage return self.issues + def _check_early_script_close(self, wpt_path: Path, test_content: str) -> None: + """Flags literal inside JS comments or string literals in HTML WPT files.""" + script_start = re.compile(r']*>', re.IGNORECASE) + # The tokenizer only ends a script at '' + script_end = re.compile(r']|$)', re.IGNORECASE) + in_script = False + for line_no, line in enumerate(test_content.splitlines(), start=1): + # Scan the line from left to right, so start and end tags on the same line are handled + pos = 0 + started_on_line = False + while True: + if not in_script: + start_match = script_start.search(line, pos) + if not start_match: + break + if line[:start_match.start()].count('"') % 2: + # Inside an attribute value, e.g.