Can haml render <input type="text" required>

haml, html, ruby-on-rails

Solution

If the value of an attribute is a boolean, e.g.

%input{:type=>"text", :required => true}

it will be rendered as either

<input required type='text'>

if the `format` option is `:html4` or `:html5`, or as

<input required='required' type='text' />

if the format is `:xhtml`.

If the value is false, it will be omitted altogether:

<input type='text' />

Problem

Haml can render ``` %input{:type=>"text"} ``` as ``` <input type="text"> ``` Wonder what it should be in haml so it's rendered in html as ``` <input type="text" required> ``` Thanks

Original source