mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-29 22:11:22 +00:00
add new swap method to 2.0 migration guide
This commit is contained in:
parent
f595858ba3
commit
b454d46950
@ -30,7 +30,20 @@ We place a very high value on backwards compatibility, so in most cases this mig
|
||||
* The `htmx.makeFragment()` method now **always** returns a `DocumentFragment` rather than either an `Element` or `DocumentFragment`
|
||||
* If you are using htmx in a module setting, we now provide module-type specific files for all three of the major
|
||||
JavaScript module types: `/dist/htmx.esm.js`, `/dist/htmx.umd.js` & `/dist/htmx.amd.js`
|
||||
* htmx 2.0 offers automatic head merging with boosted links. If you do not want this behavior, set you can set `htmx.config.head.boosted` to `"none"`
|
||||
* htmx 2.0 offers automatic head merging with boosted links. If you do not want this behavior, you can set `htmx.config.head.boosted` to `"none"`
|
||||
* If you are an extension author and your extension was using `selectAndSwap` method from internal API, it was removed and replaced with `swap` method,
|
||||
which is available from both internal and public htmx APIs
|
||||
|
||||
To do swap using new method, you need to simply use
|
||||
|
||||
```js
|
||||
let content = "<div>Hello world</div>"; // this is HTML that will be swapped into target
|
||||
let target = api.getTarget(child);
|
||||
let swapSpec = api.getSwapSpecification(child);
|
||||
api.swap(target, content, swapSpec);
|
||||
```
|
||||
|
||||
`swap` method documentation is available on [JS API Reference](/api/#swap)
|
||||
|
||||
IE is no longer supported in htmx 2.0, but htmx 1.x continues to support IE and will be supported for the foreseeable future.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user