W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

Re: [IndexedDB] Problems unprefixing IndexedDB

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 08 Aug 2012 20:22:17 -0400
Message-ID: <502302B9.6050100@mit.edu>
To: public-webapps@w3.org
On 8/8/12 8:12 PM, Tab Atkins Jr. wrote:
> Just for reference, the correct way to do this is:
>
> window.indexedDB = window.indexedDB || window.webkitIndexedDB ||
> window.mozIndexedDB || window.msIndexedDB || ...
>
> This avoids the var hoisting that's causing the problems.

As long as you're not in strict-mode code.  If you are, you have to be a 
bit smarter and actually condition things on |if (!("indexedDB" in 
window))| of course...

-Boris
Received on Thursday, 9 August 2012 00:22:46 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT