W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] [canvas] Proposal for supportsContext

From: Tobie Langel <tobie.langel@gmail.com>
Date: Tue, 11 Sep 2012 10:50:17 +0200
Message-ID: <CAMK=o4c7VwjevYvaWt-_ufwNzx0Mt_xHBVJtW5bnrmAu2sZm7A@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>, Glenn Maynard <glenn@zewt.org>, Dean Jackson <dino@apple.com>, Ashley Gullen <ashley@scirra.com>
On Tue, Sep 11, 2012 at 10:34 AM, Simon Pieters <simonp@opera.com> wrote:
> On Tue, 11 Sep 2012 00:14:25 +0200, Glenn Maynard <glenn@zewt.org> wrote:
>> If you really want to protect users from the behavior of pages, you'd
>> really need to make creating the context cheap.
>
> This was exactly my reaction as well. Introducing a new method doesn't solve
> the problem. There will still be pages that create the context and then
> don't use it. Browsers just have to suck it up and be fast anyway, just like
> with all other features on the Web.
>
> I think we shouldn't add supportsContext() since it doesn't provide authors
> with new information and browsers will have to do the above anyway.

I actually like Ashley Gullen's proposal (canPlayType-inspired)
because it brings consistency to the platform and offers a general
pattern on how to test for the presence of features which can't be
asserted for certain without costly lookups.

navigator.onLine property is another example where a similar pattern
would make (more) sense (than the current boolean returned instead).

Basically, this is trading performance for the risk of false positives.

--tobie
Received on Tuesday, 11 September 2012 08:50:43 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC