Skip to content

Commit

Permalink
Merge pull request #10949 from alexpeattie/update_html_boolean_attrs
Browse files Browse the repository at this point in the history
Update HTML boolean attributes per the HTML 5.1 spec
  • Loading branch information
rafaelfranca committed Jun 15, 2013
2 parents fe01752 + a89bdc0 commit 3b7192d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
* Update the HTML `BOOLEAN_ATTRIBUTES` in `ActionView::Helpers::TagHelper`
to conform to the latest HTML 5.1 spec. Add attributes `allowfullscreen`,
`default`, `inert`, `sortable`, `truespeed`, `typemustmatch`. Fix attribute
`seamless` (previously misspelled `seemless`).

*Alex Peattie*

* Fix an issue where partials with a number in the filename weren't being digested for cache dependencies.

*Bryan Ricker*
Expand Down
7 changes: 5 additions & 2 deletions actionpack/lib/action_view/helpers/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ module TagHelper

BOOLEAN_ATTRIBUTES = %w(disabled readonly multiple checked autobuffer
autoplay controls loop selected hidden scoped async
defer reversed ismap seemless muted required
autofocus novalidate formnovalidate open pubdate itemscope).to_set
defer reversed ismap seamless muted required
autofocus novalidate formnovalidate open pubdate
itemscope allowfullscreen default inert sortable
truespeed typemustmatch).to_set

BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map {|attribute| attribute.to_sym })

PRE_CONTENT_STRINGS = {
Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/template/tag_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def test_tag_options_accepts_blank_option
end

def test_tag_options_converts_boolean_option
assert_equal '<p disabled="disabled" itemscope="itemscope" multiple="multiple" readonly="readonly" />',
tag("p", :disabled => true, :itemscope => true, :multiple => true, :readonly => true)
assert_dom_equal '<p disabled="disabled" itemscope="itemscope" multiple="multiple" readonly="readonly" allowfullscreen="allowfullscreen" seamless="seamless" typemustmatch="typemustmatch" sortable="sortable" default="default" inert="inert" truespeed="truespeed" />',
tag("p", :disabled => true, :itemscope => true, :multiple => true, :readonly => true, :allowfullscreen => true, :seamless => true, :typemustmatch => true, :sortable => true, :default => true, :inert => true, :truespeed => true)
end

def test_content_tag
Expand Down

0 comments on commit 3b7192d

Please sign in to comment.