Skip to content

Parser: action_view_helpers doesn't properly convert [hidden] for ERB expressions #2019

Description

@marcoroth
<%= tag.div hidden: a != b do %>
  Content
<% end %>

Gets converted to:

<div hidden="<%= a != b %>">
  Content
</div>

I think it would have to be something like this, since only the presence of hidden is relevant.

<div <% if a != b %> hidden <% end %>>
  Content
</div>

There are probably a few more boolean attributes, like required, selected and similar. Though. the follow converts properly:

<%= tag.div hidden: true do %>
  Content
<% end %>

<%= tag.div hidden: false do %>
  Content
<% end %>

to

<div hidden>
  Content
</div>

<div>
  Content
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    action-view-helpersAction View helper support and metadatabugSomething isn't workingparserHTML+ERB parser

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions