summaryrefslogtreecommitdiffstatshomepage
path: root/src/htmx.js
diff options
context:
space:
mode:
authorVincent <vichenzo-thebaud@hotmail.com>2024-02-04 21:02:27 +0100
committerVincent <vichenzo-thebaud@hotmail.com>2024-02-04 21:02:27 +0100
commit07ce511ae612d52652ef3ab2bf16062cdd5ef131 (patch)
treeec9d0f632dde6b1dc82075ebb86e7971f42ed277 /src/htmx.js
parentcb8fa85ae73b7b10d2fbef0aa01c6d2288a87c9e (diff)
downloadhtmx-07ce511ae612d52652ef3ab2bf16062cdd5ef131.tar.gz
htmx-07ce511ae612d52652ef3ab2bf16062cdd5ef131.zip
Support JSON.stringify & Object.assign on FormData proxy
Diffstat (limited to 'src/htmx.js')
-rw-r--r--src/htmx.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/htmx.js b/src/htmx.js
index 1e09da10..5f7ebdc8 100644
--- a/src/htmx.js
+++ b/src/htmx.js
@@ -3112,6 +3112,10 @@ var htmx = (function() {
// Forward symbol calls to the FormData itself directly
return Reflect.get(...arguments)
}
+ if (name === 'toJSON') {
+ // Support JSON.stringify call on proxy
+ return () => Object.fromEntries(formData)
+ }
if (name in target) {
// Wrap in function with apply to correctly bind the FormData context, as a direct call would result in an illegal invocation error
if (typeof target[name] === 'function') {
@@ -3144,6 +3148,13 @@ var htmx = (function() {
deleteProperty: function(target, name) {
target.delete(name)
return true
+ },
+ // Support Object.assign call from proxy
+ ownKeys: function(target) {
+ return Reflect.ownKeys(Object.fromEntries(target))
+ },
+ getOwnPropertyDescriptor: function(target, prop) {
+ return Reflect.getOwnPropertyDescriptor(Object.fromEntries(target), prop)
}
})
}