Skip to content

fix!: attrs like hx-vals not respecting disinherit - #3952

Open
alirezaalavi87 wants to merge 1 commit into
bigskysoftware:devfrom
alirezaalavi87:fix/disinherit
Open

fix!: attrs like hx-vals not respecting disinherit#3952
alirezaalavi87 wants to merge 1 commit into
bigskysoftware:devfrom
alirezaalavi87:fix/disinherit

Conversation

@alirezaalavi87

Copy link
Copy Markdown

Description

  • All attributes including hx-vals now respect hx-disinherit and htmx.config.disableInheritance
  • Write tests
  • This is a breaking change since some people might have relied on the previous behavior of not respecting disinherit for those attrs

Corresponding issue: #1119

Testing

Manual testing:

I created a sample project and imported this updated htmx.js into it, and tested with such code snippets:

    <div hx-vals='{"foo": "bar"}' hx-confirm="fo sho?" hx-disinherit="hx-vals">
      <button hx-get="/test.html">click</button>
    </div>

Automated tests:

Added new tests with playwrite, testing the fixed issue and verifying that hx-vals respects disinheritance, both by configuration and by hx-disinherit on parent nodes.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

NOTE:
I used LLMs to help me understand the issue and write the tests and fixes. I spent ~2 hours reviewing and nitpicking on the changes and understanding them. I am not much aware of the internal workings of HTMX so there might be some things that I'm missing. But the previous tests and the new tests all passed. I tried my best for this to be high quality.

- All attributes including hx-vals now respect hx-disinherit and
htmx.config.disableInheritance
- Write tests
- This is a breaking change since some people might have relied on the
previous behavior of not respecting disinherit for those attrs
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

Successfully merging this pull request may close these issues.

1 participant