Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ version explicitly. Each configuration type follows the names used by that HTMX
and 2.x expose `DefaultSwapStyle` and `Timeout`, while HTMX 4.x exposes `DefaultSwap` and
`DefaultTimeout`. Selecting different versions in the same configuration throws an exception.

HTMX 4.x is currently in beta. To target it, select it explicitly:
To target HTMX 4.x, select it explicitly:

```csharp
builder.Services.AddHtmxToolkit(options => options.UseHtmxV4());
Expand Down
10 changes: 7 additions & 3 deletions src/Ramstack.HtmxToolkit/Configuration/HtmxV4Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ public HtmxSwap? DefaultSwap
}

/// <summary>
/// Gets or sets a value indicating whether an empty response body replaces the main swap target.
/// The HTMX default is <c>undefined</c>.
/// Gets or sets a value indicating whether the main swap is performed
/// when the response contained only out-of-band elements.
/// <c>&lt;hx-partial&gt;</c> content always prevents the main swap.
/// The HTMX default is <see langword="false" /> and can be overridden
/// using the <c>swapEmpty</c> modifier on <c>hx-swap</c>.
/// </summary>
public bool? DefaultSwapEmpty
[JsonPropertyName("allowEmptySwapAfterOOB")]
public bool? AllowEmptySwapAfterOob
{
get;
set => SetField(ref field, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public async Task ProcessAsync_SerializesOnlyHtmx4Options()
htmx.MetaCharacter = "-";
htmx.History = HtmxHistoryMode.Reload;
htmx.DefaultSwap = HtmxSwap.OuterMorph;
htmx.DefaultSwapEmpty = true;
htmx.AllowEmptySwapAfterOob = true;
htmx.DefaultSettleDelay = 1;
htmx.IncludeIndicatorCss = false;
htmx.IndicatorClass = "indicator";
Expand All @@ -273,7 +273,7 @@ public async Task ProcessAsync_SerializesOnlyHtmx4Options()

Assert.That(json.Keys, Is.EquivalentTo(new[]
{
"logAll", "prefix", "metaCharacter", "history", "defaultSwap", "defaultSwapEmpty",
"logAll", "prefix", "metaCharacter", "history", "defaultSwap", "allowEmptySwapAfterOOB",
"defaultSettleDelay", "includeIndicatorCSS", "indicatorClass", "requestClass",
"inlineScriptNonce", "extensions", "implicitInheritance", "defaultTimeout", "mode",
"defaultFocusScroll", "transitions", "morphIgnore", "morphSkip", "morphSkipChildren",
Expand Down
Loading