Command Line

From FirebugWiki

Jump to: navigation, search
Command Line‎

The Command Line appears along the bottom of the Console Panel and allows you to execute lines of JavaScript code within the context of the current website.

The red arrow ( CommandEditorSwitch.png ) in the lower right corner and the side panels toggle button ( SidePanelsToggleButton.png ) allow you to switch to the Command Editor.

The Command Line supports auto-completion using the Tab key. For example, typing 'w' followed by Tab completes it into 'window'. Cycling through the possible completions is done with the arrow keys. Since Firebug 1.6 there's also an popup with suggestions shown for the entered part of a command, unless disabled in the Console options.

In general the Command Line evaluates whatever expression you type in. It can be a single variable or a complete JavaScript program. The evaluation is done by passing the Command Line text into the page, calling eval() on it and passing back the result.

The Command Line also supports the Command Line API, a set of special purpose commands.


[edit] Command Line Popup

Command Line‎ Popup

The Command Line is also available in other panels through the Command Line Popup Button ( CommandLinePopupButton.png ). To see the output of the commands you have to drag the resizer above the Command Line Popup.

[edit] Features

[edit] Auto-Completion

Small Command Line‎

To support you analyzing elements and writing code the Command Line integrates an auto-completion for the commands you are typing. Therefore after starting to type a command you simply have to press Tab and Firebug is completing the command. It is also possible to complete a value with Enter or the arrow key or by clicking an item inside the Completion List Popup. If there are several commands starting with the same phrase like "getElem" you can use the and arrow keys before pressing Tab to alphabetically switch through all available commands. Also the global variables, which you defined in your script, are used. Furthermore the auto-completion is case-insensitive, which allows for rapid typing. E.g. entering "document.gete" offers "document.getElementById", "document.getElementsByClassName", "document.getElementsByName", "document.getElementsByTagName" and "document.getElementsByTagNameNS".

[edit] Shortcuts for inspected elements

The Command Line offers you the possibility to easily access elements inside the DOM similar to the sizzle selector library integrated in the jQuery Framework via the $x command.

[edit] Commands

There are different commands available providing a wide variaty of functionality. For a detailed description of the these commands see the Command Line API.

[edit] Inspect object in another panel

How you inspect elements using the console is described above. Besides that it's also possible to inspect them in the most appropriate panel by hitting Shift+Enter instead of just Enter. The console output also often contains links to other panels like the DOM Panel.

Inside the Console Panel the Command Line has some additional features.

[edit] Command History

The Command Line saves all executed commands in a history. You can go through that history by simply pressing and . The complete history of all the executed commands is available via CommandHistoryButton.png.

[edit] Smart code pasting

When you paste a multi-line script to the Command Line it automatically switches to the Command Editor, so that the line breaks are preserved and you can edit your script as you would do inside an editor.

Personal tools