[whatwg] Placeholder option for text input boxes

Garrett Smith dhtmlkitchen at gmail.com
Wed Oct 1 00:18:24 PDT 2008


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
>>
>
>



More information about the whatwg mailing list