Проверяя на валидность документ я обнаружил, что конструкция вида <form action="#"><input type="button" /></form> считается невалидной с точки зрения валидатора, при указании типа документа XHTML 1.0 Strict или выше. И очень просит для себя таблетку в виде обертки контрола в теги вроде div, h1-h6, p и т. д.
Вот что выдает валидатор на простецкую формочку:
# Error Line 9, Column 39: 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.<form action="#"><input type="button" /></form>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>").
Валидной форма считается только та, контролы которой обернуты хотя бы одним из перечисленных тегов. А в xhtml1-strict.dtd написано:
<!--=================== Text Elements ====================================--><!ENTITY % special.pre "br | span | bdo | map"><!ENTITY % special "%special.pre; | object | img "><!ENTITY % fontstyle "tt | i | b | big | small "><!ENTITY % phrase "em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup "><!ENTITY % inline.forms "input | select | textarea | label | button"><!-- these can occur at block or inline level --> <!ENTITY % misc.inline "ins | del | script"><!-- these can only occur at block level --> <!ENTITY % misc "noscript | %misc.inline;"><!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"><!-- %Inline; covers inline or "text-level" elements --> <!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"><!--================== Block level elements ==============================--><!ENTITY % heading "h1|h2|h3|h4|h5|h6"> <!ENTITY % lists "ul | ol | dl"> <!ENTITY % blocktext "pre | hr | blockquote | address"><!ENTITY % block "p | %heading; | div | %lists; | %blocktext; | fieldset | table"><!ENTITY % Block "(%block; | form | %misc;)*"><!-- %Flow; mixes block and inline and is used for list items etc. --> <!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"><!--================== Content models for exclusions =====================--><!-- a elements use %Inline; excluding a --><!ENTITY % a.content "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"><!-- pre uses %Inline excluding big, small, sup or sup --><!ENTITY % pre.content "(#PCDATA | a | %fontstyle; | %phrase; | %special.pre; | %misc.inline; | %inline.forms;)*"><!-- form uses %Block; excluding form --><!ENTITY % form.content "(%block; | %misc;)*"><!-- button uses %Flow; but excludes a, form and form controls --><!ENTITY % button.content "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | table | %special; | %fontstyle; | %phrase; | %misc;)*">
То есть форма считается блоковым элементом а контрол — строчным, а не наоборот. Я, быть может, не так все понимаю, но это ошибка валидатора. Повнимательней почитал этот документ и узрел, что внутри формы находиться могут только блочные элементы, по крайней мере мне это кажется странным.
Вот что мне выдал HTML Tidy:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<title></title>
</head>
<body>
<form action="#"><input type="button" /></form>
</body>
</html>
После этого можно думать, стоит ли доверять валидатору. Валидатору оказалось верить можно, но все равно какая то неразбериха.