HS: halt command modes, mock event methods

Parser:
- halt default/bubbling: match ident type (not just keyword)
- halt the event's: consume possessive marker

Runtime:
- hs-halt! dispatches: default→preventDefault, bubbling→stopPropagation,
  event→both

Mock DOM:
- Add event method dispatch: preventDefault, stopPropagation,
  stopImmediatePropagation set correct flags on event dict

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 05:44:08 +00:00
parent a876ac8a7f
commit 922e7a7892
3 changed files with 18 additions and 4 deletions

View File

@@ -1807,6 +1807,15 @@ let run_spec_tests env test_files =
| _ -> Bool false)
| _ -> Nil)
else if mt = "event" then
(match m with
| "preventDefault" -> Hashtbl.replace d "defaultPrevented" (Bool true); Nil
| "stopPropagation" -> Hashtbl.replace d "_stopped" (Bool true); Nil
| "stopImmediatePropagation" ->
Hashtbl.replace d "_stopped" (Bool true);
Hashtbl.replace d "_stopImmediate" (Bool true); Nil
| _ -> Nil)
else if mt = "style" then
(match m with
| "setProperty" ->