Changeset 6614
- Timestamp:
- 04/28/07 22:26:01 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/prototype/branches/event/src/base.js
r6194 r6614 21 21 if (object === undefined) return 'undefined'; 22 22 if (object === null) return 'null'; 23 return object.inspect ? object.inspect() : object.toString(); 23 return object.inspect ? object.inspect() : 24 object.toString ? object.toString() : '<unknown>'; 24 25 } catch (e) { 25 26 if (e instanceof RangeError) return '...'; spinoffs/prototype/branches/event/test/functional/event.html
r6613 r6614 64 64 <script type="text/javascript"> 65 65 Element.addMethods({ 66 passed: function(el, message) {67 el = $(el) 68 el.className = 'passed' 69 el.update(message || 'Test passed!') 66 passed: function(el, message) { 67 el = $(el); 68 el.className = 'passed'; 69 el.update(message || 'Test passed!'); 70 70 }, 71 failed: function(el, message){ 72 el = $(el) 73 el.className = 'failed' 74 el.update(message || 'Test failed') 71 72 failed: function(el, message) { 73 el = $(el); 74 el.className = 'failed'; 75 el.update(message || 'Test failed'); 75 76 } 76 }) 77 }); 77 78 78 function log(obj){ 79 var line, all = [] 80 for(prop in obj){ 81 if (/^[A-Z]|[XY]$/.test(prop) || typeof obj[prop] == 'function') continue 82 line = prop + ": " 83 line += typeof obj[prop] == 'function' ? '<i>(function)</i>' : obj[prop] 84 all.push(line) 79 function log(obj) { 80 var line, all = []; 81 for (prop in obj) { 82 if (/^[A-Z]|[XY]$/.test(prop) || typeof obj[prop] == 'function') continue; 83 line = prop + ": " + Object.inspect(obj[prop]); 84 all.push(line.escapeHTML()); 85 85 } 86 $('log').update(all.join('<br />')) 86 $('log').update(all.join('<br />')); 87 87 } 88 88 </script>