Skip to content
  • Sean Doyle's avatar
    7503ef94
    Escape HTML attributes for ERB interpolation (#40657) · 7503ef94
    Sean Doyle authored
    
    
    Transforms a Hash into HTML Attributes, ready to be interpolated into
    ERB.
    
    ```html+erb
    <input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
    <%# => <input type="text" aria-label="Search"> %>
    ```
    
    Utilizes the `ActionView::Helpers::TagHelper#tag_options` implementation
    to enable combining ERB with attribute transformation, without requiring
    templates to replace HTML strings with `tag` or `content_tag`
    invocations.
    
    Co-authored-by: default avatarDavid Heinemeier Hansson <david@loudthinking.com>
    7503ef94
    Escape HTML attributes for ERB interpolation (#40657)
    Sean Doyle authored
    
    
    Transforms a Hash into HTML Attributes, ready to be interpolated into
    ERB.
    
    ```html+erb
    <input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
    <%# => <input type="text" aria-label="Search"> %>
    ```
    
    Utilizes the `ActionView::Helpers::TagHelper#tag_options` implementation
    to enable combining ERB with attribute transformation, without requiring
    templates to replace HTML strings with `tag` or `content_tag`
    invocations.
    
    Co-authored-by: default avatarDavid Heinemeier Hansson <david@loudthinking.com>
Loading