react / react-0.13.3 / examples / basic-commonjs / node_modules / reactify / node_modules / react-tools / src / browser / syntheticEvents / SyntheticUIEvent.js
81155 views/**1* Copyright 2013-2014, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule SyntheticUIEvent9* @typechecks static-only10*/1112"use strict";1314var SyntheticEvent = require('SyntheticEvent');1516var getEventTarget = require('getEventTarget');1718/**19* @interface UIEvent20* @see http://www.w3.org/TR/DOM-Level-3-Events/21*/22var UIEventInterface = {23view: function(event) {24if (event.view) {25return event.view;26}2728var target = getEventTarget(event);29if (target != null && target.window === target) {30// target is a window object31return target;32}3334var doc = target.ownerDocument;35// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.36if (doc) {37return doc.defaultView || doc.parentWindow;38} else {39return window;40}41},42detail: function(event) {43return event.detail || 0;44}45};4647/**48* @param {object} dispatchConfig Configuration used to dispatch this event.49* @param {string} dispatchMarker Marker identifying the event target.50* @param {object} nativeEvent Native browser event.51* @extends {SyntheticEvent}52*/53function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {54SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);55}5657SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);5859module.exports = SyntheticUIEvent;606162