<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>14084</bug_id>
          
          <creation_ts>2011-09-08 12:13:02 +0000</creation_ts>
          <short_desc>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</short_desc>
          <delta_ts>2011-10-12 01:59:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Web Storage (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#top</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>art.barstow</cc>
    
    <cc>ayg</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>56525</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-09-08 12:13:02 +0000</bug_when>
    <thetext>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 &apos;undefined&apos; 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 &quot;falsy&quot; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56533</commentid>
    <comment_count>1</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-09-08 15:31:30 +0000</bug_when>
    <thetext>If you store a null value, it gets serialized to the string &quot;null&quot;.  When you pull it back out, you get the string back, not the null value.  It&apos;s impossible get an actual null value back out of a valid key.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56666</commentid>
    <comment_count>2</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-09-12 17:18:26 +0000</bug_when>
    <thetext>Also, this is how UAs behave now, and it&apos;s unlikely we can change it without breaking compat.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58074</commentid>
    <comment_count>3</comment_count>
    <who name="Arthur Barstow">art.barstow</who>
    <bug_when>2011-10-11 20:13:12 +0000</bug_when>
    <thetext>I think v1 of this spec should focus on current implementations and as such, the change proposed in comment 0 can be considered for the next version of the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58100</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-10-12 00:31:49 +0000</bug_when>
    <thetext>Art, we cannot resolve this LATER, because at that point it would break compatibility with v1. So we have to decide now whether this is WONTFIX or not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58103</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-10-12 01:59:01 +0000</bug_when>
    <thetext>WONTFIX per comment 2 and comment 4. If you disagree with this resolution please reopen.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>