W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2008

[whatwg] Placeholder option for text input boxes

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Wed, 1 Oct 2008 00:18:24 -0700
Message-ID: <c9e12660810010018u54c7a81cy5388103eb7917c34@mail.gmail.com>
On Tue, Sep 30, 2008 at 11:43 PM, Kristof Zelechovski
<giecrilj at stegny.2a.pl> wrote:
> I would rather test whether a brand new INPUT object of type SEARCH has an
> attribute named "placeholder".  Accessing attributes as properties is
> discouraged and considered becoming obsolete; it should not be expected to
> work for new attributes.

Can you provide an example or evidence of DOM properties becoming
obsolete (other than safari not supporting input.placeholder)?

Garrett

> Chris
>
> -----Original Message-----
> From: whatwg-bounces at lists.whatwg.org
> [mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Garrett Smith
> Sent: Tuesday, September 30, 2008 8:50 PM
> To: whatwg at whatwg.org
> Subject: [whatwg] Placeholder option for text input boxes
>
> Result:
> Safari 3.1 (supports placeholder)
>  zip.placeholder=undefined
>  zip.getAttributeNode('placeholder') =Zip Code
>
> Others (do not support placeholder)
>  zip.placeholder=undefined
>  zip.getAttributeNode('placeholder') =Zip Code
>
> If a backwards-compatible degradation strategy is to be devised, it
> should be as trivial as checking:-
>
> if(!('placeholder' in input)) {
>  createFallbackPlaceholder();
> }
>
> But this will fail in the current implementation in Safari 3.1.
>
> input.getAttribute('placeholder') would not be degradable, as all
> modern browsers would return the attribute value, regardless of
> whether they support the actual placeholder behavior or not.
>
> Are there any arguments against a |placeholder| property on INPUT?
>
> Pros/cons for a |placeholder| property and attribute on TEXTAREA?
>
> Garrett
>
>> ~TJ
>>
>
>
Received on Wednesday, 1 October 2008 00:18:24 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:44 UTC