Make _.clone follow the structured cloning algorithm's behavior for cloning objects created by constructors other than Object and make _.isEqual equate objects to arguments objects.

Former-commit-id: a387c6444694d8d550ab463ea5290088d3356d8b
This commit is contained in:
John-David Dalton
2012-11-29 02:04:16 -08:00
parent 4a01f4f65f
commit 52cddc015b
6 changed files with 271 additions and 277 deletions

View File

@@ -243,17 +243,17 @@
Klass.prototype = { 'b': 1 };
var nonCloneable = {
'an arguments object': arguments,
'an element': window.document && document.body,
'a function': Klass,
'a Klass instance': new Klass
'a function': Klass
};
var objects = {
'an arguments object': arguments,
'an array': ['a', 'b', 'c', ''],
'an array-like-object': { '0': 'a', '1': 'b', '2': 'c', '3': '', 'length': 5 },
'boolean': false,
'boolean object': Object(false),
'a Klass instance': new Klass,
'an object': { 'a': 0, 'b': 1, 'c': 3 },
'an object with object values': { 'a': /a/, 'b': ['B'], 'c': { 'C': 1 } },
'an object from another document': _._object || {},