[英]Google Chrome console format html
Is it possible to make Google Chrome console to format output html
. 是否可以使Google Chrome浏览器控制台格式化输出html
。 So if I will 所以如果我愿意
console.log('<ul><li>1</li><li>2</li></ul>');
It will show real list instad of html markup 它将显示html标记的真实列表instad
No, it does not seem possible. 不,这似乎不可能。 The Console API reference for Google Chrome mentions no such thing. Google Chrome的Console API参考未提及此类内容。
You can however create a debug div
tag and add your contents to that: 但是,您可以创建一个debug div
标签并将其内容添加到其中:
<div id='debug'></div>
and 和
document.getElementById('debug').innerHTML = '<ul><li>1</li><li>2</li></ul>';
A simple hack might be something like this: 一个简单的黑客可能是这样的:
console.html = function(data){
var self = this;
for(var i=0; i< arguments.length;i++){
var wrapper= document.createElement('wrapper');
wrapper.innerHTML = arguments[i];
self.log(wrapper)
}
}
Yes, 是,
you can show a list using 您可以使用显示清单
console.log("hi",[1,2,3,4],"ho");
(The ,
are important, +
will convert the array into String. ( ,
很重要, +
会将数组转换为String。
No, plain html is not possible. 不,不可能使用纯HTML。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.