prototype: Make Object.inspect more robust.
This commit is contained in:
parent
cc69b9c614
commit
ac48714ada
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Make Object.inspect more robust. [Tobie Langel]
|
||||
|
||||
* Add a description to :test and :dist rake tasks. [Christoph Sturm]
|
||||
|
||||
* Fix Selector.matchElements to allow for coma-separated selectors in Element#up/next/previous and Event#findElement. [Samuel Lebeau, Tobie Langel]
|
||||
|
|
|
@ -71,7 +71,7 @@ Object.extend(Object, {
|
|||
try {
|
||||
if (Object.isUndefined(object)) return 'undefined';
|
||||
if (object === null) return 'null';
|
||||
return object.inspect ? object.inspect() : object.toString();
|
||||
return object.inspect ? object.inspect() : String(object);
|
||||
} catch (e) {
|
||||
if (e instanceof RangeError) return '...';
|
||||
throw e;
|
||||
|
|
|
@ -266,6 +266,7 @@
|
|||
assertEqual('null', Object.inspect(null));
|
||||
assertEqual("'foo\\\\b\\\'ar'", Object.inspect('foo\\b\'ar'));
|
||||
assertEqual('[]', Object.inspect([]));
|
||||
assertNothingRaised(function() { Object.inspect(window.Node) });
|
||||
}},
|
||||
|
||||
testObjectToJSON: function() { with(this) {
|
||||
|
|
Loading…
Reference in New Issue