documentcloud/underscore — Issue #491: Simple fix for "Objects: objects: keys" test module
Author: LarryBattle
Created: 2012-02-27 01:09:49+00:00
State: open

Problem:
Test 3 to 7 in "Objects: objects: keys" test module fail in Opera 11+ and IE9.

Fix:
File: underscore / test / objects.js
Line: 6
// Old Code
var exception = /object/;
// New Code
var exception = /object/i;

Example Test case.

raises(function() { _.keys(void 0); }, exception, 'throws an error for `undefined` values');

//Chrome Error Message
"TypeError: Object.keys called on non-object"

//Firefox Error Message
"TypeError: (void 0) is not an object"

//Opera Error Message
"TypeError: Object.keys: first argument not an Object"

//IE 9 Error Message
"TypeError: Object.keys: argument is not an Object"