cult hero wrote:
> So, I use a form helper and it works nicely. Then I look at the code
> and I find myself somewhat annoyed:
>
> <div style="margin:0;padding:0;display:inline"><input name="_method"
> type="hidden" value="put" /><input name="authenticity_token"
> type="hidden" value="xxx" /></div>
>
> I obviously have no issue with hidden inputs, but WHY OH WHY are they
> inside a completely unnecessary div with completely unnecessary INLINE
> css?
Well for one thing, the <div> is not "completely unnecessary." The HTML
will not validate without it (or some other valid element. <input> tags
are now allowed to be direct children of <form> tags.
Output from W3C HTML validator:
---
Line 11, Column 52: document type does not allow element "input" here;
missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p",
"div", "address", "fieldset" start-tag
<input type="hidden" name="_method" value="put">
✉
The mentioned element is not allowed to appear in the context in which
you've placed it; the other mentioned elements are the only ones that
are both allowed there and can contain the element mentioned. This might
mean that you need a containing element, or possibly that you've
forgotten to close a previous element.
One possible cause for this message is that you have attempted to put a
block-level element (such as "<p>" or "<table>") inside an inline
element (such as "<a>", "<span>", or "<font>").
---
As for the inline style, I'm not sure if all that is necessary, but I'd
venture to guess that Rails might be using some shared code in order to
be more reusable. Having the extra styles doesn't really hurt anything
anyway AFAIK.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.