goog.events.BrowserEvent
Provided By | |
---|---|
Extends | |
All Known Direct Subclasses |
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.
new BrowserEvent( opt_e, opt_currentTarget )
Parameters |
|
---|
Instance Methods
this.getBrowserEvent() → (Event|null)
(Event|null)
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.hasPropagationStopped() → boolean
boolean
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.init( e, opt_currentTarget ) → void
void
Accepts a browser event object and creates a patched, cross browser event object.
Parameters |
|
---|
this.isButton( button ) → boolean
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 |
| ||||
---|---|---|---|---|---|
Returns |
|
this.isMouseActionButton() → boolean
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.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.preventDefault() → void
void
Prevents the default action, for example a link redirecting to a url.
Overrides | |
---|---|
Parameters | None. |
this.stopPropagation() → void
void
Instance Properties
this.altKey → boolean
boolean
Whether alt was pressed at time of event.
this.button → number
number
Which mouse button was pressed.
this.charCode → number
number
Keycode of key press.
this.clientX → number
number
X-coordinate relative to the window.
this.clientY → number
number
Y-coordinate relative to the window.
this.ctrlKey → boolean
boolean
Whether control was pressed at time of event.
this.currentTarget → (Node|null|undefined)
(Node|null|undefined)
this.defaultPrevented → boolean
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.
this.key → string
string
Key of key press.
this.keyCode → number
number
Keycode of key press.
this.metaKey → boolean
boolean
Whether the meta key was pressed at time of event.
this.offsetX → number
number
X-coordinate relative to target.
this.offsetY → number
number
Y-coordinate relative to target.
this.platformModifierKey → boolean
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.)
this.pointerId → number
number
No information.
this.pointerType → string
string
No information.
this.relatedTarget → (Node|null)
(Node|null)
For mouseover and mouseout events, the related object for the event.
this.row → ?
?
No information.
this.rowNode → (Element|null|undefined)
(Element|null|undefined)
No information.
this.screenX → number
number
X-coordinate relative to the monitor.
this.screenY → number
number
Y-coordinate relative to the monitor.
this.shiftKey → boolean
boolean
Whether shift was pressed at time of event.
this.state → (Object|null)
(Object|null)
History state object, only set for PopState events where it's a copy of the state object provided to pushState or replaceState.
this.target → (Node|null)
(Node|null)
this.type → string
string
Event type.
Static Properties
Static data for mapping mouse buttons.
warning Deprecated | Use |
---|
Static data for mapping mouse buttons.
BrowserEvent.IE_POINTER_TYPE_MAP → Object<number, goog.events.BrowserEvent.PointerType>
Object<number, goog.events.BrowserEvent.PointerType>
Static data for mapping MSPointerEvent types to PointerEvent types.
Compiler Constants
goog.events.BrowserEvent.USE_LAYER_XY_AS_OFFSET_XY → boolean
boolean
If true, use the layerX and layerY properties of a native browser event over the offsetX and offsetY properties, which cause expensive reflow. If layerX or layerY is not defined, offsetX and offsetY will be used as usual.