Re: Storage 'length' and enumeration

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.

See WebIDL for the definition of the [IndexGetter] syntax.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 28 April 2009 23:06:00 UTC