@samitouri / QOS-React-2 / commits / 9e6456ba41

Add SyntheticDragEvent with "dataTransfer" property

Andreas Svensson committed Dec 27, 2013 at 21:01 UTC 9e6456ba41adb79157265133e8c97c7543357871
2 files changed +51 -4
src/event/synthetic/SyntheticDragEvent.js new
+44
@@ -0,0 +1,44 @@
1 +/**
2 + * Copyright 2013 Facebook, Inc.
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + *
16 + * @providesModule SyntheticDragEvent
17 + * @typechecks static-only
18 + */
19 +
20 +"use strict";
21 +
22 +var SyntheticMouseEvent = require('SyntheticMouseEvent');
23 +
24 +/**
25 + * @interface DragEvent
26 + * @see http://www.w3.org/TR/DOM-Level-3-Events/
27 + */
28 +var DragEventInterface = {
29 + dataTransfer: null
30 +};
31 +
32 +/**
33 + * @param {object} dispatchConfig Configuration used to dispatch this event.
34 + * @param {string} dispatchMarker Marker identifying the event target.
35 + * @param {object} nativeEvent Native browser event.
36 + * @extends {SyntheticUIEvent}
37 + */
38 +function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
39 + SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
40 +}
41 +
42 +SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
43 +
44 +module.exports = SyntheticDragEvent;
src/eventPlugins/SimpleEventPlugin.js
+7 -4
@@ -25,6 +25,7 @@ var SyntheticEvent = require('SyntheticEvent');
25 var SyntheticFocusEvent = require('SyntheticFocusEvent');
26 var SyntheticKeyboardEvent = require('SyntheticKeyboardEvent');
27 var SyntheticMouseEvent = require('SyntheticMouseEvent');
28 +var SyntheticDragEvent = require('SyntheticDragEvent');
29 var SyntheticTouchEvent = require('SyntheticTouchEvent');
30 var SyntheticUIEvent = require('SyntheticUIEvent');
31 var SyntheticWheelEvent = require('SyntheticWheelEvent');
@@ -315,6 +316,11 @@ var SimpleEventPlugin = {
316 /* falls through */
317 case topLevelTypes.topContextMenu:
318 case topLevelTypes.topDoubleClick:
319 + case topLevelTypes.topMouseDown:
320 + case topLevelTypes.topMouseMove:
321 + case topLevelTypes.topMouseUp:
322 + EventConstructor = SyntheticMouseEvent;
323 + break;
324 case topLevelTypes.topDrag:
325 case topLevelTypes.topDragEnd:
326 case topLevelTypes.topDragEnter:
@@ -323,10 +329,7 @@ var SimpleEventPlugin = {
329 case topLevelTypes.topDragOver:
330 case topLevelTypes.topDragStart:
331 case topLevelTypes.topDrop:
326 - case topLevelTypes.topMouseDown:
327 - case topLevelTypes.topMouseMove:
328 - case topLevelTypes.topMouseUp:
329 - EventConstructor = SyntheticMouseEvent;
332 + EventConstructor = SyntheticDragEvent;
333 break;
334 case topLevelTypes.topTouchCancel:
335 case topLevelTypes.topTouchEnd: