W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [indexeddb] Do we need to support keyPaths with an empty string?

From: ben turner <bent.mozilla@gmail.com>
Date: Fri, 20 Jan 2012 12:23:21 -0800
Message-ID: <CAGcTs++9YcuPnHzoXq9K0=6P8wBdWGE3LqFe4EEQtFp_0ukZ=w@mail.gmail.com>
To: Israel Hilerio <israelh@microsoft.com>
Cc: Joshua Bell <jsbell@chromium.org>, Odin HÝrthe Omdal <odinho@opera.com>, "Jonas Sicking (jonas@sicking.cc)" <jonas@sicking.cc>, Adam Herchenroether <aherchen@microsoft.com>, David Sheldon <dsheldon@microsoft.com>, "public-webapps@w3.org" <public-webapps@w3.org>
Mozilla is fine with removing the special |keyPath:""| behavior.
Please note that this will also mean that step 1 of the algorithm here

  http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#dfn-steps-for-extracting-a-key-from-a-value-using-a-key-path

will need to change.

We do want to continue to allow set behavior without specifying the
key twice, though, so we would propose adding an additional option to
createObjectStore to accomplish this:

  // Old way:
  var set = db.createObjectStore("mySet", { keyPath:"" });
  set.put(keyValue);

  // New way:
  var set = db.createObjectStore("mySet", { isSet: true });
  set.put(keyValue);

(We are not in love with "isSet", better names are highly encouraged!)

What do you all think? This would allow us to continue to support nice
set behavior without making the empty string "magic".

-Ben
Received on Friday, 20 January 2012 20:24:10 GMT

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