gigebyte / cookies

Automatically exported from code.google.com/p/cookies
0 stars 0 forks source link

Array not restored properly? #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It's possible my understand here is incorrect, forgive me if this is the case.

What steps reproduce the problem?
1. Store an array in a cookie using set
2. Restore it using get

Example:
var test = new Array();
test[0] = 1;
test[3] = 5;
$.cookies.set("testCookie", test);

var test2 = $.cookies.get("testCookie");

What is the expected result of the above steps?  What do you see instead?
I'd expect test2 to be an array, but it is a string. Simply doing an eval
on it fixes the glitch and we have the proper array again.

What version of the following are you using?
  jQuery: 1.4.1
  cookies: 2.2.0

What browser/version are you using?
Tested in Firefox 3.5.7 and Safari 4.0.4

What OS/version are you using?
OS X 10.6.2

Do you have any additional information to provide?

Original issue reported on code.google.com by jonlalib...@gmail.com on 3 Feb 2010 at 6:01

GoogleCodeExporter commented 9 years ago
I cannot reproduce this issue.  I too am using OS X 10.6.2 and tried in the 
following browsers:

Safari 4.0.4
Firefox 3.0.17
Firefox 3.5.7
Firefox 3.6

I am, however, using jQuery 1.3.2.  I will try again shortly with jQuery 1.4 
and 1.4.1

{{{
  var test = new Array();
  test[0] = 1;
  test[3] = 5;
  $.cookies.set("testCookie", test);

  var test2 = $.cookies.get("testCookie");

  console.log( test2 );
  console.log( typeof test2 );
  console.log( test2 instanceof Array );
}}}
The output to the console in each browser is
{{{
  [ 1, null, null, 5 ]
  object
  true
}}}

Original comment by auldrid...@gmail.com on 3 Feb 2010 at 3:25

GoogleCodeExporter commented 9 years ago
Using the same browsers, OS, and test as above, I ran in jQ 1.4 and 1.4.1

I got the same results--everything working as expected.  Also, all of my unit 
tests continue to pass.

At this point I cannot reproduce the problem.

Original comment by auldrid...@gmail.com on 3 Feb 2010 at 3:38

GoogleCodeExporter commented 9 years ago
No further input has been given on this issue which I am unable to reproduce.

Closing.

Original comment by auldrid...@gmail.com on 25 Feb 2010 at 4:02