Ian Hickson wrote:
On Tue, 28 Apr 2009, John J Barton wrote:
  
Sorry, I don't follow what you mean. The loop is possible of course, but 
what should the result be? If I have a sessionStorage object |s| with 10 
items, the length will be 10. Should I expect |s[i]| for i=0,..., 9?  
If so what will be the result, keys? items? Can I set values, eg s[2] = 
"howdy"?
    

Keys:

# The object's indices of the supported indexed properties are the numbers 
# in the range zero to one less than the number of key/value pairs 
# currently present in the list associated with the object.

>From the IDL:
# [IndexGetter] DOMString key(in unsigned long index);

# The key(n) method must return the name of the nth key in the list.
  
>From the perspective of development tools (and perhaps thus developers), this pseudo-array interface is unfortunate. Storage is neither an array of entries nor an associative array. As such, tools like Firebug will just show it as Object with a curious property 'length' which looks like a key but is not. I think a getLength() function would be more true to the character of the type.
See WebIDL for the definition of the [IndexGetter] syntax.
  
I could not figure out from the WebIDL what happens in this case:
   sessionStore[2] = "howdy"; // no other keys in sessionStore

I guess this does not work like _javascript_ arrays or objects, rather I expect it fails?

jjb

Reply via email to