mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-04 00:05:20 +00:00
support hx-swap="none"
fixes https://github.com/bigskysoftware/htmx/issues/89
This commit is contained in:
parent
5e8fbb2956
commit
4ef719e63a
@ -483,6 +483,8 @@ return (function () {
|
|||||||
|
|
||||||
function swap(swapStyle, elt, target, fragment, settleInfo) {
|
function swap(swapStyle, elt, target, fragment, settleInfo) {
|
||||||
switch (swapStyle) {
|
switch (swapStyle) {
|
||||||
|
case "none":
|
||||||
|
return;
|
||||||
case "outerHTML":
|
case "outerHTML":
|
||||||
swapOuterHTML(target, fragment, settleInfo);
|
swapOuterHTML(target, fragment, settleInfo);
|
||||||
return;
|
return;
|
||||||
|
@ -246,7 +246,6 @@ describe("hx-swap attribute", function(){
|
|||||||
}, 30);
|
}, 30);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('swap outerHTML properly w/ data-* prefix', function()
|
it('swap outerHTML properly w/ data-* prefix', function()
|
||||||
{
|
{
|
||||||
this.server.respondWith("GET", "/test", '<a id="a1" data-hx-get="/test2">Click Me</a>');
|
this.server.respondWith("GET", "/test", '<a id="a1" data-hx-get="/test2">Click Me</a>');
|
||||||
@ -262,5 +261,14 @@ describe("hx-swap attribute", function(){
|
|||||||
byId("a1").innerHTML.should.equal('Clicked!');
|
byId("a1").innerHTML.should.equal('Clicked!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('swap none works properly', function()
|
||||||
|
{
|
||||||
|
this.server.respondWith("GET", "/test", 'Ooops, swapped');
|
||||||
|
|
||||||
|
var div = make('<div hx-swap="none" hx-get="/test">Foo</div>')
|
||||||
|
div.click();
|
||||||
|
this.server.respond();
|
||||||
|
div.innerHTML.should.equal('Foo');
|
||||||
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -302,6 +302,7 @@ with any of the following values:
|
|||||||
| `beforebegin` | prepends the content before the target in the targets parent element
|
| `beforebegin` | prepends the content before the target in the targets parent element
|
||||||
| `beforeend` | appends the content after the last child inside the target
|
| `beforeend` | appends the content after the last child inside the target
|
||||||
| `afterend` | appends the content after the target in the targets parent element
|
| `afterend` | appends the content after the target in the targets parent element
|
||||||
|
| `none` | does not append content from respons (out of band items will still be processed)
|
||||||
|
|
||||||
#### <a name="oob_swaps"></a>[Out of Band Swaps](#oob_swaps)
|
#### <a name="oob_swaps"></a>[Out of Band Swaps](#oob_swaps)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user