Skip to content

hx-get behavior on empty value #2623

@daniboygg

Description

@daniboygg

The examples in documentation, like https://htmx.org/attributes/hx-get/, have always something like hx-get="/example".

In the notes section, there is no point about what happens when hx-get="". The current behavior is to make a request to the current URL. My guess is that the hx-get is similar to the action in the HTML spec, where majority of browsers will make the request to the current URL.

But, according to the spec, https://html.spec.whatwg.org/#attr-fs-action, this shouldn't be allowed:

The action and formaction content attributes, if specified, must have a value that is a valid non-empty URL potentially surrounded by spaces. (emphasis added)

Since the HTML 5 specification recommends that a valid non-empty URL is provided to action, for consistency, should HTMX make the same assumption?

I think it would be nice, at least, to have a point in the notes https://htmx.org/attributes/hx-get/ making clear hx-get="" make the request to the current URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions