This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
> Note that Arrays that contain other Arrays are allowed as valid keys. > In this case the algorithm above runs recursively when comparing the > individual values in the arrays. http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#key-construct Using an array embedding itself makes a loop, the spec doesn't clarify how to deal with that. var a = []; a[0] = a; I guess you wouldn't want to /recurse/ two of those to find which is biggest ;-)
Agreed that we should add something to "3.1.3 Keys" about this case. Chromium treats arrays with cyclic references as non-valid keys. This occurs at any level of indirection. The spec dictates that members of an array must be valid keys for the array to be a valid key. Therefore, none of the following are valid keys in Chromium: var a1 = []; a1.push(a1); // root directly contains self var a2 = []; a2.push([a2]); // root indirectly contains self var a3 = [a1]; // member contains self
Yeah, we were thinking of solving this in Firefox by simply treating cyclic keys as invalid keys.
So Sicking's proposal? > I suggest an addition to the text e.g. "However, an Array values is only a > valid key if every item in the array is defined, if every item in the array > is a valid key (i.e. sparse arrays can not be valid keys), and if Array > value is not an item in the Array itself or any other Arrays within the > value. (i.e. arrays with cyclic references are not valid keys)." (That could > use a sprinkling of rigor, though.)
Ah, I knew this sounded familiar. http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/0609.html SGTM, obviously!
http://dvcs.w3.org/hg/IndexedDB/rev/b4158388d1f8 Fixed