- From: Kristof Zelechovski <giecrilj@stegny.2a.pl>
- Date: Wed, 1 Oct 2008 08:43:31 +0200
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. Chris -----Original Message----- From: whatwg-bounces@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 Tuesday, 30 September 2008 23:43:31 UTC