Webkit Develop Inspektor显示长字符串
当我在webkit浏览器(fe Safari)中调试javascript时,通常我会遇到一些字符串变量,并且这些变量的值通常很长,因此,webkit会以"..."结尾使其更短,但我想看看所有这些变量的值,我该怎么办?
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?
据我所知,所有文本仅在被列为对象的属性时才会被截断.如果您直接记录一个文本变量,它将显示整个文本.
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
如果您仍然想更改限制,这是我的快速解决方案.这样做可能不是最好的方法,但是如果您找到负责开发工具的JS文件(对于我的Google Chrome安装,该文件是DevTools.js,对于Safari 5-InjectedScript.js),请以文本形式打开编辑器中,查找函数InjectedScript._describe.在此功能内,您将找到
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\"";
将限制从100增加到其他,或删除两行.
increase the limit from 100 to sth else or remove both lines.