W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2009

Storage 'length' and enumeration

From: John J. Barton <johnjbarton@johnjbarton.com>
Date: Tue, 28 Apr 2009 10:03:08 -0700
Message-ID: <49F736CC.4020902@johnjbarton.com>
To: public-webapps@w3.org
Hi. I work on Firebug, a web page debugger for Firefox 
(http://getfirebug.com).

In attempting to show developers relevant information about all objects 
in their program I was trying to display window.sessionStorage. In the 
process I read the document http://dev.w3.org/html5/webstorage/. I found 
the document unnecessarily confusing because it uses the property 
'length' for Storage. This is the same property used by Javascript Array 
type, but Storage is not an array and you cannot enumerate the elements 
of the Storage object |s| using
   for(var i = 0; i < s.length; i++)...

Any number of other names for the property would be equally effective 
for your propose without confusing developers with a property that 
implies array-ness. For examples, 'totalItems', 'numberOfItems', 'size', 
'entries', or even good old 'n'.

Using the term "enumeration" to mean "property enumeration" is also 
confusing, but I suppose ECMA script made that mistake too long ago.

jjb

-- 
______________________________________________________
John J. Barton  email:  johnjbarton<at>johnjbarton.com   
http://www.johnjbarton.com
Received on Tuesday, 28 April 2009 19:27:56 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:31 GMT