Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rum does not officially support non-symbol attributes, and thus officially precludes certain classes of attributes from being generated #265

Open
jf opened this issue Oct 1, 2024 · 0 comments

Comments

@jf
Copy link

jf commented Oct 1, 2024

As per https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#090, Starting with 0.9.0, Rum will adopt “There’s Only One Way To Do It” policy. All attributes MUST be specified as kebab-cased keywords:. This is fine for your typical tag attribute; but results in issues with some other attributes like Alpine.js uses:

":"-prefixed attributes

[:div {::class "open ? '' : 'hidden'"}]
-> produces <div></div>

"@"-prefixed attributes

[:div {:@mouseenter "alert('Hello!')"}] gives an error

Having said all this, it would appear that giving the required attributes in string form works:

[:div {":class" "open ? '' : 'hidden'"}]
-> produces <div :class="open ? &#x27;&#x27; : &#x27;hidden&#x27;"></div> (let's ignore the escaping of the attribute value for now)

[:div {"@mouseenter" "alert('Hello!')"}]
-> produces <div @mouseenter="alert(&#x27;Hello!&#x27;)"></div> (similarly let's ignore the escaping of the attribute value for now; I will file another issue for that)

I believe that officially supporting the string form for these use cases is the way to go, and if so, it would be good to note this down in the README.

@jf jf changed the title rum does not officially support non-symbol attributes rum does not officially support non-symbol attributes, and thus officially precludes some attributes from being generated Oct 1, 2024
@jf jf changed the title rum does not officially support non-symbol attributes, and thus officially precludes some attributes from being generated rum does not officially support non-symbol attributes, and thus officially precludes certain classes of attributes from being generated Oct 1, 2024
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

No branches or pull requests

1 participant