Webkit Develop Inspektor显示长字符串 [英] Webkit Develop Inspektor show long strings

查看:38
本文介绍了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.

这篇关于Webkit Develop Inspektor显示长字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆