Permalink
Browse files

Switched to use `display:none` in extra_tags_for_form method.

The use of `display:inline` with the content_tag call in the
extra_tags_for_form method potentially causes display issues with some
browsers, namely Internet Explorer. IE's behaviour of not collapsing
the line height on divs with ostensibly no content means that the
automatically added div containing the hidden authenticity_token, utf8
and _method form input tags may interfere with other visible form
elements in certain circumstances. The use of `display:none` rather
than `display:inline` fixes this problem.

Closes #6403.
  • Loading branch information...
1 parent 9dbcaeb commit d5f6fdbcbbd40b5660879f54705efb5eb7fc1c8e @gaelian committed Jun 3, 2012
@@ -55,7 +55,7 @@ module Helpers
# The HTML generated for this would be (modulus formatting):
#
# <form action="/people" class="new_person" id="new_person" method="post">
- # <div style="margin:0;padding:0;display:inline">
+ # <div style="margin:0;padding:0;display:none">
# <input name="authenticity_token" type="hidden" value="NrOp5bsjoLRuK8IW5+dQEYjKGUJDe7TQoZVvq95Wteg=" />
# </div>
# <label for="person_first_name">First name</label>:
@@ -85,7 +85,7 @@ module Helpers
# the code above as is would yield instead:
#
# <form action="/people/256" class="edit_person" id="edit_person_256" method="post">
- # <div style="margin:0;padding:0;display:inline">
+ # <div style="margin:0;padding:0;display:none">
# <input name="_method" type="hidden" value="put" />
# <input name="authenticity_token" type="hidden" value="NrOp5bsjoLRuK8IW5+dQEYjKGUJDe7TQoZVvq95Wteg=" />
# </div>
@@ -323,7 +323,7 @@ def convert_to_model(object)
# The HTML generated for this would be:
#
# <form action='http://www.example.com' method='post' data-remote='true'>
- # <div style='margin:0;padding:0;display:inline'>
+ # <div style='margin:0;padding:0;display:none'>
# <input name='_method' type='hidden' value='put' />
# </div>
# ...
@@ -705,7 +705,7 @@ def extra_tags_for_form(html_options)
end
tags = utf8_enforcer_tag << method_tag
- content_tag(:div, tags, :style => 'margin:0;padding:0;display:inline')
+ content_tag(:div, tags, :style => 'margin:0;padding:0;display:none')
end
def form_tag_html(html_options)
@@ -2654,7 +2654,7 @@ def initialize(object_name, object, template, options, block)
protected
def hidden_fields(method = nil)
- txt = %{<div style="margin:0;padding:0;display:inline">}
+ txt = %{<div style="margin:0;padding:0;display:none">}
txt << %{<input name="utf8" type="hidden" value="&#x2713;" />}
if method && !method.to_s.in?(['get', 'post'])
txt << %{<input name="_method" type="hidden" value="#{method}" />}
@@ -14,7 +14,7 @@ def setup
def hidden_fields(options = {})
method = options[:method]
- txt = %{<div style="margin:0;padding:0;display:inline">}
+ txt = %{<div style="margin:0;padding:0;display:none">}
txt << %{<input name="utf8" type="hidden" value="&#x2713;" />}
if method && !method.to_s.in?(['get','post'])
txt << %{<input name="_method" type="hidden" value="#{method}" />}

0 comments on commit d5f6fdb

Please sign in to comment.