HS: elsewhere / from elsewhere modifier (+2 tests)

Parser: parse-on-feat now consumes `elsewhere` (or `from elsewhere`) as
a modifier between event-name and source. When matched, sets a flag and
emits :elsewhere true on parts. The `from elsewhere` form peeks one
token ahead before consuming both keywords so plain `from #x` continues
to parse as a source expression.

Compiler: scan-on threads elsewhere?; when present, target becomes
(dom-body) (so the listener attaches to body and bubbles see all clicks)
and the handler body is wrapped with `(when (not (host-call me "contains"
(host-get event "target"))) BODY)` so the handler fires only when the
click originated outside the activated element.

Generator: dropped supports "elsewhere" modifier and supports "from
elsewhere" modifier from skip-list.

hs-upstream-on: 48/70 → 50/70. Smoke 0-195 unchanged at 172/195.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 12:26:30 +00:00
parent a8a798c592
commit 3044a16817
6 changed files with 104 additions and 46 deletions

View File

@@ -9197,9 +9197,19 @@
(deftest "rethrown exceptions trigger 'exception' event"
(error "SKIP (skip-list): rethrown exceptions trigger 'exception' event"))
(deftest "supports \"elsewhere\" modifier"
(error "SKIP (skip-list): supports 'elsewhere' modifier"))
(hs-cleanup!)
(let ((_el-div (dom-create-element "div")))
(dom-set-attr _el-div "_" "on click elsewhere add .clicked")
(dom-append (dom-body) _el-div)
(hs-activate! _el-div)
))
(deftest "supports \"from elsewhere\" modifier"
(error "SKIP (skip-list): supports 'from elsewhere' modifier"))
(hs-cleanup!)
(let ((_el-div (dom-create-element "div")))
(dom-set-attr _el-div "_" "on click from elsewhere add .clicked")
(dom-append (dom-body) _el-div)
(hs-activate! _el-div)
))
(deftest "throttled at <time> allows events after the window elapses"
(hs-cleanup!)
(let ((_el-d (dom-create-element "div")))