W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2011

[whatwg] Can we deprecate alert(), confirm(), prompt() ?

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Fri, 10 Jun 2011 14:35:06 -0400
Message-ID: <BANLkTikFUhj7q7t1zCff7uY9k7X=mYtJYQ@mail.gmail.com>
On Thu, Jun 9, 2011 at 3:49 AM, Ian Hickson <ian at hixie.ch> wrote:
> On Tue, 1 Mar 2011, Aryeh Gregor wrote:
>> We could define script APIs, or features of them, as deprecated if
>> browsers were willing to log some kind of notice to their error consoles
>> when the feature is used. ?They all have error consoles with different
>> reporting levels already, so it shouldn't be a pain for them to
>> implement. ?They can have the deprecation warnings off by default so
>> they don't clutter the output. ?At least Firefox already does this for
>> some things, like document.getSelection() (although that message will
>> probably go away in a future release).
>>
>> Of course, this would only be useful if we had a good alternative to
>> recommend. ?"Don't use alert(), use some giant JavaScript library
>> instead" is unlikely to be a very helpful message. ?But it would be nice
>> for some of the crazier or more horrible APIs, if they have saner
>> replacements.
>
> Do we have any data on whether these warnings have any useful effect?

I don't, but then, browsers barely ever emit such warnings.  So it
would be worth trying to mark some methods as deprecated in this
fashion and see if it's useful, if browsers are interested in going
along with it.  I'd predict that it would help out some percentage of
savvier authors.  Currently some authors try to avoid writing code
that validators tell them is bad, so it's a good guess that some would
try to avoid writing code that browsers tell them is bad.

Of course, we'd have to be careful to only do this when we're
reasonably sure that authors really want to never use the feature even
in legacy code, not for every property or method that we wish didn't
exist.  I'm not sure if there really are very many such properties or
methods.
Received on Friday, 10 June 2011 11:35:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:06 UTC