diff --git a/README.md b/README.md
index c1bd07f..6f007f2 100644
--- a/README.md
+++ b/README.md
@@ -325,7 +325,6 @@ For example, values declared on a parent element can be inherited by its childre
```
-When `HtmxV4Config.MetaCharacter` is configured, that character is used instead of `:` in the generated attribute name.
Alternatively, set `HtmxV4Config.ImplicitInheritance` to `true` to enable inheritance globally.
For HTMX 1.9.x and 2.x, the Tag Helper attributes above do not change the generated attribute names.
diff --git a/src/Ramstack.HtmxToolkit/Configuration/HtmxV4Config.cs b/src/Ramstack.HtmxToolkit/Configuration/HtmxV4Config.cs
index b910914..1d3f80d 100644
--- a/src/Ramstack.HtmxToolkit/Configuration/HtmxV4Config.cs
+++ b/src/Ramstack.HtmxToolkit/Configuration/HtmxV4Config.cs
@@ -30,16 +30,6 @@ public string? Prefix
set => SetField(ref field, value);
}
- ///
- /// Gets or sets the character used instead of : in attribute names.
- /// The HTMX default is undefined.
- ///
- public string? MetaCharacter
- {
- get;
- set => SetField(ref field, value);
- }
-
///
/// Gets or sets how HTMX history restoration is handled.
/// The HTMX default is .
diff --git a/src/Ramstack.HtmxToolkit/TagHelpers/HtmxHeaderTagHelper.cs b/src/Ramstack.HtmxToolkit/TagHelpers/HtmxHeaderTagHelper.cs
index 6190d6d..7f56aff 100644
--- a/src/Ramstack.HtmxToolkit/TagHelpers/HtmxHeaderTagHelper.cs
+++ b/src/Ramstack.HtmxToolkit/TagHelpers/HtmxHeaderTagHelper.cs
@@ -59,12 +59,7 @@ public override Task ProcessAsync(TagHelperContext context, TagHelperOutput outp
{
var name = "hx-headers";
if (Inherited && options.Value.TargetVersion == HtmxTargetVersion.V4)
- {
- if (options.Value.HtmxConfig is HtmxV4Config config)
- name = string.IsNullOrEmpty(config.MetaCharacter)
- ? "hx-headers:inherited"
- : $"hx-headers{config.MetaCharacter}inherited";
- }
+ name = "hx-headers:inherited";
var info = HtmxDictionaryJsonSerializerContext.Default.IDictionaryStringString;
var json = JsonSerializer.Serialize(Headers, info);
diff --git a/src/Ramstack.HtmxToolkit/TagHelpers/HtmxRequestTagHelper.cs b/src/Ramstack.HtmxToolkit/TagHelpers/HtmxRequestTagHelper.cs
index ce67c78..bf906ac 100644
--- a/src/Ramstack.HtmxToolkit/TagHelpers/HtmxRequestTagHelper.cs
+++ b/src/Ramstack.HtmxToolkit/TagHelpers/HtmxRequestTagHelper.cs
@@ -164,22 +164,12 @@ public override Task ProcessAsync(TagHelperContext context, TagHelperOutput outp
if (json != "{}")
{
- var name = "hx-request";
-
- if (options.Value.TargetVersion == HtmxTargetVersion.V4)
+ var name = options.Value.TargetVersion switch
{
- if (Inherited)
- {
- if (options.Value.HtmxConfig is HtmxV4Config config)
- name = string.IsNullOrEmpty(config.MetaCharacter)
- ? "hx-config:inherited"
- : $"hx-config{config.MetaCharacter}inherited";
- }
- else
- {
- name = "hx-config";
- }
- }
+ HtmxTargetVersion.V4 when Inherited => "hx-config:inherited",
+ HtmxTargetVersion.V4 => "hx-config",
+ _ => "hx-request"
+ };
output.Attributes.SetAttribute(
new TagHelperAttribute(name, new HtmlString(json), HtmlAttributeValueStyle.SingleQuotes));
diff --git a/src/Ramstack.HtmxToolkit/TagHelpers/HtmxValsTagHelper.cs b/src/Ramstack.HtmxToolkit/TagHelpers/HtmxValsTagHelper.cs
index 09b0342..966399c 100644
--- a/src/Ramstack.HtmxToolkit/TagHelpers/HtmxValsTagHelper.cs
+++ b/src/Ramstack.HtmxToolkit/TagHelpers/HtmxValsTagHelper.cs
@@ -59,10 +59,7 @@ public override Task ProcessAsync(TagHelperContext context, TagHelperOutput outp
{
var name = "hx-vals";
if (Inherited && options.Value.TargetVersion == HtmxTargetVersion.V4)
- if (options.Value.HtmxConfig is HtmxV4Config config)
- name = string.IsNullOrEmpty(config.MetaCharacter)
- ? "hx-vals:inherited"
- : $"hx-vals{config.MetaCharacter}inherited";
+ name = "hx-vals:inherited";
var info = HtmxDictionaryJsonSerializerContext.Default.IDictionaryStringString;
var json = JsonSerializer.Serialize(values, info);
diff --git a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxConfigTagHelperTests.cs b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxConfigTagHelperTests.cs
index 3ff36d1..73f419f 100644
--- a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxConfigTagHelperTests.cs
+++ b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxConfigTagHelperTests.cs
@@ -247,7 +247,6 @@ public async Task ProcessAsync_SerializesOnlyHtmx4Options()
{
htmx.LogAll = true;
htmx.Prefix = "data-custom-";
- htmx.MetaCharacter = "-";
htmx.History = HtmxHistoryMode.Reload;
htmx.DefaultSwap = HtmxSwap.OuterMorph;
htmx.AllowEmptySwapAfterOob = true;
@@ -273,7 +272,7 @@ public async Task ProcessAsync_SerializesOnlyHtmx4Options()
Assert.That(json.Keys, Is.EquivalentTo(new[]
{
- "logAll", "prefix", "metaCharacter", "history", "defaultSwap", "allowEmptySwapAfterOOB",
+ "logAll", "prefix", "history", "defaultSwap", "allowEmptySwapAfterOOB",
"defaultSettleDelay", "includeIndicatorCSS", "indicatorClass", "requestClass",
"inlineScriptNonce", "extensions", "implicitInheritance", "defaultTimeout", "mode",
"defaultFocusScroll", "transitions", "morphIgnore", "morphSkip", "morphSkipChildren",
diff --git a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxHeaderTagHelperTests.cs b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxHeaderTagHelperTests.cs
index d0bd639..a33ccb2 100644
--- a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxHeaderTagHelperTests.cs
+++ b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxHeaderTagHelperTests.cs
@@ -80,22 +80,6 @@ public async Task ProcessAsync_Htmx4_Inherited_UsesInheritedAttribute()
Assert.That(output.Attributes["hx-headers"], Is.Null);
}
- [Test]
- public async Task ProcessAsync_Htmx4_Inherited_UsesConfiguredMetaCharacter()
- {
- var output = TestHelper.CreateTagHelperOutput();
- var helper = CreateHelper(HtmxTargetVersion.V4, "-");
-
- helper.Inherited = true;
- helper.Headers["X-Custom"] = "value";
-
- await helper.ProcessAsync(TestHelper.CreateTagHelperContext(), output);
- var attribute = output.Attributes["hx-headers-inherited"];
-
- Assert.That(attribute!.Value.ToString(), Is.EqualTo("{\"X-Custom\":\"value\"}"));
- Assert.That(output.Attributes["hx-headers:inherited"], Is.Null);
- }
-
[Test]
public async Task ProcessAsync_Htmx4_NotInherited_UsesOrdinaryAttribute()
{
@@ -140,7 +124,7 @@ public async Task ProcessAsync_Htmx1_Htmx2_Inherited_UsesOrdinaryAttribute(HtmxT
Assert.That(output.Attributes["hx-inherit"], Is.Null);
}
- private static HtmxHeaderTagHelper CreateHelper(HtmxTargetVersion version = HtmxTargetVersion.V2, string? metachar = null)
+ private static HtmxHeaderTagHelper CreateHelper(HtmxTargetVersion version = HtmxTargetVersion.V2)
{
var options = new HtmxToolkitOptions();
@@ -153,7 +137,7 @@ private static HtmxHeaderTagHelper CreateHelper(HtmxTargetVersion version = Htmx
options.UseHtmxV2();
break;
case HtmxTargetVersion.V4:
- options.UseHtmxV4(config => config.MetaCharacter = metachar);
+ options.UseHtmxV4();
break;
default:
throw new ArgumentOutOfRangeException(nameof(version));
diff --git a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxRequestTagHelperTests.cs b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxRequestTagHelperTests.cs
index da19db9..8b6f4a0 100644
--- a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxRequestTagHelperTests.cs
+++ b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxRequestTagHelperTests.cs
@@ -193,22 +193,6 @@ public async Task ProcessAsync_Htmx4_Inherited_UsesInheritedAttribute()
Assert.That(output.Attributes["hx-config"], Is.Null);
}
- [Test]
- public async Task ProcessAsync_Htmx4_Inherited_UsesConfiguredMetaCharacter()
- {
- var output = TestHelper.CreateTagHelperOutput();
- var helper = CreateHelper(HtmxTargetVersion.V4, "-");
-
- helper.Inherited = true;
- helper.Timeout = 500;
-
- await helper.ProcessAsync(TestHelper.CreateTagHelperContext(), output);
- var attribute = output.Attributes["hx-config-inherited"];
-
- Assert.That(attribute!.Value.ToString(), Is.EqualTo("{\"timeout\":500}"));
- Assert.That(output.Attributes["hx-config:inherited"], Is.Null);
- }
-
[Test]
public async Task ProcessAsync_Htmx4_Inherited_WithImplicitInheritance_StillUsesInheritedAttribute()
{
@@ -269,7 +253,7 @@ public async Task ProcessAsync_Htmx1_Htmx2_Inherited_UsesOrdinaryAttribute(HtmxT
Assert.That(output.Attributes["hx-inherit"], Is.Null);
}
- private static HtmxRequestTagHelper CreateHelper(HtmxTargetVersion version, string? metachar = null, bool? implicitInheritance = null)
+ private static HtmxRequestTagHelper CreateHelper(HtmxTargetVersion version, bool? implicitInheritance = null)
{
var options = new HtmxToolkitOptions();
@@ -282,11 +266,7 @@ private static HtmxRequestTagHelper CreateHelper(HtmxTargetVersion version, stri
options.UseHtmxV2();
break;
case HtmxTargetVersion.V4:
- options.UseHtmxV4(config =>
- {
- config.MetaCharacter = metachar;
- config.ImplicitInheritance = implicitInheritance;
- });
+ options.UseHtmxV4(config => config.ImplicitInheritance = implicitInheritance);
break;
default:
throw new ArgumentOutOfRangeException(nameof(version));
diff --git a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxValsTagHelperTests.cs b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxValsTagHelperTests.cs
index 8df9878..f57ffcf 100644
--- a/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxValsTagHelperTests.cs
+++ b/tests/Ramstack.HtmxToolkit.Tests/TagHelpers/HtmxValsTagHelperTests.cs
@@ -75,22 +75,6 @@ public async Task ProcessAsync_Htmx4_Inherited_UsesInheritedAttribute()
Assert.That(output.Attributes["hx-vals"], Is.Null);
}
- [Test]
- public async Task ProcessAsync_Htmx4_Inherited_UsesConfiguredMetaCharacter()
- {
- var output = TestHelper.CreateTagHelperOutput();
- var helper = CreateHelper(HtmxTargetVersion.V4, "-");
-
- helper.Inherited = true;
- helper.Values["sort"] = "title";
-
- await helper.ProcessAsync(TestHelper.CreateTagHelperContext(), output);
- var attribute = output.Attributes["hx-vals-inherited"];
-
- Assert.That(attribute!.Value.ToString(), Is.EqualTo("{\"sort\":\"title\"}"));
- Assert.That(output.Attributes["hx-vals:inherited"], Is.Null);
- }
-
[Test]
public async Task ProcessAsync_Htmx4_NotInherited_UsesOrdinaryAttribute()
{
@@ -135,7 +119,7 @@ public async Task ProcessAsync_Htmx1_Htmx2_Inherited_UsesOrdinaryAttribute(HtmxT
Assert.That(output.Attributes["hx-inherit"], Is.Null);
}
- private static HtmxValsTagHelper CreateHelper(HtmxTargetVersion version = HtmxTargetVersion.V2, string? metachar = null)
+ private static HtmxValsTagHelper CreateHelper(HtmxTargetVersion version = HtmxTargetVersion.V2)
{
var options = new HtmxToolkitOptions();
@@ -148,7 +132,7 @@ private static HtmxValsTagHelper CreateHelper(HtmxTargetVersion version = HtmxTa
options.UseHtmxV2();
break;
case HtmxTargetVersion.V4:
- options.UseHtmxV4(config => config.MetaCharacter = metachar);
+ options.UseHtmxV4();
break;
default:
throw new ArgumentOutOfRangeException(nameof(version));