Changeset 6555
- Timestamp:
- 04/24/07 02:50:52 (1 year ago)
- Files:
-
- spinoffs/prototype/trunk/CHANGELOG (modified) (1 diff)
- spinoffs/prototype/trunk/src/array.js (modified) (1 diff)
- spinoffs/prototype/trunk/src/base.js (modified) (1 diff)
- spinoffs/prototype/trunk/src/hash.js (modified) (1 diff)
- spinoffs/prototype/trunk/test/unit/array.html (modified) (1 diff)
- spinoffs/prototype/trunk/test/unit/base.html (modified) (3 diffs)
- spinoffs/prototype/trunk/test/unit/hash.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/prototype/trunk/CHANGELOG
r6536 r6555 1 1 *SVN* 2 3 * Add extra spacing so Array#toJSON and Hash#toJSON generate YAML-loadable JSON. Closes #7883. [Andrew Dupont] 2 4 3 5 * Fix Form.request for forms containing an input element with name="action". Closes #8063. [Thomas Fuchs, Mislav Marohnić] spinoffs/prototype/trunk/src/array.js
r6381 r6555 110 110 if (value !== undefined) results.push(value); 111 111 }); 112 return '[' + results.join(', ') + ']';112 return '[' + results.join(', ') + ']'; 113 113 } 114 114 }); spinoffs/prototype/trunk/src/base.js
r6368 r6555 43 43 var value = Object.toJSON(object[property]); 44 44 if (value !== undefined) 45 results.push(property.toJSON() + ': ' + value);45 results.push(property.toJSON() + ': ' + value); 46 46 } 47 return '{' + results.join(', ') + '}';47 return '{' + results.join(', ') + '}'; 48 48 }, 49 49 spinoffs/prototype/trunk/src/hash.js
r6481 r6555 29 29 this.prototype._each.call(object, function(pair) { 30 30 var value = Object.toJSON(pair.value); 31 if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value);31 if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value); 32 32 }); 33 return '{' + results.join(', ') + '}';33 return '{' + results.join(', ') + '}'; 34 34 } 35 35 }); spinoffs/prototype/trunk/test/unit/array.html
r6384 r6555 124 124 assertEqual('[]', [].toJSON()); 125 125 assertEqual('[\"a\"]', ['a'].toJSON()); 126 assertEqual('[\"a\", 1]', ['a', 1].toJSON());127 assertEqual('[\"a\", {\"b\":null}]', ['a', {'b': null}].toJSON());126 assertEqual('[\"a\", 1]', ['a', 1].toJSON()); 127 assertEqual('[\"a\", {\"b\": null}]', ['a', {'b': null}].toJSON()); 128 128 }}, 129 129 spinoffs/prototype/trunk/test/unit/base.html
r6363 r6555 85 85 assertEqual('withBindArgsAndArgs,arg1,arg2,arg3,arg4', globalBindTest); 86 86 }}, 87 87 88 88 testObjectInspect: function() { with(this) { 89 89 assertEqual('undefined', Object.inspect()); … … 100 100 assertEqual('[]', Object.toJSON([])); 101 101 assertEqual('[\"a\"]', Object.toJSON(['a'])); 102 assertEqual('[\"a\", 1]', Object.toJSON(['a', 1]));103 assertEqual('[\"a\", {\"b\":null}]', Object.toJSON(['a', {'b': null}]));104 assertEqual('{\"a\": \"hello!\"}', Object.toJSON({a: 'hello!'}));102 assertEqual('[\"a\", 1]', Object.toJSON(['a', 1])); 103 assertEqual('[\"a\", {\"b\": null}]', Object.toJSON(['a', {'b': null}])); 104 assertEqual('{\"a\": \"hello!\"}', Object.toJSON({a: 'hello!'})); 105 105 assertEqual('{}', Object.toJSON({})); 106 106 assertEqual('{}', Object.toJSON({a: undefined, b: undefined, c: Prototype.K})); 107 assertEqual('{\"b\": [false,true],\"c\":{\"a\":\"hello!\"}}',107 assertEqual('{\"b\": [false, true], \"c\": {\"a\": \"hello!\"}}', 108 108 Object.toJSON({'b': [undefined, false, true, undefined], c: {a: 'hello!'}})); 109 assertEqual('{\"b\": [false,true],\"c\":{\"a\":\"hello!\"}}',109 assertEqual('{\"b\": [false, true], \"c\": {\"a\": \"hello!\"}}', 110 110 Object.toJSON($H({'b': [undefined, false, true, undefined], c: {a: 'hello!'}}))); 111 111 assertEqual('true', Object.toJSON(true)); … … 149 149 document.body.appendChild(div); 150 150 var tobj = new TestObj(); 151 var eventTest = { test:true};151 var eventTest = { test: true }; 152 152 var call = tobj.assertingEventHandler.bindAsEventListener(tobj, 153 this.assertEqual.bind(this, eventTest),154 this.assertEqual.bind(this, arg1),155 this.assertEqual.bind(this, arg2),156 this.assertEqual.bind(this, arg3), arg1, arg2, arg3 );153 this.assertEqual.bind(this, eventTest), 154 this.assertEqual.bind(this, arg1), 155 this.assertEqual.bind(this, arg2), 156 this.assertEqual.bind(this, arg3), arg1, arg2, arg3 ); 157 157 call(eventTest); 158 158 } spinoffs/prototype/trunk/test/unit/hash.html
r6481 r6555 134 134 135 135 testToJSON: function(){ with(this) { 136 assertEqual('{\"b\": [false,true],\"c\":{\"a\":\"hello!\"}}',136 assertEqual('{\"b\": [false, true], \"c\": {\"a\": \"hello!\"}}', 137 137 $H({'b': [undefined, false, true, undefined], c: {a: 'hello!'}}).toJSON()); 138 138