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:
@@ -27,10 +27,15 @@
|
||||
|
||||
function formOwner(el) {
|
||||
if (!el || el.tagName === "FORM") return el;
|
||||
if (el.getAttribute && el.getAttribute("form")) return document.getElementById(el.getAttribute("form"));
|
||||
if (el.getAttribute && el.getAttribute("form")) return elementById(rootOf(el) || document, el.getAttribute("form"));
|
||||
return closestInRoot(el, rootOf(el) || document, (node) => node.tagName === "FORM");
|
||||
}
|
||||
|
||||
function elementById(scope, id) {
|
||||
if (attrEquals(scope, "id", id)) return scope;
|
||||
return firstElement(scope, (el) => attrEquals(el, "id", id));
|
||||
}
|
||||
|
||||
function formHandleId(form) {
|
||||
if (!form) return null;
|
||||
const holder = form.hasAttribute(HID) ? form : firstElement(form, (el) => el.hasAttribute(HID));
|
||||
|
||||
Reference in New Issue
Block a user