W3C home > Mailing lists > Public > public-html@w3.org > May 2016

RE: Why is <input> empty?

From: Travis Leithead <travis.leithead@microsoft.com>
Date: Mon, 2 May 2016 15:46:56 +0000
To: James Cobban <webmaster@Jamescobban.net>, "public-html@w3.org" <public-html@w3.org>
Message-ID: <BY2PR0301MB15751FBD4C378E6CFFDBFD1AF8790@BY2PR0301MB1575.namprd03.prod.outlook.com>
Hi James,

  I think mostly we are dealing with an entire web of existing content, and that effectively prevents us from changing this behavior. ☺ (at least for the way the input element is processed).

I did want to clarify that the value attribute is only a *default* value. You’ll notice that if you change the value in <input> using the keyboard, and then programmatically update the value attribute (e.g., setAttribute(‘value’, ‘reset value’), the actual value displayed to the user doesn’t change! That’s because the displayed value is stored internally to the input element and is exposed only using the IDL ‘value’ property (e.g., querySelector(‘input’).value). (Well, it’s a little more complicated than that… but that’s the simple answer.) Similar story for <textarea>. Yeah it’s weird, but it’s the web’s legacy.

From: James Cobban [mailto:webmaster@Jamescobban.net]
Sent: Wednesday, April 27, 2016 3:39 PM
To: public-html@w3.org
Subject: Why is <input> empty?

With almost all HTML tags the information that is actually displayed to the user by the browser comes from the content of the tag.  The only exception I can think of is <input> where the text displayed to the user comes from an attribute.  This results in some really exceptional behavior including that you cannot have an </input> end tag.  I appreciate that when HTML was first implemented that was the way the tag worked, but I do not understand why a quarter century later it still has that exceptional behavior.  Why to I have to code <input type='input' value='12345'> when <input type='input'>12345</input> would be consistent with every other tag.  Related to this was the decision to create a new <button> tag, largely to permit specifying the displayed content of the element, rather than just permitting including the content with the <input type='button'> tag.
--

James Cobban webmaster@jamescobban.net<contactAuthor.php?subject=Email%20Message>
Web-site: www.jamescobban.net<http://www.jamescobban.net/>
34 Palomino Dr.
Kanata, ON, CANADA
K2M 1M1
+1-613-592-9438
Received on Monday, 2 May 2016 15:47:26 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 15:47:27 UTC