Skip to content

class-attribute is reordered when using .foo and (class="foo") #306

@mrcljx

Description

@mrcljx

I was confused by this output when I tried to use jquery-tmpl conditions in the class:

# .a(class="{{if x}}{{/if}}")
Haml::Engine.new('.a(class="{{if x}}{{/if}}")').to_html
#=> "<div class='a x}}{{/if}} {{if'></div>\n"

# %div(class="a {{if x}}{{/if}}")
Haml::Engine.new('%div(class="a {{if x}}{{/if}}")').to_html
#=> "<div class='a {{if x}}{{/if}}'></div>\n"

The current behavior prevents duplicate classes (.foo(class="foo")) but it would be better just to leave the class-attribute order untouched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions