[whatwg] question about Web Storage setItem()'s behavior

Cameron McCormack cam at mcc.id.au
Wed Aug 12 16:26:31 PDT 2009


Boris Zbarsky:
> Given the actual example code (and not its description, which
> doesn't match the code), the relevant section is
> http://dev.w3.org/2006/webapi/WebIDL/#es-operations steps 1 through
> 3 in the third bullet point.
> 
> It looks to me like per the current spec text that will throw a
> TypeError for the above call, unless the second argument to setItem
> is marked [optional].

Yeah I think that’s right.  I’ll just note though that behaviour when
passing too many or too few arguments is still an open issue (although
it’s more likely that the ‘too many’ case will change than the ‘too few’
case).

OTOH, passing in undefined explicitly as the second argument would have
it converted to the string "undefined".

-- 
Cameron McCormack ≝ http://mcc.id.au/



More information about the whatwg mailing list