Skip to content

Support Vue/Alpine attribute shorthand syntax#42

Open
CasualX wants to merge 1 commit intomathiversen:masterfrom
CasualX:patches
Open

Support Vue/Alpine attribute shorthand syntax#42
CasualX wants to merge 1 commit intomathiversen:masterfrom
CasualX:patches

Conversation

@CasualX
Copy link
Copy Markdown

@CasualX CasualX commented Apr 17, 2026

This change allows attribute names to start with @ and :, so templates using Vue/Alpine-style shorthand can be parsed without failing.

Examples this enables:

  • @click="handler"
  • :class="classes"
  • :disabled="isDisabled"

Without this patch the elements are returned as text nodes.

I understand this crate is an HTML parser rather than framework-specific template syntax, so I wanted to check whether you'd be open to this kind of support upstream.

This PR only broadens accepted attribute key syntax. It does not add any framework-specific behavior or interpretation; it simply preserves these attributes in the parsed DOM while making the parser usable for real-world template syntax.

Browsers already accept these attribute names as ordinary attributes even when no framework runtime is present. I understand this raises the question whether it is better to support only @/: shorthands or to more broadly align attribute syntax accepted by browser HTML parsers, I would be happy to adjust the implementation accordingly!

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