Box.supported() returns false on Safari 5
Closed this issue · 4 comments
nvahalik commented
I'm using this with Safari (Lion) and Box.supported() returns false. The library works, though.
kbjr commented
If the library doesn't detect support, it wouldn't be working because it doesn't build the whole API when it knows it won't work. The only thing I can think of is that the internal test is failing. Try running this code and tell me what you get:
Box.store('TestName', 'TestValue');
console.log(Box.fetch('TestName') === 'TestValue'); // should be true
Box.unset('TestName');
nvahalik commented
When this code runs:
try {
self.store('TestName', 'TestValue');
if (self.fetch('TestName') !== 'TestValue') {
support = false;
}
self.unset('TestName');
} catch (e) { support = false; }
This exception gets thrown:
message: "'undefined' is not an object (evaluating 'self.JSON.stringify')"
However, when I run the code in the console... it works just fine.
kbjr commented
I think the problem was that the test was running before the JSON shim was loaded. I've moved the test code to after that is loaded. If you still have the problem, feel free to re-open.
nvahalik commented
Looks like it is fixed now! salutes