feat(runtime): make techdemo interactions declarative
req: examples/005 req: htmx_equivalents/002 req: dx/008 req: form/002
This commit is contained in:
@@ -410,6 +410,14 @@
|
||||
navigate(nav);
|
||||
return;
|
||||
}
|
||||
if (name === "click") {
|
||||
const direct = closestInRoot(event.target, root, `[${HID}]`);
|
||||
if (direct && defaultEvent(direct) === "click") {
|
||||
event.preventDefault();
|
||||
schedule(direct, name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (name === "click") {
|
||||
const submitter = closestInRoot(event.target, root, "button[type=submit], input[type=submit], button:not([type])");
|
||||
const form = submitter && submitter.closest("form");
|
||||
|
||||
@@ -22,6 +22,7 @@ fn runtime_clicking_submitter_schedules_form_submit() {
|
||||
// req: convention/004
|
||||
let source = slhx_js::RUNTIME_JS;
|
||||
|
||||
assert!(source.contains("const direct = closestInRoot(event.target, root, `[${HID}]`)"));
|
||||
assert!(source.contains("button[type=submit], input[type=submit], button:not([type])"));
|
||||
assert!(source.contains("form.reportValidity && !form.reportValidity()"));
|
||||
assert!(source.contains("schedule(form, \"submit\")"));
|
||||
|
||||
Reference in New Issue
Block a user