Bug 17032 - IndexedDB: Editorial - use of phrase "explicit key" is confusing
IndexedDB: Editorial - use of phrase "explicit key" is confusing
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API
unspecified
All All
: P2 minor
: ---
Assigned To: This bug has no owner yet - up for the taking
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-10 19:07 UTC by Joshua Bell
Modified: 2012-07-15 22:23 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bell 2012-05-10 19:07:11 UTC
In 3.1.13 Key Generators:

>>>
When a record is stored in a object store which uses a key generator, and an explicit key is defined, ...

NOTE: This can happen both with in-line keys, if the property of the stored value is set, or with out-of-line keys, if an explicit key argument is provided.
<<<

The NOTE clarifies that the normative text's use of "explicit key" applies to both in-line keys (e.g. keyPath: "id", put({id: 1234})) and out-of-line keys (e.g. put({}, 1234)). However, the NOTE then goes on to use the phrase "explicit key argument" specifically with regard to out-of-line keys. This re-use use of "explicit key" seems potentially confusing.

Suggest changing the note to read "... if a key argument is provided."
Comment 1 Jonas Sicking 2012-07-15 22:23:14 UTC
It's hard to come up with language which is both precise and readable. Suggestions welcome. I ended up removing the note and just going with the following text (which is plenty sprinkled with links):


When a record is stored and an key value is specified in the call to store the record, if the specified key value is a float greater than or equal to the key generator's current number, then the key generator's current number is set to the smallest integer number greater than the explicit key. A key can be specified both for object stores which use in-line keys, by setting the property on the stored value which the object store's key path points to, and for object stores which use out-of-line keys, by passing a key argument to the call to store the record.

Only specified keys values which are float values affect the current number of the key generator. Dates and Arrays which contain floats do not affect the current number of the key generator. Nor do DOMString values which could be parsed as floats. Likewise, negative float numbers do not affect the current number since they are always lower than the current number.