Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #25645

Re: element content change

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: element content change
Date 2014-08-06 23:19 +0300
Organization A noiseless patient Spider
Message-ID <lru2kj$9h7$1@dont-email.me> (permalink)
References <ba13e4c4-70c8-4e8d-9a39-9c3bfecf4f6f@googlegroups.com> <xuWdnZJt5KHAGXzOnZ2dnUVZ_iydnZ2d@westnet.com.au> <87y4v2qtia.fsf@bsb.me.uk> <lrt9rq$q6e$1@solani.org> <87ppgdo1di.fsf@bsb.me.uk>

Show all headers | View raw


2014-08-06 22:37, Ben Bacarisse wrote:

> "Christoph M. Becker" <cmbecker69@arcor.de> writes:
> <snip>
>> ACK.  Or maybe better:
>>
>>    <label id=citylabel><input type=text id=city> City</label><br>
>
> That looks logically wrong to me -- a label should not include the thing
> it labels.

I agree that it is illogical, but it is permitted in HTML 
specifications, has been ever since <label> was introduced.

> My only back-up is the examples in[1], which all show the
> control outside, with the label element containing just, well, the
> label.
[...]
> [1]  http://www.w3.org/TR/html401/interact/forms.html#edef-LABEL

Reading forward, you’ll see examples like

<LABEL>
    First Name
    <INPUT type="text" name="firstname">
</LABEL>

So this is a valid way, and kept valid in HTML5, but not a logical way. 
There is the practical impact that some old browsers do not support this 
way (clicking on the label text does not focus on the control) but they 
support the more logical way.

Perhaps most importantly, the more logical way is better for scripting 
and styling, since it makes the label an element. In the less logical 
way (“implicit association”), the <label> element contains both the 
label and the control.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

element content change teddybubu@gmail.com - 2014-08-05 17:05 -0700
  Re: element content change Andrew Poulos <ap_prog@hotmail.com> - 2014-08-06 11:23 +1000
    Re: element content change Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-08-06 02:47 +0100
      Re: element content change "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-08-06 06:47 +0300
        Re: element content change Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-08-06 20:27 +0100
      Re: element content change "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-08-06 15:16 +0200
        Re: element content change Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-08-06 20:37 +0100
          Re: element content change "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-08-06 23:19 +0300
            Re: element content change Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-08-06 21:54 +0100
              Re: element content change Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-08-06 21:59 +0100
            Re: element content change "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-08-07 00:59 +0200
              Re: element content change "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-08-07 08:28 +0300
                Re: element content change Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-08-07 11:42 +0100
                Re: element content change "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-08-08 18:48 +0200
          Re: element content change "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-08-07 00:54 +0200
  Re: element content change teddybubu@gmail.com - 2014-08-05 19:36 -0700
    Re: element content change Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2014-08-06 08:52 +0200
  Re: element content change Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-06 12:52 +0000
  Re: element content change teddybubu@gmail.com - 2014-08-06 05:58 -0700

csiph-web