FireBug Command Line API

Firebug 命令行提供了一些特殊的函数

The Firebug command line provides these special functions for your convenience:
$(id)

根据ID返回一个元素,类似document.getElementById

Returns a single element with the given id.
$$(selector)

根据GSS selector返回一个元素数组

Returns an array of elements that match the given CSS selector.
$x(xpath)

根据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.
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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值