On Sun, Aug 2, 2009 at 7:17 PM, 白石俊平 <span dir="ltr"><<a href="mailto:shumpei.shiraishi@gmail.com">shumpei.shiraishi@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
I'm implementing the HTML5 Web Storage using Gears<br>
(<a href="http://code.google.com/p/gear5/" target="_blank">http://code.google.com/p/gear5/</a>), so I have several questions with<br>
the spec.<br>
<br>
-Storage.setItem(key, val)<br>
--is key allowed non-string type object?</blockquote><div><br></div><div>Yes, but... </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">--and when pass non-string object to key/value, is it automatically<br>
converted to string?(I'm considering to convert to use String<br>
constructor - String(key) )</blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
--when value is null, should `setItem("key", null)` behave as like as<br>
`removeItem("key")`? (localStorage.setItem("key", null);<br>
alert(localStorage.length); <-- what is value displayed?)</blockquote><div><br></div><div>No, it's not the same as removeItem. It'll be set to 'null'.</div><div><br></div><div>Check out Safari 4's implementation if you'd like to see the correct behavior for all of these cases. I've been spending a lot of time with it, and it matches the spec in every case I've tried. (And I've tried a lot...I'm working on it for Chromium.) :-)</div>
<div><br></div><div>J</div></div>