@shgysk8zer0/polyfills 0.2.2 → 0.2.4
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/CHANGELOG.md +10 -0
- package/all.min.js +7 -7
- package/all.min.js.map +1 -1
- package/element.js +21 -0
- package/package.json +11 -1
package/element.js
CHANGED
|
@@ -170,3 +170,24 @@ if (! HTMLTemplateElement.prototype.hasOwnProperty('shadowRootMode')) {
|
|
|
170
170
|
attachShadows(document);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
+
|
|
174
|
+
if (! (HTMLFormElement.prototype.requestSubmit instanceof Function)) {
|
|
175
|
+
HTMLFormElement.prototype.requestSubmit = function(submitter) {
|
|
176
|
+
if (typeof submitter === 'undefined') {
|
|
177
|
+
const btn = document.createElement('button');
|
|
178
|
+
btn.type = 'submit';
|
|
179
|
+
btn.hidden = true;
|
|
180
|
+
this.append(btn);
|
|
181
|
+
this.requestSubmit(btn);
|
|
182
|
+
setTimeout(() => btn.remove(), 100);
|
|
183
|
+
} else if (! (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement)) {
|
|
184
|
+
throw new TypeError('HTMLFormElement.requestSubmit: The submitter is not a submit button.');
|
|
185
|
+
} else if (submitter.type !== 'submit' && ! (submitter instanceof HTMLInputElement && submitter.type === 'image')) {
|
|
186
|
+
throw new TypeError('HTMLFormElement.requestSubmit: The submitter is not a submit button.');
|
|
187
|
+
} else if (! this.isSameNode(submitter.form)) {
|
|
188
|
+
throw new DOMException('HTMLFormElement.requestSubmit: The submitter is not owned by this form.', 'NotFoundError');
|
|
189
|
+
} else {
|
|
190
|
+
submitter.click();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgysk8zer0/polyfills",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A collection of JavaScript polyfills",
|
|
@@ -55,6 +55,16 @@
|
|
|
55
55
|
],
|
|
56
56
|
"author": "Chris Zuber <shgysk8zer0@gmail.com>",
|
|
57
57
|
"license": "MIT",
|
|
58
|
+
"funding": [
|
|
59
|
+
{
|
|
60
|
+
"type": "librepay",
|
|
61
|
+
"url": "https://liberapay.com/shgysk8zer0"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "github",
|
|
65
|
+
"url": "https://github.com/sponsors/shgysk8zer0"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
58
68
|
"bugs": {
|
|
59
69
|
"url": "https://github.com/shgysk8zer0/polyfills/issues"
|
|
60
70
|
},
|