Skip to content

tag-helpers: reject hand-written attributes that the Tag Helpers render - #115

Merged
rameel merged 2 commits into
mainfrom
tag-helpers/reject-hand-written-attributes
Oct 29, 2026
Merged

rameel merged 2 commits into
mainfrom
tag-helpers/reject-hand-written-attributes

Conversation

@rameel

@rameel rameel commented Oct 29, 2026

Copy link
Copy Markdown
Owner

No description provided.

hx-val-*, hx-header-*, and hx-request-* silently replaced a hand-written
hx-vals, hx-headers, hx-request, or hx-config on the same element, so
its values were lost without a warning. On HTMX 4.x, a hand-written
attribute and a generated one with modifiers were both rendered.

The Tag Helpers now throw InvalidOperationException, as the URL Tag
Helper and the built-in Anchor, Form, and Form Action Tag Helpers do
when asp-* attributes would replace href, action, or formaction. The
check does not depend on the bound values, so a conflict in the markup
fails on the first render rather than only for some data.
@rameel
rameel merged commit 0b6dccc into main Oct 29, 2026
1 check passed
@rameel
rameel deleted the tag-helpers/reject-hand-written-attributes branch October 29, 2026 10:50
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