<div class="gmail_quote">On Thu, Jun 11, 2009 at 2:05 PM, Jeremy Orlow <span dir="ltr"><<a href="mailto:jorlow@google.com">jorlow@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><div class="gmail_quote">On Thu, Jun 11, 2009 at 12:36 PM, Jeremy Orlow <span dir="ltr"><<a href="mailto:jorlow@google.com" target="_blank">jorlow@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div>On Thu, Jun 11, 2009 at 11:52 AM, Ian Hickson <span dir="ltr"><<a href="mailto:ian@hixie.ch" target="_blank">ian@hixie.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Fri, 22 May 2009, Jeremy Orlow wrote:<br>
><br>
> What is the behavior of the following supposed to be?<br>
><br>
> window.sessionStorage.removeItem = function(x) { alert("Wait, this works?"); };<br>
> window.sessionStorage.removeItem('blah');<br>
> alert(typeof window.sessionStorage.removeItem);<br>
<br>
</div>The behaviour of these things are defined in WebIDL:<br>
<br>
<a href="http://dev.w3.org/2006/webapi/WebIDL/" target="_blank">http://dev.w3.org/2006/webapi/WebIDL/</a><br>
<br>
...which, as defined today, consists of setting 'removeItem' to a function<br>
value that doesn't persist.</blockquote><div><br></div></div><div>Apologies. I have looked through that, but apparently not closely enough. The relevant portions of the HTML 5 spec + all the specs it depends on is a lot to grok...hence the occasional question like this.</div>
<div><br></div><div>Thanks for the response!</div></div>
</blockquote></div><br></div></div><div>Also, does this mean that setting removeItem to null is ok? What about other (non-function) objects?</div><div><br></div><div>What specific portion of WebIDL talks about this? I'm having trouble finding it.</div>
</blockquote><div><br></div><div>Sorry, but one more question (that I'm sure the spec answers, but I can't find that answer via searching):</div><div><br></div><div>What takes precedent when you do the following?</div>
<div><br></div><div>window.localStorage.setItem("removeItem", "blah");</div><div>window.localStorage.removeItem = function (x) { // do something };</div><div>alert(window.localStorage.removeItem);</div>
<div><br></div><div>In Safari 4, the alert will show "blah". Is this correct?</div><div><br></div><div>Also, what's the intended behavior when doing a "delete window.localStorage.removeItem" after all of this? Should it delete both entries, just the function, or just the local storage map entry? If it's one of the latter, should a subsequent delete call delete the other?</div>
<div><br></div><div>I assume from what you said that a "window.localStorage.clear()" after "window.localStorage.setItem("removeItem", "blah"); window.localStorage.removeItem = function (x) { // do something };" should leave just the function override?</div>
<div><br></div><div>Does the complexity of these corner cases worry anyone else? :-)</div><div><br></div><div>J</div></div>