From 940eec417f20e53abd3e3114c7fa845dac0d3a62 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Tue, 28 Jun 2016 03:18:05 -0700 Subject: Bring Boolean Attributes list for AV Tags helper upto speed with current spec. This is based on https://github.com/kangax/html-minifier/blob/6b2d4536d82819143b468b41a89c700b6c61631f/src/htmlminifier.js#L197 and spec from https://www.w3.org/TR/html51/single-page.html. Couple of other changes to tests due to support update: - autobuffer has been dropped in favour of preload attribute, ref: https://msdn.microsoft.com/en-us/library/ff974743(v=vs.85).aspx - pubdate attribute has been dropped from spec, ref: https://www.w3.org/html/wg/tracker/issues/185 --- actionview/lib/action_view/helpers/asset_tag_helper.rb | 4 ++-- actionview/lib/action_view/helpers/tag_helper.rb | 15 +++++++++------ actionview/test/template/asset_tag_helper_test.rb | 4 ++-- actionview/test/template/date_helper_test.rb | 4 ---- 4 files changed, 13 insertions(+), 14 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index 413c35954c..bcbb3db6a9 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -264,8 +264,8 @@ module ActionView # # => # video_tag("trailer.ogg") # # => - # video_tag("trailer.ogg", controls: true, autobuffer: true) - # # => + # video_tag("trailer.ogg", controls: true, preload: 'none') + # # => # video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png") # # => # video_tag("/trailers/hd.avi", size: "16x16") diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index 09923be568..8ee21fdf38 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -11,12 +11,15 @@ module ActionView include CaptureHelper include OutputSafetyHelper - BOOLEAN_ATTRIBUTES = %w(disabled readonly multiple checked autobuffer - autoplay controls loop selected hidden scoped async - defer reversed ismap seamless muted required - autofocus novalidate formnovalidate open pubdate - itemscope allowfullscreen default inert sortable - truespeed typemustmatch).to_set + BOOLEAN_ATTRIBUTES = %w(allowfullscreen async autofocus autoplay checked + compact controls declare default defaultchecked + defaultmuted defaultselected defer disabled + enabled formnovalidate hidden indeterminate inert + ismap itemscope loop multiple muted nohref + noresize noshade novalidate nowrap open + pauseonexit readonly required reversed scoped + seamless selected sortable truespeed typemustmatch + visible).to_set BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map(&:to_sym)) diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 8bfd19eb26..1a1b6f5e2d 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -238,7 +238,7 @@ class AssetTagHelperTest < ActionView::TestCase VideoLinkToTag = { %(video_tag("xml.ogg")) => %(), %(video_tag("rss.m4v", :autoplay => true, :controls => true)) => %(), - %(video_tag("rss.m4v", :autobuffer => true)) => %(), + %(video_tag("rss.m4v", :preload => 'none')) => %(), %(video_tag("gold.m4v", :size => "160x120")) => %(), %(video_tag("gold.m4v", "size" => "320x240")) => %(), %(video_tag("trailer.ogg", :poster => "screenshot.png")) => %(), @@ -288,7 +288,7 @@ class AssetTagHelperTest < ActionView::TestCase %(audio_tag("//media.rubyonrails.org/audio/rails_blog_2.mov")) => %(), %(audio_tag("audio.mp3", "audio.ogg")) => %(), %(audio_tag(["audio.mp3", "audio.ogg"])) => %(), - %(audio_tag(["audio.mp3", "audio.ogg"], :autobuffer => true, :controls => true)) => %() + %(audio_tag(["audio.mp3", "audio.ogg"], :preload => 'none', :controls => true)) => %() } FontPathToTag = { diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index 0f89f2ca09..3b4d4f42e5 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -3609,10 +3609,6 @@ class DateHelperTest < ActionView::TestCase assert_equal expected, time_tag(time) end - def test_time_tag_pubdate_option - assert_match(/.*<\/time>/, time_tag(Time.now, :pubdate => true)) - end - def test_time_tag_with_given_text assert_match(/Right now<\/time>/, time_tag(Time.now, 'Right now')) end -- cgit v1.2.3