bigskysoftware / bigskysoftware/htmx

`hx-on::` does not work in form if form has child input with name `attributes`

Open
#2,202 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

As stated in the title, using `hx-on::` to add event listeners for htmx events does not work in forms which have child (or, more generally, descendant) inputs with the `name="attributes"`.

Example ([jsfiddle](https://jsfiddle.net/b97zhokf/27/)):
```html


Try it out!

```

Not sure of the full impact of this; for now only noticed it on `hx-on::`. Reproducible on Firefox & Chrome.

I believe the issue may be that when calling `form.attributes` where `form` is a form element which contains inputs named `attributes`, instead of the usual `NamedNodeMap` of attributes of the form element returned, an `HTMLInputElement` of the `attributes` input is returned (or a `RadioNodeList` if there are more that one such inputs). This behaviour can also be seen on the console of the above jsfiddle.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.