# 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:Public Protected Private

## Instance Methods

### Defined in `goog.events.BrowserEvent`

code »disposeInternal ( )
code »getBrowserEvent ( ) ⇒ `Event`

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.

code »isMouseActionButton ( ) ⇒ `boolean`

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.

code »preventDefault ( )
code »stopPropagation ( )

### Defined in `goog.events.Event`

code »dispose ( )
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`

code »altKey : `boolean`

Whether alt was pressed at time of event.

code »button : `number`

Which mouse button was pressed.

code »charCode : `number`

Keycode of key press.

code »clientX : `number`

X-coordinate relative to the window.

code »clientY : `number`

Y-coordinate relative to the window.

code »ctrlKey : `boolean`

Whether control was pressed at time of event.

code »currentTarget : `(Node|undefined)`

Node that had the listener attached.

code »event_ : `Event`

The browser event object.

code »keyCode : `number`

Keycode of key press.

code »metaKey : `boolean`

Whether the meta key was pressed at time of event.

code »offsetX : `number`

X-coordinate relative to target.

code »offsetY : `number`

Y-coordinate relative to target.

code »platformModifierKey : `boolean`

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

code »relatedTarget : `Node`

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

code »screenX : `number`

X-coordinate relative to the monitor.

code »screenY : `number`

Y-coordinate relative to the monitor.

code »shiftKey : `boolean`

Whether shift was pressed at time of event.

code »state : `Object`

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

code »target : `Node`

Target that fired the event.

### Defined in `goog.events.Event`

code »defaultPrevented : `boolean`

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.

code »propagationStopped_ : `boolean`

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

code »returnValue_ : `boolean`

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

code »type : `string`

Event type.

## Static Properties

code »goog.events.BrowserEvent.IEButtonMap : `!Array.<number>`

Static data for mapping mouse buttons.

code »goog.events.BrowserEvent.superClass_ : `goog.events.Event.prototype`