Skip to content

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

@jf

Description

@jf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions