fix(js): keep form-owner lookup root scoped

Resolve controls with a form= attribute inside the current slhx root instead of using document-global id lookup, preserving multi-root isolation for direct handle dispatch.

req: runtime/001

req: convention/004
This commit is contained in:
slhx agent
2026-06-01 20:02:05 +02:00
parent d732c921c2
commit 8d1bdaec08
2 changed files with 10 additions and 3 deletions
+4 -2
View File
@@ -94,12 +94,14 @@ fn runtime_handles_get_forms_without_request_body() {
#[test]
fn runtime_clicking_submitter_schedules_form_submit() {
// req: convention/004
// req: convention/004 req: runtime/001
let source = slhx_js::RUNTIME_JS;
assert!(source.contains("function formOwner(el)"));
assert!(source.contains("function formHandleId(form)"));
assert!(source.contains("document.getElementById(el.getAttribute(\"form\"))"));
assert!(source.contains("function elementById(scope, id)"));
assert!(source.contains("return elementById(rootOf(el) || document, el.getAttribute(\"form\"))"));
assert!(!source.contains("document.getElementById(el.getAttribute(\"form\"))"));
assert!(source.contains("const direct = closestInRoot(event.target, root, (el) => el.hasAttribute(HID))"));
assert!(source.contains("const submitter = closestInRoot(event.target, root, (el) =>"));
assert!(source.contains("el.tagName === \"BUTTON\" && (!el.hasAttribute(\"type\") || el.getAttribute(\"type\") === \"submit\")"));