Intent to Implement and Ship: IDBKeyRange.includes

33 views
Skip to first unread message

Joshua Bell

unread,
Apr 14, 2016, 7:27:16 PM4/14/16
to blink-dev

Note: already implemented under a general IndexedDBExperimental flag. This is really just an I2S but no specific I2I was sent for this one method.


Contact emails

jsb...@chromium.org


Spec

https://w3c.github.io/IndexedDB/#dom-idbkeyrange-includes


Summary

An IDBKeyRange represents what you'd call an interval in mathematics - a set of possible keys ranging from an optional lower bound to an optional upper bound and the bounds can be open (exclusive) or closed (inclusive). These are used for queries, e.g. store.getAll(IDBKeyRange.bound(1, 10))


The change adds an instance method, keyRange.includes(key) that tells you whether or not the key is present in the range. The name follows from the ECMAScript Array.prototype.includes and String.prototype.includes methods.


Motivation

Testing whether a key exists in a range requires comparing against the bounds and accounting for open/closed bounds. Straightforward and polyfillable, but annoying when needed as a primitive for building on top of IDB.


Interoperability and Compatibility Risk

Implemented and shipping in Firefox 47.


W3C Tests: https://github.com/w3c/web-platform-tests/blob/master/IndexedDB/idbkeyrange-includes.htm


MDN documentation: https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/includes


(includes a polyfill)


Ongoing technical constraints

None.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


OWP launch tracking bug

https://crbug.com/603759


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/6571252802125824


Requesting approval to ship?

Yes.


Philip Jägenstedt

unread,
Apr 15, 2016, 6:20:21 AM4/15/16
to Joshua Bell, blink-dev
LGTM1
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to blink-dev+...@chromium.org.

Dimitri Glazkov

unread,
Apr 15, 2016, 11:40:19 AM4/15/16
to Philip Jägenstedt, Joshua Bell, blink-dev
LGTM2

:DG<

Jochen Eisinger

unread,
Apr 15, 2016, 11:45:31 AM4/15/16
to Dimitri Glazkov, Philip Jägenstedt, Joshua Bell, blink-dev

lgtm3

Reply all
Reply to author
Forward
0 new messages