Changeset 8470

Show
Ignore:
Timestamp:
05/08/07 09:42:57 (20 months ago)
Author:
alex
Message:

patch from Ben Lowery for numeric additions to cookies. Refs #2796

Location:
dojo/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/cookie.js

    r8277 r8470  
    3636                props = props || {}; 
    3737                value = encodeURIComponent(value); 
    38                 if(typeof(props.expires) == "Number"){  
     38                if(typeof(props.expires) == "number"){  
    3939                        var d = new Date(); 
    4040                        d.setTime(d.getTime()+(props.expires*24*60*60*1000)); 
  • dojo/trunk/tests/cookie.html

    r8277 r8470  
    4343                                                                t.is(v, dojo.cookie(n)); 
    4444                                                        } 
     45                                                }, 
     46                                                { 
     47                                                        name: "daysAsNumber", 
     48                                                        runTest: function(t){ 
     49                                                                // set a cookie with a numerical expires 
     50                                                                dojo.cookie("dojo_num", "foo", { expires: 10 }); 
     51                                                                t.is("foo", dojo.cookie("dojo_num")); 
     52                                                                 
     53                                                                // remove the cookie by setting it with a negative 
     54                                                                // numerical expires. value doesn't really matter here 
     55                                                                dojo.cookie("dojo_num", "-deleted-", { expires: -10 }); 
     56                                                                t.is(null, dojo.cookie("dojo_num")); 
     57                                                        } 
    4558                                                } 
    4659                                        ]