- From: Jonas Sicking <jonas@sicking.cc>
- Date: Mon, 8 Nov 2010 10:47:21 -0800
- To: Keean Schupke <keean@fry-it.com>
- Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Webapps WG <public-webapps@w3.org>
On Mon, Nov 8, 2010 at 10:41 AM, Keean Schupke <keean@fry-it.com> wrote: > Hi, > In code, if: > idbObjectStoreSync.put(key, undefined) does the same as > idbObjectStoreSync.remove(key) > then > idbObjectStoreSync.get(key) can safely return undefined for no such key > exists. > > Consider: > idbObjectStoreSync.put('mykey', undefined); // deletes the object stored > under mykey or noop. > idbObjectStoreSync.get('mykey'); // returns 'undefined' > idbObjectStoreSync.put('mykey', myobject); > idbObjectStoreSync.get('mykey'); // returns 'myobject' > idbObjectStoreSync.put('mykey', undefined); // deletes the object stored > under mykey or noop. > idbObjectStoreSync.get('mykey'); // returns 'undefined' Indeed. But I think this is more unexpected and confusing than having .get() return the same thing if the entry exists as if it contains undefined. / Jonas
Received on Monday, 8 November 2010 18:48:21 UTC