@pageboard/html 0.12.30 → 0.12.31
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.
- package/package.json +1 -1
- package/ui/form.js +3 -5
package/package.json
CHANGED
package/ui/form.js
CHANGED
|
@@ -150,7 +150,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
150
150
|
}));
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
read(withDefaults = false) {
|
|
153
|
+
read(withDefaults = false, submitter) {
|
|
154
154
|
const fd = new FormData(this);
|
|
155
155
|
const query = {};
|
|
156
156
|
fd.forEach((val, key) => {
|
|
@@ -219,9 +219,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
// https://github.com/Financial-Times/polyfill-library/issues/1111
|
|
224
|
-
const btn = document.activeElement;
|
|
222
|
+
const btn = submitter;
|
|
225
223
|
if (btn && btn.type == "submit" && btn.name && btn.value) {
|
|
226
224
|
query[btn.name] = btn.value;
|
|
227
225
|
}
|
|
@@ -325,7 +323,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
325
323
|
getMethod(e, state) {
|
|
326
324
|
const redirect = this.getAttribute('action');
|
|
327
325
|
const loc = Page.parse(redirect);
|
|
328
|
-
Object.assign(loc.query, this.read(false));
|
|
326
|
+
Object.assign(loc.query, this.read(false, e.submitter || document.activeElement));
|
|
329
327
|
if (loc.samePathname(state)) {
|
|
330
328
|
loc.query = { ...state.query, ...loc.query };
|
|
331
329
|
}
|