When i debug javascript in webkit browser(f.e. Safari), often i have some string variables and value of these variables are often very long, webkit make it shorter with "..." at the end, but i want to see all value of this variables, how can i do this?
+1
A:
As far as I know all texts are truncated only when being listed as property of an object. If you're logging a text variable directly, it should show the whole text.
var foo = {bar:Array(1000).join('baz')};
console.log(foo); // this will truncate value of foo.bar
console.log(foo.bar); // this should show the whole text
If you still want to change the limit, here is my quick solution. It may not be the best way to do this, but if you can find a JS file responsible for Dev tools (for my Google Chrome installation the file is DevTools.js, for Safari 5 - InjectedScript.js), open it in a text editor, look for the function InjectedScript._describe. Inside this function you will find
if (obj.length > 100)
return "\"" + obj.substring(0, 100) + "\u2026\"";
increase the limit from 100 to sth else or remove both lines.
Rafael
2010-07-03 13:35:32