mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
escape options for the stylesheet_link_tag method
This commit is contained in:
parent
6eaa9f0dad
commit
5ffa69793f
2 changed files with 5 additions and 1 deletions
|
@ -17,7 +17,7 @@ module ActionView
|
|||
|
||||
def asset_tag(source, options)
|
||||
# We force the :request protocol here to avoid a double-download bug in IE7 and IE8
|
||||
tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => ERB::Util.html_escape(path_to_asset(source, :protocol => :request)) }.merge(options), false, false)
|
||||
tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => path_to_asset(source, :protocol => :request) }.merge(options))
|
||||
end
|
||||
|
||||
def custom_dir
|
||||
|
|
|
@ -366,6 +366,10 @@ class AssetTagHelperTest < ActionView::TestCase
|
|||
assert stylesheet_link_tag('dir/other/file', 'dir/file2').html_safe?
|
||||
end
|
||||
|
||||
def test_stylesheet_link_tag_escapes_options
|
||||
assert_dom_equal %(<link href="/file.css" media="<script>" rel="stylesheet" type="text/css" />), stylesheet_link_tag('/file', :media => '<script>')
|
||||
end
|
||||
|
||||
def test_custom_stylesheet_expansions
|
||||
ENV["RAILS_ASSET_ID"] = ''
|
||||
ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :robbery => ["bank", "robber"]
|
||||
|
|
Loading…
Reference in a new issue