MonitorEvents

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
(Extended description)
m (Added categories)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
{{needsHelp}}
+
Turns on logging for all or specific events dispatched to an object.
-
 
+
-
Turns on logging for all events dispatched to an object. The optional argument <code>types</code> may define specific events or event types to log.
+
== Syntax ==
== Syntax ==
Line 13: Line 11:
=== types ===
=== types ===
-
Event type(s) to log. This can be a single event type or an array of event types.
+
Event type(s) to log. This can be a single event type or an array of event types. (optional)
Besides supporting all normal events Firebug and Web Inspector offer a bunch of event groups, which combine several event types.
Besides supporting all normal events Firebug and Web Inspector offer a bunch of event groups, which combine several event types.
Line 32: Line 30:
| <code>focus</code> || <code>blur</code>, <code>focus</code> || -
| <code>focus</code> || <code>blur</code>, <code>focus</code> || -
|-
|-
-
| <code>form</code> || <code>change</code>, <code>input</code>, , <code>reset</code>, <code>select</code><code>submit</code> || -
+
| <code>form</code> || <code>change</code>, <code>input</code>, <code>reset</code>, <code>select</code><code>submit</code> || -
|-
|-
| <code>key</code> || <code>keydown</code>, <code>keypress</code>, <code>keyup</code> || <code>keydown</code>, <code>keypress</code>, <code>keyup</code>, <code>textInput</code>
| <code>key</code> || <code>keydown</code>, <code>keypress</code>, <code>keyup</code> || <code>keydown</code>, <code>keypress</code>, <code>keyup</code>, <code>textInput</code>
Line 48: Line 46:
| <code>text</code> || <code>text</code> || -
| <code>text</code> || <code>text</code> || -
|-
|-
-
| <code>touch</code> || - || <code>touchcancel</code>, <code>touchend</code>, <code>touchmove</code>, <code>touchstart</code>
+
| <code>touch</code> || <code>touchstart</code>, <code>touchend</code>, <code>touchmove</code>, <code>touchenter</code>, <code>touchleave</code>, <code>touchcancel</code> ([http://code.google.com/p/fbug/issues/detail?id=5893 since Firebug 1.11]) || <code>touchstart</code>, <code>touchend</code>, <code>touchmove</code>, <code>touchcancel</code>
|-
|-
| <code>ui</code> || <code>DOMActivate</code>, <code>DOMFocusIn</code>, <code>DOMFocusOut</code> || -
| <code>ui</code> || <code>DOMActivate</code>, <code>DOMFocusIn</code>, <code>DOMFocusOut</code> || -
Line 85: Line 83:
* [[unmonitorEvents]]
* [[unmonitorEvents]]
* [[Command Line API]]
* [[Command Line API]]
 +
 +
[[Category:Firebug]]
 +
[[Category:UI]]
 +
[[Category:API]]

Latest revision as of 00:06, 22 November 2013

Turns on logging for all or specific events dispatched to an object.

Contents

[edit] Syntax

monitorEvents(object[, types])

[edit] Parameters

[edit] object

Object to log events for. (required)

[edit] types

Event type(s) to log. This can be a single event type or an array of event types. (optional)

Besides supporting all normal events Firebug and Web Inspector offer a bunch of event groups, which combine several event types.

[edit] Event groups

Group Included events in Firebug Included events in Web Inspector
composition composition, compositionend, compositionstart -
contextmenu contextmenu -
control - blur, change, focus, reset, resize, scroll, select, submit, zoom
drag dragdrop, dragenter, dragexit, draggesture, dragover -
focus blur, focus -
form change, input, reset, selectsubmit -
key keydown, keypress, keyup keydown, keypress, keyup, textInput
load abort, beforeunload, error, load, unload -
mouse click, dblclick, mousedown, mousemove, mouseup, mouseout, mouseover click, dblclick, mousedown, mousemove, mouseup, mouseout, mouseover, mousewheel
mutation DOMSubtreeModified, DOMNodeInserted, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMNodeInsertedIntoDocument, DOMAttrModified, DOMCharacterDataModified -
paint paint, resize, scroll -
scroll overflow, underflow, overflowchanged -
text text -
touch touchstart, touchend, touchmove, touchenter, touchleave, touchcancel (since Firebug 1.11) touchstart, touchend, touchmove, touchcancel
ui DOMActivate, DOMFocusIn, DOMFocusOut -
xul popupshowing, popupshown, popuphiding, popuphidden, close, command, broadcast, commandupdate -
clipboard cut, copy, paste -

[edit] Examples

monitorEvents(document.body)

This will monitor all events occurring to the <body> element.

monitorEvents(document.getElementsByTagName("input")[0], "keydown")

This will monitor all keydown events occurring to the first <input> element.

monitorEvents(document.getElementById("interactive"), "mouse")

This will monitor all mouse events (click, dblclick, mousedown, mousemove, mouseup, mouseout and mouseover) occurring to the element with the id interactive.

monitorEvents(document.getElementById("interactive"), ["mouse", "keyup", "keydown"])

This will monitor all mouse events (click, dblclick, mousedown, mousemove, mouseup, mouseout and mouseover) plus all keyup and keydown events occurring to the element with the id interactive.

[edit] See also

Personal tools