Re: [whatwg] [canvas] Proposal for supportsContext

On Mon, 10 Sep 2012 13:14:30 -0500, Dean Jackson <dino@apple.com> wrote:

> To give a real world example, the popular tool Modernizr tests for the
> availability of WebGL by attempting to create a WebGL context. This can  
> happen
> even on pages that have no intention of using WebGL - an author has just
> inserted Modernizr into their page and is using it to test for another  
> feature.
> As I said, creating a context is not a free operation. In fact, on  
> shipping
> Safari (Mountain Lion) this causes us to switch to a more powerful GPU
> on systems that have two graphics processors.
>
> An alternative (for the WebGL case) would be to have the author test for  
> the
> presence of window.WebGLRenderingContext. However, this is not reliable.

This is actually what Modernizr does these days [1], but older versions  
did in fact create the context.

[1]  
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js#L429-436

-- 
Mike Taylor
Opera Software

Received on Monday, 10 September 2012 21:41:20 UTC