[whatwg] Proposal: Allow block content inside label element

On Tue, 08 May 2007 05:46:57 +0200, Brad Fults <bfults at gmail.com> wrote:

> Currently, as far as I can tell, in HTML 4 [1] and HTML 5 [2], the
> label element is defined as having inline content. When using the
> implicit form control association pattern described in the HTML 4 spec
> (e.g. a form control inside of the label element instead of or in
> addition to using the |for| attribute), this becomes a problem.
>
> Specifically, if one tries to place a textarea element inside of a
> label element, modern browsers will insert the textarea as a later
> sibling to the label in the DOM instead of as a child. This seems to
> be due to the fact that the textarea is a block element and that label
> can't contain it according to the spec.

Hmm. <textarea> is not a block-level element. It's also willing to be a  
child of <label> for me:

    <http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Clabel%20style%3D%22background%3Alime%22%3Ex%3Ctextarea%3Ey%3C/textarea%3Ez%3C/label%3E>

-- 
Simon Pieters

Received on Tuesday, 8 May 2007 02:35:59 UTC