Currently the form data proxy has special handing for if the return value is a function,
but not in the case where the key is a symbol. This omission can cause an error to be thrown.
Fixes constructor for URLSearchParams:
element.addEventListener('htmx:configRequest', function(event) {
let params = new URLSearchParams(event.detail.parameters);
console.log(params.toString());
});
If I was implementing this from fresh then I would use the more concise:
if (typeof result === 'function') {
return result.bind(formData)
}
but instead I've replicated the existing approach:
if (typeof result === 'function') {
return function() {
return result.apply(formData, arguments)
}
}
Corresponding issue: #2995
Testing
Added a new test to the existing ones for parameters.
Checklist
[x] I have read the contribution guidelines
[x] I have targeted this PR against the correct branch (master for website changes, dev for
source changes)
[x] This is either a bugfix, a documentation update, or a new feature that has been explicitly
approved via an issue
[x] I ran the test suite locally (npm run test) and verified that it succeeded
Description
Currently the form data proxy has special handing for if the return value is a function, but not in the case where the key is a symbol. This omission can cause an error to be thrown.
Fixes constructor for URLSearchParams:
If I was implementing this from fresh then I would use the more concise:
but instead I've replicated the existing approach:
Corresponding issue: #2995
Testing
Added a new test to the existing ones for parameters.
Checklist
master
for website changes,dev
for source changes)npm run test
) and verified that it succeeded