@primate/core 0.9.16 → 0.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,9 +51,12 @@ export default (frontend, u) => {
51
51
  event.preventDefault();
52
52
  const target = event.target;
53
53
  const { enctype } = target;
54
- const action = target.action ?? location.pathname;
55
- const url = new URL(action);
56
- const data = new FormData(target);
54
+ const action = target.getAttribute("action") ?? location.href;
55
+ const url = new URL(action, location.href);
56
+ const submitter = event.submitter;
57
+ const data = submitter === null
58
+ ? new FormData(target)
59
+ : new FormData(target, submitter);
57
60
  const form = enctype === http.MIME.MULTIPART_FORM_DATA
58
61
  ? data
59
62
  : new URLSearchParams(data);
@@ -119,8 +119,13 @@ function createForm(init) {
119
119
  const method = init.method
120
120
  ?? form_element.method.toUpperCase()
121
121
  ?? "POST";
122
- const url = init.url ?? form_element.action;
123
- const form_data = new FormData(form_element);
122
+ const url = init.url
123
+ ?? form_element.getAttribute("action")
124
+ ?? globalThis.location.href;
125
+ const submitter = event?.submitter;
126
+ const form_data = submitter === null || submitter === undefined
127
+ ? new FormData(form_element)
128
+ : new FormData(form_element, submitter);
124
129
  setSubmitting(true);
125
130
  try {
126
131
  const response = await (is.defined(init.action)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/core",
3
- "version": "0.9.16",
3
+ "version": "0.9.18",
4
4
  "description": "The universal web framework",
5
5
  "homepage": "https://primate.run",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -35,7 +35,7 @@
35
35
  "@rcompat/symbol": "^0.3.0",
36
36
  "@rcompat/type": "^0.18.0",
37
37
  "esbuild": "^0.28.1",
38
- "pema": "^0.9.1"
38
+ "pema": "^0.9.2"
39
39
  },
40
40
  "imports": {
41
41
  "#i18n/config": {