Re: [w3c/IndexedDB] Adjust how the direction is defaulted in "Creating a request to retrieve multiple items" (PR #478)

SteveBeckerMSFT left a comment (w3c/IndexedDB#478)

I don't think a conversion step is needed.  

Any JavaScript argument that is an 'object' type may serve as an `IDBGetAllOptions` dictionary.  For `getAll()` and friends, when passed an argument that is an 'object' type and is not a type of IDB key, the browser must attempt to get the values from the object's keys using 'query', 'count' and 'direction'.  When the resulting values are undefined, the browser must use the default values defined by the [`IDBGetAllOptions` dictionary](https://www.w3.org/TR/IndexedDB/#dictdef-idbgetalloptions).

It's unfortunate that `getAll()` and friends use `any`, which forces the browser to differentiate between object types that might be a valid IDB key, which includes Dates, Arrays and ArrayBuffers, and object types that might serve as the `IDBGetAllOptions` dictionary.  To maintain backward compat for `getAll()` and friends, the browser must continue using Dates, Arrays and ArrayBuffers as IDBKeyRanges, even if they are invalid IDB keys (i.e. a NaN Date).  We don't want to change existing behavior for any IDB key types.

See "[is a potentially valid key range](https://www.w3.org/TR/IndexedDB/#is-a-potentially-valid-key-range)", which tries to handle these cases.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/pull/478#issuecomment-3444822760
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/IndexedDB/pull/478/c3444822760@github.com>

Received on Friday, 24 October 2025 20:34:10 UTC