首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

#firebug

通过“查看源代码”显示的HTML不同于(Firebug)开发者工具中显示的HTML吗?

啊偶我去Skype刚毕业的前端菜鸟

除了可能通过javascript等发生的动态DOM操作之外,Firefox还会解析和“清理”格式错误的(X)HTML,所以这些更改也会影响您在检查元素时看到的内容。

'控制台'是未定义的?

将以下内容粘贴到JavaScript的顶部(在使用控制台之前): /** * Protect window.console method calls, e.g. console is not defined on IE * unless dev tools are open, and IE doesn't define console.debug * * Chrome 41.0.2272.118: debug,error,info,log,warn,dir,dirxml,table,trace,assert,count,markTimeline,profile,profileEnd,time,timeEnd,timeStamp,timeline,timelineEnd,group,groupCollapsed,groupEnd,clea * Firefox 37.0.1: log,info,warn,error,exception,debug,table,trace,dir,group,groupCollapsed,groupEnd,time,timeEnd,profile,profileEnd,assert,count * Internet Explorer 11: select,log,info,warn,error,debug,assert,time,timeEnd,timeStamp,group,groupCollapsed,groupEnd,trace,clear,dir,dirxml,count,countReset,cd * Safari 6.2.4: debug,error,log,info,warn,clear,dir,dirxml,table,trace,assert,count,profile,profileEnd,time,timeEnd,timeStamp,group,groupCollapsed,groupEnd * Opera 28.0.1750.48: debug,error,info,log,warn,dir,dirxml,table,trace,assert,count,markTimeline,profile,profileEnd,time,timeEnd,timeStamp,timeline,timelineEnd,group,groupCollapsed,groupEnd,clea */ (function() { // Union of Chrome, Firefox, IE, Opera, and Safari console methods var methods = ["assert", "cd", "clear", "count", "countReset", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "select", "table", "time", "timeEnd", "timeStamp", "timeline", "timelineEnd", "trace", "warn"]; var length = methods.length; var console = (window.console = window.console || {}); var method; var noop = function() {}; while (length--) { method = methods[length]; // define undefined methods as noops to prevent errors if (!console[method]) console[method] = noop; } })();... 展开详请
将以下内容粘贴到JavaScript的顶部(在使用控制台之前): /** * Protect window.console method calls, e.g. console is not defined on IE * unless dev tools are open, and IE doesn't define console.debug * * Chrome 41.0.2272.118: debug,error,info,log,warn,dir,dirxml,table,trace,assert,count,markTimeline,profile,profileEnd,time,timeEnd,timeStamp,timeline,timelineEnd,group,groupCollapsed,groupEnd,clea * Firefox 37.0.1: log,info,warn,error,exception,debug,table,trace,dir,group,groupCollapsed,groupEnd,time,timeEnd,profile,profileEnd,assert,count * Internet Explorer 11: select,log,info,warn,error,debug,assert,time,timeEnd,timeStamp,group,groupCollapsed,groupEnd,trace,clear,dir,dirxml,count,countReset,cd * Safari 6.2.4: debug,error,log,info,warn,clear,dir,dirxml,table,trace,assert,count,profile,profileEnd,time,timeEnd,timeStamp,group,groupCollapsed,groupEnd * Opera 28.0.1750.48: debug,error,info,log,warn,dir,dirxml,table,trace,assert,count,markTimeline,profile,profileEnd,time,timeEnd,timeStamp,timeline,timelineEnd,group,groupCollapsed,groupEnd,clea */ (function() { // Union of Chrome, Firefox, IE, Opera, and Safari console methods var methods = ["assert", "cd", "clear", "count", "countReset", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "select", "table", "time", "timeEnd", "timeStamp", "timeline", "timelineEnd", "trace", "warn"]; var length = methods.length; var console = (window.console = window.console || {}); var method; var noop = function() {}; while (length--) { method = methods[length]; // define undefined methods as noops to prevent errors if (!console[method]) console[method] = noop; } })();

如何使用Firebug(或类似工具)调试JavaScript / jQuery事件绑定?

郁闷的阿涛不优雅的人
简而言之,假设某个事件处理程序被附加到您的元素(例如): $('#foo').click(function() { console.log('clicked!') }); 你像这样检查它: jQuery 1.3.x var clickEvents = $('#foo').data("events").click; jQuery.each(clickEvents, function(key, value) { console.log(value) // prints "function() { console.log('clicked!') }" }) jQuery 1.4.x var clickEvents = $('#foo').data("events").click; jQuery.each(clickEvents, function(key, handlerObj) { console.log(handlerObj.handler) // prints "function() { console.log('clicked!') }" }) 请参阅jQuery.fn.data(jQuery在哪里存储您的处理程序)。 jQuery 1.8.x var clickEvents = $._data($('#foo')[0], "events").click; jQuery.each(clickEvents, function(key, handlerObj) { console.log(handlerObj.handler) // prints "function() { console.log('clicked!') }" })... 展开详请

当抛出一个异常时,如何获得一个Javascript堆栈跟踪?

在Firefox中,似乎你不需要抛出异常。这是足够的 e = new Error(); console.log(e.stack);... 展开详请
领券