GetFirebug logo



Firebug Tips & Tricks

MozCamp CZ Brno, Březen 2012
Jan Odvárko


getfirebug.com
softwareishard.com

Agenda

Current Release

Introduction

Cookies

  • Firecookie Firebug extension - Cookie Manager
    • Console panel integration
    • Break on Cookie Change
    • Conditional breakpoints
      cookie.value == "Some Value"

    • Better Console logging for: document.cookies


Colors

  • Firepicker
    Firebug extension - Color Picker

Font Family

  • FireFontFamily
    Firebug extension
  • What font-family is actually used?

  • Inspect me...

Font Preview

  • Net panel preview
  • Style panel tooltip
Inspect me...
@font-face {
    font-family: "My Font";
    src: url('myFont.woff') format("woff");
}

#myLabel {
    font-family: "My Font";
}

HTML Entities

  • Show Entities As Symbols:
  • Show Entities As Names: ∫
  • Show Entities As Unicode ∫
Introduced in Firebug 1.10

Modify Values at Runtime

Break on XHR

  • Break on XHR
  • Conditional Breakpoints
    • URL Parameter Value
      param-name == value
    • POST body
      $postBody.indexOf("keyword")


Condition: count == 1

Break on HTML Mutation

  • Break on Mutation
    • Attribute Change
    • New Element
    • Remove Element


Event Monitoring

  • Event logging in to the Console panel
  • Command line API: monitorEvents(element, event-type);
Move mouse over this area
monitorEvents($("#testElement")[0], "mousemove")
unmonitorEvents($("#testElement")[0], "mousemove")
Note: $ method comes from jQuery on these slides

Net Export

  • NetExport
    Firebug extension
  • Export Data collected by the Net panel
  • HTTP Archive (HAR) format
  • HAR Viewer
{
  "log": {
    "version": "1.1",
    "creator": {
      "name": "Firebug",
      "version": "1.10"
    },
    "pages": [ ... ],
    "entries": [ ... ]
}

HTTP Response

  • HTML Preview
  • JSON Inspector
  • XML Inspector

  • Extensible, e.g. Cookies


Inspector History

  1. Start inspecting
  2. Select an element on the page
  1. Use $0 in the console
Console API: $0, $1, $n(index)

CSS Usage

Extend Console API

  • Include jQuery on the page, execute in Firebug's command line:
  • var s=document.createElement('script');
    s.setAttribute('src','http://jquery.com/src/jquery-latest.js');
    document.getElementsByTagName('body')[0].appendChild(s);

  • Use jQuery API on the command line:
    • jQuery("img").slideUp()
    • jQuery("img").slideDown()

FireQuery

jQuery.data()

Question Time