Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track htmx v2 - htmxor should support v2 #11

Open
4 tasks
egil opened this issue Jan 27, 2024 · 2 comments
Open
4 tasks

Track htmx v2 - htmxor should support v2 #11

egil opened this issue Jan 27, 2024 · 2 comments

Comments

@egil
Copy link
Owner

egil commented Jan 27, 2024

While there is only an alpha release of htmx, it makes sense that htmxor supports it. Depending on htmx release cadance, it may even be the default.

https://v2-0v2-0.htmx.org/migration-guide-htmx-1/


These are changes that likely impact htmxor directly:

  • htmx now includes head tag merging functionality out of the box
  • Attribute inheritance can now be disabled entirely via the htmx.config.disableInheritance config variable
  • Response code handling is now configurable via the htmx.config.responseHandling config variable
  • DELETE requests now use parameters, rather than form encoded bodies, for their payload (This is in accordance w/ the spec.)
@egil
Copy link
Owner Author

egil commented Apr 30, 2024

Code for passing response handling in htmxconfig:

public partial record HtmxConfig
{
    [JsonPropertyName("responseHandling")]
    public IList<ResponseHandlingRule>? ResponseHandling { get; set; }
}

public record class ResponseHandlingRule
{
    public required string Code { get; set; }

    public bool Swap { get; set; }

    public bool? Error { get; set; }

    public bool? IgnoreTitle { get; set; }

    public string? Select { get; set; }

    public string? Target { get; set; }

    public string? SwapOverride { get; set; }
}

@egil
Copy link
Owner Author

egil commented Apr 30, 2024

New swap style:

public enum SwapStyle
{
    /// <summary>
    /// Replace the text content of the target element, without parsing the response as HTML.
    /// </summary>
    /// <remarks>
    /// NOTE: Available in Htmx version 2 and later.
    /// </remarks>
    TextContent
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant