Class goog.events.BrowserEvent

code »
goog.events.Event
  └ goog.events.BrowserEvent

Accepts a browser event object and creates a patched, cross browser event object. The content of this object will not be initialized if no event object is provided. If this is the case, init() needs to be invoked separately.

Constructor

goog.events.BrowserEvent ( opt_e, opt_currentTarget )
Parameters
opt_e: Event=
Browser event object.
opt_currentTarget: EventTarget=
Current target for event.

Enumerations

goog.events.BrowserEvent.MouseButton
Normalized button constants for the mouse.
Show:

Instance Methods

Defined in goog.events.BrowserEvent

Returns
The underlying browser event object.
code »init ( e, opt_currentTarget )

Accepts a browser event object and creates a patched, cross browser event object.

Parameters
e: Event
Browser event object.
opt_currentTarget: EventTarget=
Current target for event.
code »isButton ( button )boolean

Tests to see which button was pressed during the event. This is really only useful in IE and Gecko browsers. And in IE, it's only useful for mousedown/mouseup events, because click only fires for the left mouse button. Safari 2 only reports the left button being clicked, and uses the value '1' instead of 0. Opera only reports a mousedown event for the middle button, and no mouse events for the right button. Opera has default behavior for left and middle click that can only be overridden via a configuration setting. There's a nice table of this mess at http://www.unixpapa.com/js/mouse.html.

Parameters
button: goog.events.BrowserEvent.MouseButton
The button to test for.
Returns
True if button was pressed.

Whether this has an "action"-producing mouse button. By definition, this includes left-click on windows/linux, and left-click without the ctrl key on Macs.

Returns
The result.

Defined in goog.events.Event

Deprecated: Events don't need to be disposed.

For backwards compatibility (goog.events.Event used to inherit goog.Disposable).

Instance Properties

Defined in goog.events.BrowserEvent

Whether alt was pressed at time of event.

Which mouse button was pressed.

Keycode of key press.

X-coordinate relative to the window.

Y-coordinate relative to the window.

Whether control was pressed at time of event.

Node that had the listener attached.

The browser event object.

Keycode of key press.

Whether the meta key was pressed at time of event.

X-coordinate relative to target.

Y-coordinate relative to target.

Whether the default platform modifier key was pressed at time of event. (This is control for all platforms except Mac, where it's Meta.)

For mouseover and mouseout events, the related object for the event.

X-coordinate relative to the monitor.

Y-coordinate relative to the monitor.

Whether shift was pressed at time of event.

History state object, only set for PopState events where it's a copy of the state object provided to pushState or replaceState.

Target that fired the event.

Defined in goog.events.Event

Whether the default action has been prevented. This is a property to match the W3C specification at #events-event-type-defaultPrevented. Must be treated as read-only outside the class.

Whether to cancel the event in internal capture/bubble processing for IE.

Return value for in internal capture/bubble processing for IE.

Event type.

Static Properties

Static data for mapping mouse buttons.