Command Editor

From FirebugWiki

Jump to: navigation, search
Large Command Line (Command Editor)

The Command Editor within the Console Panel allows you to execute multi-line JavaScript code within the context of the page.

To switch to the Command Line you can use the side panels toggle button ( SidePanelsToggleButton.png ) in the very right of the panel toolbar. In Firebug versions before 2.0 there was a red arrow at the lower right ( CommandLineSwitch.png ) for that.

In general the Command Editor 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.

Contents

[edit] Auto-Completion

The Command Editor supports auto-completion. To open the context-sensitive Completion List Popup press Tab, then choose an item from the list via the Up/Down key and hit Enter on the item you want to use. For example, typing 'window.' followed by Tab shows a list with all global variables.


Completion List Popup‎

To support you analyzing elements and writing code the Command Editor 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 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 offered.

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] Panel Toolbar

[edit] Run

Executes the entered script in the context of the current website.

[edit] Clear

Empties the Command Editor.

[edit] Copy

The entered script is copied as bookmarklet.

[edit] Pretty Print

The entered code is formatted and indented for better readability.

[edit] History

The Command Line saves all executed commands in a history. This button opens the Command History Popup listing all previously executed scripts. To load a script click the according entry within the popup.

Personal tools