[whatwg] Challenging canvas.supportsContext

Tab Atkins Jr. jackalmage at gmail.com
Wed Jun 19 11:20:32 PDT 2013


On Wed, Jun 19, 2013 at 11:17 AM, Benoit Jacob <jacob.benoit.1 at gmail.com> wrote:
> So let's look at the naive application usage pattern for supportsContext:
>
>   if (canvas.supportsContext("webgl")) {
>     context = canvas.getContext("webgl");
>   }
>
> The problem is that the same can be achieved with just the getContext call,
> and checking whether it succeeded.

The problem that supportsContext() solves, and which was brought up
repeatedly during the drive to add this, is that spinning up contexts
can be expensive.

~TJ



More information about the whatwg mailing list