Re: Why is <input> empty?

On Mon, May 2, 2016 at 11:46 AM, Travis Leithead <
travis.leithead@microsoft.com> wrote:

> Hi James,
>
>
>
>   I think mostly we are dealing with an entire web of existing content,
> and that effectively prevents us from changing this behavior. J (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
> <http://contactAuthor.php?subject=Email%20Message>
> Web-site: www.jamescobban.net
> 34 Palomino Dr.
> Kanata, ON, CANADA
> K2M 1M1
> +1-613-592-9438
>


Note that there are a number of void elements
https://developers.whatwg.org/syntax.html#void-elements - for various
reasons of history of pragmatism.

-- 
Brian Kardell :: @briankardell

Received on Monday, 2 May 2016 16:00:20 UTC