W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 8 Nov 2010 10:47:21 -0800
Message-ID: <AANLkTikyfA_cteSE-GLawmAZnKfcDPRSea0X_1igLcTN@mail.gmail.com>
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 GMT

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