首页 Firefox Firebug使用文档

Firefox Firebug使用文档

举报
开通vip

Firefox Firebug使用文档Firefox Firebug使用文档 Firebug?Document FIREBUG?DOCUMENT............................................................................................................1 COMMAND?LINE?API...................................................................................

Firefox Firebug使用文档
Firefox Firebug使用文档 Firebug?Document FIREBUG?DOCUMENT............................................................................................................1 COMMAND?LINE?API...............................................................................................................2 CONSOLE?API.........................................................................................................................3 console.log(object[,?object,?...]).....................................................................................4console.debug(object[,?object,?...])................................................................................4console.info(object[,?object,?...])....................................................................................4console.warn(object[,?object,?...])..................................................................................4console.error(object[,?object,?...])..................................................................................4console.assert(expression[,?object,?...])........................................................................4console.dir(object)..........................................................................................................5console.dirxml(node)......................................................................................................5console.trace().................................................................................................................5 console.group(object[,?object,?...]).................................................................................5console.groupCollapsed(object[,?object,?...])................................................................5console.groupEnd()........................................................................................................5console.time(name)........................................................................................................5console.timeEnd(name)..................................................................................................5console.profile([title])......................................................................................................5console.profileEnd()........................................................................................................5console.count([title]).......................................................................................................5IMPLEMENTATION?NOTES...............................................................................................................6Firebug?1.4.......................................................................................................................6 Firebug?1.3.......................................................................................................................6 Firebug?1.2.......................................................................................................................6 Firebug?1.1?and?earlier....................................................................................................6 KEYBOARD?AND?MOUSE?SHORTCUTS................................................................................6Global...............................................................................................................................6 HTML?Tab.........................................................................................................................6 HTML?Editor.....................................................................................................................7 HTML?Inspect?Mode........................................................................................................7Script?Tab.........................................................................................................................7 DOM?Tab...........................................................................................................................7 DOM?and?Watch?Editor...................................................................................................7CSS?Tab............................................................................................................................8 CSS?Editor.......................................................................................................................8 Layout?Tab.......................................................................................................................8 1 / 8 Layout?Editor...................................................................................................................8 Command?Line?(small)....................................................................................................8 Command?Line?API The Firebug command line provides these special functions for your convenience:$(id) Returns a single element with the given id. $$(selector) Returns an array of elements that match the given CSS selector. $x(xpath) Returns an array of elements that match the given XPath expression. dir(object) Prints an interactive listing of all properties of the object. This looks identical to the view that you would see in the DOM tab. dirxml(node) Prints the XML source tree of an HTML or XML element. This looks identical to the view that you would see in the HTML tab. You can click on any node to inspect it in the HTML tab. cd(window) By default, command line expressions are relative to the top-level window of the page. cd() allows you to use the window of a frame in the page instead. clear() Clears the console. inspect(object[, tabName]) Inspects an object in the most suitable tab, or the tab identified by the optional argument tabName. The available tab names are "html", "css", "script", and "dom". keys(object) Returns an array containing the names of all properties of the object. 2 / 8 values(object) Returns an array containing the values of all properties of the object.debug(fn) Adds a breakpoint on the first line of a function. undebug(fn) Removes the breakpoint on the first line of a function. monitor(fn) Turns on logging for all calls to a function. unmonitor(fn) Turns off logging for all calls to a function. monitorEvents(object[, types]) Turns on logging for all events dispatched to an object. The optional argument types may specify a specific family of events to log. The most commonly used values for types are "mouse" and "key". The full list of available types includes "composition", "contextmenu", "drag", "focus", "form", "key", "load", "mouse", "mutation", "paint", "scroll", "text", "ui", and "xul". unmonitorEvents(object[, types]) Turns off logging for all events dispatched to an object.profile([title]) Turns on the JavaScript profiler. The optional argument title would contain the text to be printed in the header of the profile report. profileEnd() Turns off the JavaScript profiler and prints its report. Console API Firebug adds a global variable named "console" to all web pages loaded in Firefox. This object contains many methods that allow you to write to the Firebug console to expose information that is flowing through your scripts. 3 / 8 console.log(object[, object, ...]) Writes a message to the console. You may pass as many arguments as you'd like, and they will be joined together in a space-delimited line. The first argument to log may be a string containing printf-like string substitution patterns. For example: console.log("The %s jumped over %d tall buildings", animal, count);The example above can be re-written without string substitution to achieve the same result: console.log("The", animal, "jumped over", count, "tall buildings");These two techniques can be combined. If you use string substitution but provide more arguments than there are substitution patterns, the remaining arguments will be appended in a space-delimited line, like so: console.log("I am %s and I have:", myName, thing1, thing2, thing3);If objects are logged, they will be written not as static text, but as interactive hyperlinks that can be clicked to inspect the object in Firebug's HTML, CSS, Script, or DOM tabs. You may also use the %o pattern to substitute a hyperlink in a string.Here is the complete set of patterns that you may use for string substitution:String Substitution Patterns %sString %d, %iInteger (numeric formatting is not yet supported) %fFloating point number (numeric formatting is not yet supported) %oObject hyperlink console.debug(object[, object, ...]) Writes a message to the console, including a hyperlink to the line where it was called.console.info(object[, object, ...]) Writes a message to the console with the visual "info" icon and color coding and a hyperlink to the line where it was called. console.warn(object[, object, ...]) Writes a message to the console with the visual "warning" icon and color coding and a hyperlink to the line where it was called. console.error(object[, object, ...]) Writes a message to the console with the visual "error" icon and color coding and a hyperlink to the line where it was called. console.assert(expression[, object, ...]) Tests that an expression is true. If not, it will write a message to the console and throw an exception. 4 / 8 console.dir(object) Prints an interactive listing of all properties of the object. This looks identical to the view that you would see in the DOM tab. console.dirxml(node) Prints the XML source tree of an HTML or XML element. This looks identical to the view that you would see in the HTML tab. You can click on any node to inspect it in the HTML tab. console.trace() Prints an interactive stack trace of JavaScript execution at the point where it is called.The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function. You can click each function to take you to its source in the Script tab, and click each argument value to inspect it in the DOM or HTML tabs.console.group(object[, object, ...]) Writes a message to the console and opens a nested block to indent all future messages sent to the console. Call console.groupEnd() to close the block. console.groupCollapsed(object[, object, ...]) Like console.group(), but the block is initially collapsed. console.groupEnd() Closes the most recently opened block created by a call to console.group() or console.groupEnd() console.time(name) Creates a new timer under the given name. Call console.timeEnd(name) with the same name to stop the timer and print the time elapsed.. console.timeEnd(name) Stops a timer created by a call to console.time(name) and writes the time elapsed. console.profile([title]) Turns on the JavaScript profiler. The optional argument title would contain the text to be printed in the header of the profile report. console.profileEnd() Turns off the JavaScript profiler and prints its report. console.count([title]) Writes the number of times that the line of code where count was called was executed. 5 / 8 The optional argument title will print a message in addition to the number of the count. Implementation Notes The console is an object attached to the window object in the web page. In Firebug for Firefox the object is attached only if the Console panel is enabled. In Firebug lite, the console is attached if Lite is installed in the page. Firebug 1.4 The console is implemented by adding a div element and a script tag to the web page just before the first Javascript script tag is run. So the first script tag is compiled, then the console is injected, then the outer function code of the script tag is executed. Firebug 1.3 As in Firebug 1.4 Firebug 1.2 The code and tags are added on document load event.Firebug 1.1 and earlier The console is implemented with an insecure techniqueKeyboard?and?Mouse?ShortcutsGlobal Open Firebug PanelF12 Close Firebug PanelF12 Open Firebug in WindowCtrl+F12 Switch to Previous TabCtrl+` Focus Command LineCtrl+Shift+L Focus Search BoxCtrl+Shift+K Toggle Inspect ModeCtrl+Shift+C Toggle JavaScript ProfilerCtrl+Shift+P Re-Execute Last Command LineCtrl+Shift+E HTML Tab Edit AttributeClick on name or value 6 / 8 Edit Text NodeClick on textEdit ElementDouble-Click tag nameNext Node in PathCtrl+. Previous Node in PathCtrl+, HTML Editor Finish EditingReturn Cancel EditingEsc Advance to Next FieldTab Advance to Previous FieldShift+Tab HTML Inspect Mode Cancel InspectionEsc Inspect ParentCtrl+Up Inspect ChildCtrl+Down Script Tab ContinueF8 Ctrl+/ Step OverF10 Ctrl+' Step IntoF11 Ctrl+; Step OutShift+F11 Ctrl+Shift+; Toggle BreakpointClick on line numberDisable BreakpointShift+Click on line numberEdit Breakpoint ConditionRight-Click on line numberRun to LineMiddle-Click on line number Ctrl+Click on line numberNext Function on StackCtrl+. Previous Function on StackCtrl+, Focus Menu of ScriptsCtrl+Space Focus Watch EditorCtrl+Shift+N DOM Tab Edit PropertyDouble-Click on empty spaceNext Object in PathCtrl+. Previous Object in PathCtrl+, DOM and Watch Editor Finish EditingReturn Cancel EditingEsc Autocomplete Next PropertyTab Autocomplete Previous PropertyShift+Tab 7 / 8 CSS Tab Edit PropertyClick on propertyInsert New PropertyDouble-Click on white-space Focus Menu of Style SheetsCtrl+SpaceCSS Editor Finish EditingReturnCancel EditingEsc Advance to Next FieldTab Advance to Previous FieldShift+TabIncrease Number by OneUp Decrease Number by OneDown Increase Number by TenPage UpDecrease Number by TenPage DownAutocomplete Next KeywordUp Autocomplete Previous KeywordDown Layout Tab Edit ValueClick on valueLayout Editor Finish EditingReturnCancel EditingEsc Advance to Next FieldTab Advance to Previous FieldShift+TabIncrease Number by OneUp Decrease Number by OneDown Increase Number by TenPage UpDecrease Number by TenPage DownCommand Line (small)Autocomplete Next PropertyTab Autocomplete Previous PropertyShift+TabExecuteReturnInspect ResultShift+ReturnOpen Result's Context MenuCtrl+ReturnCommand Line (large)ExecuteCtrl+Return 8 / 8
本文档为【Firefox Firebug使用文档】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_477730
暂无简介~
格式:doc
大小:87KB
软件:Word
页数:0
分类:互联网
上传时间:2018-09-30
浏览量:15