tot - Check-in [14]
Not logged in
[Browse]  [Home]  [Login]  [Reports]  [Search]  [Timeline
  [Patchset
Check-in Number: 14
Date: 2007-Mar-16 19:59:58 (local)
2007-Mar-16 18:59:58 (UTC)
User:rse
Branch:
Comment: improve text conversion
Tickets:
Inspections:
Files:
jquery/jquery.debug.js      13 -> 14
Modified: jquery/jquery.debug.js
===================================================================
--- jquery/jquery.debug.js	2007-03-16 12:54:53 UTC (rev 13)
+++ jquery/jquery.debug.js	2007-03-16 18:59:58 UTC (rev 14)
@@ -53,7 +53,7 @@
         if (typeof window.console === "undefined") {
             /* minimum conversion of arbitrary object to text representation */
             function object2text (obj) {
-                var text = "[object]";
+                var text = null;
                 if (typeof obj === "undefined")
                     text = "[undefined]";
                 else if (typeof obj === "boolean")
@@ -75,15 +75,17 @@
                             text += '>';
                         }
                         else if (obj.nodeType == 2) /* W3C DOM attribute node */
-                            text += obj.nodeName + '="' + obj.nodeValue;
+                            text = obj.nodeName + '="' + obj.nodeValue;
                         else if (obj.nodeType == 3) /* W3C DOM text node */
-                            text += obj.nodeValue;
+                            text = obj.nodeValue;
                     }
                     else if (typeof obj.toJSONString !== "undefined")
                         text = obj.toJSONString();
+                    else if (typeof obj.toString !== "undefined")
+                        text = obj.toString();
                 }
-                else
-                    text = "[???]"
+                if (text == null)
+                    text = "[unknown]";
                 return text;
             }