🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #50442

Re: Test html5 i input type date

#50442
From: Peter May
Date: Fri, 24 Dec 2010 10:33
20 lines
1679 bytes
W dniu 2010-12-24 02:28, Gadjo Delhi pisze:
>> Argh... nie lubię coś ukrywać używając browser sniffing :/ Ale w tym
>> przypadku nie ma wyjścia.
>
> var el = document.createElement('input');
> el.type = 'date';
> el.value = 'dupa';
> if (el.type !== 'date' || el.value === 'dupa') alert('nie obsluguje');
> else alert('obsługuje');

Faktycznie w Chrome powyższe daje false; Kluczem jest tu value, które 
ustawione w powyższy sposób nie spełnia warunków dla poprawności formatu 
daty:

http://dev.w3.org/html5/spec-author-view/common-microsyntaxes.html#valid-date-string

Dzięki za podpowiedź.

-- 
Peter
Technical Details
Message-ID: <if1ste$9g5$1@news.onet.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!not-for-mail
References: <ieq8p0$nda$1@news.onet.pl> <op.vn2zqvnwutk0y1@aimac.local> <ier9lu$e9s$1@news.onet.pl> <a1213235-c673-4e61-ada4-bbe63b83da9b@f8g2000yqd.googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!not-for-mail
From: Peter May <peter.may@onet.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: Test html5 i input type date
Date: Fri, 24 Dec 2010 11:33:08 +0100
Organization: http://onet.pl
Lines: 20
Message-ID: <if1ste$9g5$1@news.onet.pl>
References: <ieq8p0$nda$1@news.onet.pl> <op.vn2zqvnwutk0y1@aimac.local> <ier9lu$e9s$1@news.onet.pl> <a1213235-c673-4e61-ada4-bbe63b83da9b@f8g2000yqd.googlegroups.com>
NNTP-Posting-Host: 188.146.201.14.nat.umts.dynamic.eranet.pl
Mime-Version: 1.0
X-Trace: news.onet.pl 1293186800 9733 188.146.201.14 (24 Dec 2010 10:33:20 GMT)
X-Complaints-To: niusy@onet.pl
NNTP-Posting-Date: Fri, 24 Dec 2010 10:33:20 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; pl; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7
In-Reply-To: <a1213235-c673-4e61-ada4-bbe63b83da9b@f8g2000yqd.googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit