mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 13:31:06 +00:00
Support JSON.stringify & Object.assign on FormData proxy
This commit is contained in:
parent
cb8fa85ae7
commit
07ce511ae6
11
src/htmx.js
11
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user