Home

# Class 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.

extends goog.events.Event

Instance Method Summary

`disposeInternal()`

Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:

    mypackage.MyClass = function() {
    goog.base(this);
    // Constructor logic specific to MyClass.
    ...
    };
    goog.inherits(mypackage.MyClass, goog.Disposable);

    mypackage.MyClass.prototype.disposeInternal = function() {
    goog.base(this, 'disposeInternal');
    // Dispose logic specific to MyClass.
    ...
    };

| `getBrowserEvent() ⇒ ?Event`
| `init(?Event e, ?Node= opt_currentTarget)` Accepts a browser event object and creates a patched, cross browser event object.

`isButton(?goog.events.BrowserEvent.MouseButton 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.

| `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.
| `preventDefault()` Prevents the default action, for example a link redirecting to a url.
| `stopPropagation()` Stops event propagation.