Comments (3)
Checking how the tests for this are written, this looks like expected behavior, though the docs don't make it super clear... The expectation is that you would provide something like "js:header1: getValue()"
which as a whole would be evaluated and turned into the right format {"header1": "someReturnedValue"}
; Again assuming here, but this may be because headers are inherently key/value based.
If this isn't the expected behavior, I can make a PR update the tests and the method.
I do like the idea of passing in just a function call though, makes sense for passing collections of headers without extra JS cruft.
from htmx.
this looks like expected behavior, though the docs don't make it super clear
Yes, it could very well be that I try to use this incorrectly. Describing how to use this in the documentation could be a solution for this.
I do like the idea of passing in just a function call though
It seems that this is currently possible with the spread operator:
js:...createHeaders()
So this all seems to be versatile and function fine, except that the syntax in both js:...createHeaders()
and js:header1: getValue()
is not intuitive and not documented.
from htmx.
Created a PR to update the documentation and make JS evaluation work as expected where available through the underlying function: #2673
from htmx.
Related Issues (20)
- HTMX 2: title tag is not always updated HOT 1
- "Troublesome Tables" in documentation is unclear
- Newly Cloned Repo fails the Test command
- 2.0: TypeError: import_htmx.default.config is undefined when defining config programmatically HOT 4
- Websockets documentation link gives 404 error HOT 1
- htmx.logAll is not a function HOT 4
- `hx-disabled-elt` does not work with multiple parameterized selectors HOT 1
- more parameters included than before 2.0.0-alpha1 -> 2.0.0 HOT 7
- HTMX 2.0 with multiswap selectors after first not found HOT 2
- i got error :htmx:invalidPath for verifyPath HOT 2
- [Feature Request] Support base tag
- Confused about detail.successful and detail.failed for htmx:afterRequest HOT 3
- htmx:afterSwap is not fired in the extension. HOT 2
- BUG: pre-submit custom form validation not applied to radiobuttons and checkboxes HOT 3
- select-oob support for htmx.ajax()
- Websocket/SSE test server is not working
- Improvement on element focus when swapped, set css transitions to 0s.
- 2.0.0 json-enc loses multivalue keys HOT 1
- I don't find any way to stop request from htmx:beforeRequest listener HOT 2
- Option to use Document.parseHTMLUnsafe instead of DOMParser for parsing HTML? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmx.