Remove wrapper div from hidden rails

I was wondering if I could remove the div wrapper from the Rails hidden inputs that are automatically generated in the forms?

The reason is that it gives me a “B” in my ySlow report and tells me to avoid CSS expressions. I know this little thing really doesn't matter for performance, but I would like to know if this is possible.

Grade B on Avoid CSS expressions There is a total of 1 expression inline <style> tag #1 (1 expression) <form accept-charset="UTF-8" action="/site/search" method="get"> <div style="margin:0;padding:0;display:inline"> <input name="utf8" type="hidden" value="&#x2713;" /> </div ... 
+4
source share
2 answers

Surround div tag removed in Rails 4.2

+1
source

The form helper reference

This div is important because the form cannot be submitted successfully without it. The first input element with the name utf8 forces browsers to correctly observe the character encoding of the forms and is generated for all forms, whether their actions are "GET" or "POST".

If you delete it, the form will not function properly.

By the way, the so-called CSS inline is the main style. YSlow is just a tool used by man. If you need to do something, just do it.

0
source

Source: https://habr.com/ru/post/1479247/


All Articles