In Rails, is it possible to create a HTML 5 valueless attribute using any of the ActionView Helpers? I\'m trying to create the HTML 5 itemprop microdata for google\'s BreadC
No, you can't. Rails' tag helper defines a ActionView::Helpers::TagHelper::BOOLEAN_ATTRIBUTES array, and any attributes in that array will be outputted as key=key, so if you had, say, tag(:input, :type => :checkbox, :checked => true), the output should be .
I presume that this parses properly, since an XML parser is simply going to check for the presence of the attribute, so any value should work.
To that end, you could use:
content_tag(:div, "somecontent", :itemscope => "itemscope", :item_type ...
This will output itemscope="itemscope" in the tag, but it should result in the same desired effect when parsed.
Alternately, you could add itemscope to the BOOLEAN_ATTRIBUTES, then specify :itemscope => true.