- From: <bugzilla@jessica.w3.org>
- Date: Thu, 08 Sep 2011 12:13:03 +0000
- To: public-webapps@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=14084 Summary: Hi! Returning a null from getItem() if the key does not exist is downright semantically wrong. null is a full-fledged value which can be serialized (JSONed), and is NOT the value we get if we do: var x = myObject.someUnknownProperty; In that case we get t Product: WebAppsWG Version: unspecified Platform: Other URL: http://www.whatwg.org/specs/web-apps/current-work/#top OS/Version: other Status: NEW Severity: normal Priority: P3 Component: Web Storage (editor: Ian Hickson) AssignedTo: ian@hixie.ch ReportedBy: contributor@whatwg.org QAContact: member-webapi-cvs@w3.org CC: ian@hixie.ch, mike@w3.org, public-webapps@w3.org Specification: http://dev.w3.org/html5/webstorage/ Multipage: http://www.whatwg.org/C#top Complete: http://www.whatwg.org/c#top Comment: Hi! Returning a null from getItem() if the key does not exist is downright semantically wrong. null is a full-fledged value which can be serialized (JSONed), and is NOT the value we get if we do: var x = myObject.someUnknownProperty; In that case we get the 'undefined' value, and that is what the return value of getItem() _should_ be if the item is not found. undefined is not serializable (JSONable) and is never a valid value, whereas null is sometimes an application-/domain-valid value. Returning null from getItem() is ambiguous in the case of an application using null as a placeholder or a "falsy" value. Returning undefined is unambiguous. ----- stephan beal (sgbeal@googlemail.com) Posted from: 194.246.122.11 User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.218 Safari/535.1 -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
Received on Thursday, 8 September 2011 12:13:11 UTC