|
Posted by Jukka K. Korpela on 01/23/08 11:13
Scripsit Toby A Inkster:
> <input> (and <textarea>, <button>) is an inline element, like <span>
> or <em>, so can be used in any context where inline content is
> allowed, which is virtually everywhere.
Well, not quite everywhere. Not in the document's head, and in Strict,
not in its body either. :-)
(Just kidding. But really, in Strict versions, <input> is not allowed
_directly_ inside <body>, i.e. as a child element, only indirectly
inside a block-like container.)
> Why? Because otherwise <input> couldn't be contained in, for example,
> a paragraph, even if that paragraph was itself within a form,
No, the syntax rules _could_ have been written so that <input> is only
allowed inside a <form> directly or indirectly. That would be fairly
simple in classic HTML, nominally based on SGML (which has exclusion
exceptions). It would not be possible at the DTD level in XHTML, based
on the toy version of SGML called XML, but it could have been added as
requirement in prose, just as XHTML 1.0 prosaically forbids an <a>
element inside an <a> element even though its DTD syntax allows it.
The real reason is that people who decided on HTML specs wanted to allow
lone <input> elements for use with client-side scripting.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
[Back to original message]
|