react 0.13.0 → 0.14.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/addons.js +7 -0
- package/addons/CSSTransitionGroup.js +1 -0
- package/addons/LinkedStateMixin.js +1 -0
- package/addons/Perf.js +1 -0
- package/addons/PureRenderMixin.js +1 -0
- package/addons/TestUtils.js +1 -0
- package/addons/TransitionGroup.js +1 -0
- package/addons/batchedUpdates.js +1 -0
- package/addons/cloneWithProps.js +1 -0
- package/addons/createFragment.js +1 -0
- package/addons/renderSubtreeIntoContainer.js +1 -0
- package/addons/shallowCompare.js +1 -0
- package/addons/update.js +1 -0
- package/dist/JSXTransformer.js +3336 -1671
- package/dist/react-with-addons.js +3134 -5113
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +2812 -4567
- package/dist/react.min.js +5 -5
- package/lib/AutoFocusMixin.js +4 -3
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +9 -4
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +24 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +41 -65
- package/lib/DOMPropertyOperations.js +30 -51
- package/lib/Danger.js +19 -60
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +27 -38
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +12 -18
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +34 -64
- package/lib/LocalEventTrapMixin.js +9 -16
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +8 -11
- package/lib/React.js +20 -38
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +18 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +7 -16
- package/lib/ReactClass.js +78 -231
- package/lib/ReactComponent.js +17 -33
- package/lib/ReactComponentBrowserEnvironment.js +4 -6
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +4 -5
- package/lib/ReactCompositeComponent.js +85 -297
- package/lib/ReactContext.js +2 -44
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +3 -4
- package/lib/ReactDOMComponent.js +185 -146
- package/lib/ReactDOMForm.js +3 -3
- package/lib/ReactDOMIDOperations.js +11 -20
- package/lib/ReactDOMIframe.js +3 -3
- package/lib/ReactDOMImg.js +3 -3
- package/lib/ReactDOMInput.js +22 -35
- package/lib/ReactDOMOption.js +52 -10
- package/lib/ReactDOMSelect.js +53 -29
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +15 -27
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +21 -40
- package/lib/ReactDefaultPerf.js +41 -72
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +35 -72
- package/lib/ReactElementValidator.js +51 -110
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +2 -2
- package/lib/ReactEventEmitterMixin.js +3 -12
- package/lib/ReactEventListener.js +16 -38
- package/lib/ReactFragment.js +23 -54
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +11 -21
- package/lib/ReactInstanceHandles.js +27 -57
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactLifeCycle.js +1 -1
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +136 -260
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +7 -11
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +13 -46
- package/lib/ReactReconcileTransaction.js +9 -34
- package/lib/ReactReconciler.js +9 -19
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +7 -15
- package/lib/ReactServerRenderingTransaction.js +7 -32
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +94 -166
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +27 -90
- package/lib/ReactUpdates.js +27 -79
- package/lib/ReactWithAddons.js +7 -6
- package/lib/SVGDOMPropertyConfig.js +41 -2
- package/lib/SelectEventPlugin.js +28 -29
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +136 -128
- package/lib/SyntheticClipboardEvent.js +3 -7
- package/lib/SyntheticCompositionEvent.js +3 -9
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +8 -10
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +3 -9
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +8 -14
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +3 -3
- package/lib/SyntheticWheelEvent.js +11 -15
- package/lib/Transaction.js +12 -24
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -2
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +5 -11
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createFullPageComponent.js +5 -11
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +5 -24
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +7 -5
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +14 -37
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +2 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +2 -2
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +19 -82
- package/lib/update.js +33 -90
- package/lib/validateDOMNesting.js +264 -0
- package/lib/warning.js +17 -15
- package/package.json +3 -3
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
package/lib/Object.assign.js
CHANGED
package/lib/PooledClass.js
CHANGED
|
@@ -20,7 +20,7 @@ var invariant = require("./invariant");
|
|
|
20
20
|
* the Class itself, not an instance. If any others are needed, simply add them
|
|
21
21
|
* here, or in their own files.
|
|
22
22
|
*/
|
|
23
|
-
var oneArgumentPooler = function(copyFieldsFrom) {
|
|
23
|
+
var oneArgumentPooler = function (copyFieldsFrom) {
|
|
24
24
|
var Klass = this;
|
|
25
25
|
if (Klass.instancePool.length) {
|
|
26
26
|
var instance = Klass.instancePool.pop();
|
|
@@ -31,7 +31,7 @@ var oneArgumentPooler = function(copyFieldsFrom) {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
var twoArgumentPooler = function(a1, a2) {
|
|
34
|
+
var twoArgumentPooler = function (a1, a2) {
|
|
35
35
|
var Klass = this;
|
|
36
36
|
if (Klass.instancePool.length) {
|
|
37
37
|
var instance = Klass.instancePool.pop();
|
|
@@ -42,7 +42,7 @@ var twoArgumentPooler = function(a1, a2) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
var threeArgumentPooler = function(a1, a2, a3) {
|
|
45
|
+
var threeArgumentPooler = function (a1, a2, a3) {
|
|
46
46
|
var Klass = this;
|
|
47
47
|
if (Klass.instancePool.length) {
|
|
48
48
|
var instance = Klass.instancePool.pop();
|
|
@@ -53,7 +53,7 @@ var threeArgumentPooler = function(a1, a2, a3) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
|
|
56
|
+
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
|
57
57
|
var Klass = this;
|
|
58
58
|
if (Klass.instancePool.length) {
|
|
59
59
|
var instance = Klass.instancePool.pop();
|
|
@@ -64,12 +64,9 @@ var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
var standardReleaser = function(instance) {
|
|
67
|
+
var standardReleaser = function (instance) {
|
|
68
68
|
var Klass = this;
|
|
69
|
-
|
|
70
|
-
instance instanceof Klass,
|
|
71
|
-
'Trying to release an instance into a pool of a different type.'
|
|
72
|
-
) : invariant(instance instanceof Klass));
|
|
69
|
+
'production' !== process.env.NODE_ENV ? invariant(instance instanceof Klass, 'Trying to release an instance into a pool of a different type.') : invariant(instance instanceof Klass);
|
|
73
70
|
if (instance.destructor) {
|
|
74
71
|
instance.destructor();
|
|
75
72
|
}
|
|
@@ -90,7 +87,7 @@ var DEFAULT_POOLER = oneArgumentPooler;
|
|
|
90
87
|
* @param {Function} CopyConstructor Constructor that can be used to reset.
|
|
91
88
|
* @param {Function} pooler Customizable pooler.
|
|
92
89
|
*/
|
|
93
|
-
var addPoolingTo = function(CopyConstructor, pooler) {
|
|
90
|
+
var addPoolingTo = function (CopyConstructor, pooler) {
|
|
94
91
|
var NewKlass = CopyConstructor;
|
|
95
92
|
NewKlass.instancePool = [];
|
|
96
93
|
NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
|
@@ -109,4 +106,4 @@ var PooledClass = {
|
|
|
109
106
|
fiveArgumentPooler: fiveArgumentPooler
|
|
110
107
|
};
|
|
111
108
|
|
|
112
|
-
module.exports = PooledClass;
|
|
109
|
+
module.exports = PooledClass;
|
package/lib/React.js
CHANGED
|
@@ -13,11 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
var EventPluginUtils = require("./EventPluginUtils");
|
|
17
16
|
var ReactChildren = require("./ReactChildren");
|
|
18
17
|
var ReactComponent = require("./ReactComponent");
|
|
19
18
|
var ReactClass = require("./ReactClass");
|
|
20
|
-
var ReactContext = require("./ReactContext");
|
|
21
19
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
22
20
|
var ReactElement = require("./ReactElement");
|
|
23
21
|
var ReactElementValidator = require("./ReactElementValidator");
|
|
@@ -34,6 +32,7 @@ var ReactServerRendering = require("./ReactServerRendering");
|
|
|
34
32
|
var assign = require("./Object.assign");
|
|
35
33
|
var findDOMNode = require("./findDOMNode");
|
|
36
34
|
var onlyChild = require("./onlyChild");
|
|
35
|
+
var warning = require("./warning");
|
|
37
36
|
|
|
38
37
|
ReactDefaultInjection.inject();
|
|
39
38
|
|
|
@@ -41,7 +40,7 @@ var createElement = ReactElement.createElement;
|
|
|
41
40
|
var createFactory = ReactElement.createFactory;
|
|
42
41
|
var cloneElement = ReactElement.cloneElement;
|
|
43
42
|
|
|
44
|
-
if (
|
|
43
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
45
44
|
createElement = ReactElementValidator.createElement;
|
|
46
45
|
createFactory = ReactElementValidator.createFactory;
|
|
47
46
|
cloneElement = ReactElementValidator.cloneElement;
|
|
@@ -59,14 +58,11 @@ var React = {
|
|
|
59
58
|
Component: ReactComponent,
|
|
60
59
|
DOM: ReactDOM,
|
|
61
60
|
PropTypes: ReactPropTypes,
|
|
62
|
-
initializeTouchEvents: function(shouldUseTouch) {
|
|
63
|
-
EventPluginUtils.useTouchEvents = shouldUseTouch;
|
|
64
|
-
},
|
|
65
61
|
createClass: ReactClass.createClass,
|
|
66
62
|
createElement: createElement,
|
|
67
63
|
cloneElement: cloneElement,
|
|
68
64
|
createFactory: createFactory,
|
|
69
|
-
createMixin: function(mixin) {
|
|
65
|
+
createMixin: function (mixin) {
|
|
70
66
|
// Currently a noop. Will be used to validate and trace mixins.
|
|
71
67
|
return mixin;
|
|
72
68
|
},
|
|
@@ -78,7 +74,6 @@ var React = {
|
|
|
78
74
|
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
|
|
79
75
|
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
80
76
|
isValidElement: ReactElement.isValidElement,
|
|
81
|
-
withContext: ReactContext.withContext,
|
|
82
77
|
|
|
83
78
|
// Hook for JSX spread, don't use this for anything else.
|
|
84
79
|
__spread: assign
|
|
@@ -86,9 +81,7 @@ var React = {
|
|
|
86
81
|
|
|
87
82
|
// Inject the runtime into a devtools global hook regardless of browser.
|
|
88
83
|
// Allows for debugging when the hook is injected on the page.
|
|
89
|
-
if (
|
|
90
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
91
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
|
84
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
|
92
85
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
|
|
93
86
|
CurrentOwner: ReactCurrentOwner,
|
|
94
87
|
InstanceHandles: ReactInstanceHandles,
|
|
@@ -98,7 +91,7 @@ if (
|
|
|
98
91
|
});
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
if (
|
|
94
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
102
95
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
103
96
|
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
|
|
104
97
|
|
|
@@ -106,43 +99,32 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
106
99
|
// link if not installed.
|
|
107
100
|
if (navigator.userAgent.indexOf('Chrome') > -1) {
|
|
108
101
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
|
109
|
-
console.debug(
|
|
110
|
-
'Download the React DevTools for a better development experience: ' +
|
|
111
|
-
'http://fb.me/react-devtools'
|
|
112
|
-
);
|
|
102
|
+
console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
|
|
113
103
|
}
|
|
114
104
|
}
|
|
115
105
|
|
|
106
|
+
// If we're in IE8, check to see if we are in combatibility mode and provide
|
|
107
|
+
// information on preventing compatibility mode
|
|
108
|
+
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
|
109
|
+
|
|
110
|
+
'production' !== process.env.NODE_ENV ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : null;
|
|
111
|
+
|
|
116
112
|
var expectedFeatures = [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Array.prototype.map,
|
|
123
|
-
Date.now,
|
|
124
|
-
Function.prototype.bind,
|
|
125
|
-
Object.keys,
|
|
126
|
-
String.prototype.split,
|
|
127
|
-
String.prototype.trim,
|
|
128
|
-
|
|
129
|
-
// shams
|
|
130
|
-
Object.create,
|
|
131
|
-
Object.freeze
|
|
132
|
-
];
|
|
113
|
+
// shims
|
|
114
|
+
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
|
|
115
|
+
|
|
116
|
+
// shams
|
|
117
|
+
Object.create, Object.freeze];
|
|
133
118
|
|
|
134
119
|
for (var i = 0; i < expectedFeatures.length; i++) {
|
|
135
120
|
if (!expectedFeatures[i]) {
|
|
136
|
-
console.error(
|
|
137
|
-
'One or more ES5 shim/shams expected by React are not available: ' +
|
|
138
|
-
'http://fb.me/react-warning-polyfills'
|
|
139
|
-
);
|
|
121
|
+
console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
|
|
140
122
|
break;
|
|
141
123
|
}
|
|
142
124
|
}
|
|
143
125
|
}
|
|
144
126
|
}
|
|
145
127
|
|
|
146
|
-
React.version = '0.
|
|
128
|
+
React.version = '0.14.0-alpha1';
|
|
147
129
|
|
|
148
|
-
module.exports = React;
|
|
130
|
+
module.exports = React;
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var ReactInstanceMap = require("./ReactInstanceMap");
|
|
15
|
+
|
|
14
16
|
var findDOMNode = require("./findDOMNode");
|
|
17
|
+
var warning = require("./warning");
|
|
18
|
+
|
|
19
|
+
var didWarnKey = '_getDOMNodeDidWarn';
|
|
15
20
|
|
|
16
21
|
var ReactBrowserComponentMixin = {
|
|
17
22
|
/**
|
|
@@ -21,9 +26,11 @@ var ReactBrowserComponentMixin = {
|
|
|
21
26
|
* @final
|
|
22
27
|
* @protected
|
|
23
28
|
*/
|
|
24
|
-
getDOMNode: function() {
|
|
29
|
+
getDOMNode: function () {
|
|
30
|
+
'production' !== process.env.NODE_ENV ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'React.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : null;
|
|
31
|
+
this.constructor[didWarnKey] = true;
|
|
25
32
|
return findDOMNode(this);
|
|
26
33
|
}
|
|
27
34
|
};
|
|
28
35
|
|
|
29
|
-
module.exports = ReactBrowserComponentMixin;
|
|
36
|
+
module.exports = ReactBrowserComponentMixin;
|
|
@@ -159,10 +159,8 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
159
159
|
/**
|
|
160
160
|
* @param {object} ReactEventListener
|
|
161
161
|
*/
|
|
162
|
-
injectReactEventListener: function(ReactEventListener) {
|
|
163
|
-
ReactEventListener.setHandleTopLevel(
|
|
164
|
-
ReactBrowserEventEmitter.handleTopLevel
|
|
165
|
-
);
|
|
162
|
+
injectReactEventListener: function (ReactEventListener) {
|
|
163
|
+
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
|
|
166
164
|
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
|
|
167
165
|
}
|
|
168
166
|
},
|
|
@@ -172,7 +170,7 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
172
170
|
*
|
|
173
171
|
* @param {boolean} enabled True if callbacks should be enabled.
|
|
174
172
|
*/
|
|
175
|
-
setEnabled: function(enabled) {
|
|
173
|
+
setEnabled: function (enabled) {
|
|
176
174
|
if (ReactBrowserEventEmitter.ReactEventListener) {
|
|
177
175
|
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
|
|
178
176
|
}
|
|
@@ -181,10 +179,8 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
181
179
|
/**
|
|
182
180
|
* @return {boolean} True if callbacks are enabled.
|
|
183
181
|
*/
|
|
184
|
-
isEnabled: function() {
|
|
185
|
-
return !!(
|
|
186
|
-
(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
|
|
187
|
-
);
|
|
182
|
+
isEnabled: function () {
|
|
183
|
+
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
|
|
188
184
|
},
|
|
189
185
|
|
|
190
186
|
/**
|
|
@@ -208,93 +204,49 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
208
204
|
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
|
209
205
|
* @param {object} contentDocumentHandle Document which owns the container
|
|
210
206
|
*/
|
|
211
|
-
listenTo: function(registrationName, contentDocumentHandle) {
|
|
207
|
+
listenTo: function (registrationName, contentDocumentHandle) {
|
|
212
208
|
var mountAt = contentDocumentHandle;
|
|
213
209
|
var isListening = getListeningForDocument(mountAt);
|
|
214
|
-
var dependencies = EventPluginRegistry.
|
|
215
|
-
registrationNameDependencies[registrationName];
|
|
210
|
+
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
|
|
216
211
|
|
|
217
212
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
218
|
-
for (var i = 0
|
|
213
|
+
for (var i = 0; i < dependencies.length; i++) {
|
|
219
214
|
var dependency = dependencies[i];
|
|
220
|
-
if (!(
|
|
221
|
-
(isListening.hasOwnProperty(dependency) && isListening[dependency])
|
|
222
|
-
)) {
|
|
215
|
+
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
|
|
223
216
|
if (dependency === topLevelTypes.topWheel) {
|
|
224
217
|
if (isEventSupported('wheel')) {
|
|
225
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
226
|
-
topLevelTypes.topWheel,
|
|
227
|
-
'wheel',
|
|
228
|
-
mountAt
|
|
229
|
-
);
|
|
218
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
|
|
230
219
|
} else if (isEventSupported('mousewheel')) {
|
|
231
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
232
|
-
topLevelTypes.topWheel,
|
|
233
|
-
'mousewheel',
|
|
234
|
-
mountAt
|
|
235
|
-
);
|
|
220
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
|
|
236
221
|
} else {
|
|
237
222
|
// Firefox needs to capture a different mouse scroll event.
|
|
238
223
|
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
|
|
239
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
240
|
-
topLevelTypes.topWheel,
|
|
241
|
-
'DOMMouseScroll',
|
|
242
|
-
mountAt
|
|
243
|
-
);
|
|
224
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
|
|
244
225
|
}
|
|
245
226
|
} else if (dependency === topLevelTypes.topScroll) {
|
|
246
227
|
|
|
247
228
|
if (isEventSupported('scroll', true)) {
|
|
248
|
-
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
|
|
249
|
-
topLevelTypes.topScroll,
|
|
250
|
-
'scroll',
|
|
251
|
-
mountAt
|
|
252
|
-
);
|
|
229
|
+
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
|
|
253
230
|
} else {
|
|
254
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
255
|
-
topLevelTypes.topScroll,
|
|
256
|
-
'scroll',
|
|
257
|
-
ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
|
|
258
|
-
);
|
|
231
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
|
|
259
232
|
}
|
|
260
|
-
} else if (dependency === topLevelTypes.topFocus ||
|
|
261
|
-
dependency === topLevelTypes.topBlur) {
|
|
233
|
+
} else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
|
|
262
234
|
|
|
263
235
|
if (isEventSupported('focus', true)) {
|
|
264
|
-
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
|
|
265
|
-
|
|
266
|
-
'focus',
|
|
267
|
-
mountAt
|
|
268
|
-
);
|
|
269
|
-
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
|
|
270
|
-
topLevelTypes.topBlur,
|
|
271
|
-
'blur',
|
|
272
|
-
mountAt
|
|
273
|
-
);
|
|
236
|
+
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
|
|
237
|
+
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
|
|
274
238
|
} else if (isEventSupported('focusin')) {
|
|
275
239
|
// IE has `focusin` and `focusout` events which bubble.
|
|
276
240
|
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
|
|
277
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
278
|
-
|
|
279
|
-
'focusin',
|
|
280
|
-
mountAt
|
|
281
|
-
);
|
|
282
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
283
|
-
topLevelTypes.topBlur,
|
|
284
|
-
'focusout',
|
|
285
|
-
mountAt
|
|
286
|
-
);
|
|
241
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
|
|
242
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
|
|
287
243
|
}
|
|
288
244
|
|
|
289
245
|
// to make sure blur and focus event listeners are only attached once
|
|
290
246
|
isListening[topLevelTypes.topBlur] = true;
|
|
291
247
|
isListening[topLevelTypes.topFocus] = true;
|
|
292
248
|
} else if (topEventMapping.hasOwnProperty(dependency)) {
|
|
293
|
-
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
294
|
-
dependency,
|
|
295
|
-
topEventMapping[dependency],
|
|
296
|
-
mountAt
|
|
297
|
-
);
|
|
249
|
+
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
|
|
298
250
|
}
|
|
299
251
|
|
|
300
252
|
isListening[dependency] = true;
|
|
@@ -302,20 +254,12 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
302
254
|
}
|
|
303
255
|
},
|
|
304
256
|
|
|
305
|
-
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
|
|
306
|
-
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
|
|
307
|
-
topLevelType,
|
|
308
|
-
handlerBaseName,
|
|
309
|
-
handle
|
|
310
|
-
);
|
|
257
|
+
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
|
|
258
|
+
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
|
|
311
259
|
},
|
|
312
260
|
|
|
313
|
-
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
|
|
314
|
-
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
|
|
315
|
-
topLevelType,
|
|
316
|
-
handlerBaseName,
|
|
317
|
-
handle
|
|
318
|
-
);
|
|
261
|
+
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
|
|
262
|
+
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
|
|
319
263
|
},
|
|
320
264
|
|
|
321
265
|
/**
|
|
@@ -326,7 +270,7 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
326
270
|
*
|
|
327
271
|
* @see http://www.quirksmode.org/dom/events/scroll.html
|
|
328
272
|
*/
|
|
329
|
-
ensureScrollValueMonitoring: function() {
|
|
273
|
+
ensureScrollValueMonitoring: function () {
|
|
330
274
|
if (!isMonitoringScrollValue) {
|
|
331
275
|
var refresh = ViewportMetrics.refreshScrollValues;
|
|
332
276
|
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
|
|
@@ -348,4 +292,4 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
348
292
|
|
|
349
293
|
});
|
|
350
294
|
|
|
351
|
-
module.exports = ReactBrowserEventEmitter;
|
|
295
|
+
module.exports = ReactBrowserEventEmitter;
|
|
@@ -16,12 +16,8 @@ var React = require("./React");
|
|
|
16
16
|
|
|
17
17
|
var assign = require("./Object.assign");
|
|
18
18
|
|
|
19
|
-
var ReactTransitionGroup = React.createFactory(
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
var ReactCSSTransitionGroupChild = React.createFactory(
|
|
23
|
-
require("./ReactCSSTransitionGroupChild")
|
|
24
|
-
);
|
|
19
|
+
var ReactTransitionGroup = React.createFactory(require("./ReactTransitionGroup"));
|
|
20
|
+
var ReactCSSTransitionGroupChild = React.createFactory(require("./ReactCSSTransitionGroupChild"));
|
|
25
21
|
|
|
26
22
|
var ReactCSSTransitionGroup = React.createClass({
|
|
27
23
|
displayName: 'ReactCSSTransitionGroup',
|
|
@@ -33,7 +29,7 @@ var ReactCSSTransitionGroup = React.createClass({
|
|
|
33
29
|
transitionLeave: React.PropTypes.bool
|
|
34
30
|
},
|
|
35
31
|
|
|
36
|
-
getDefaultProps: function() {
|
|
32
|
+
getDefaultProps: function () {
|
|
37
33
|
return {
|
|
38
34
|
transitionAppear: false,
|
|
39
35
|
transitionEnter: true,
|
|
@@ -41,28 +37,21 @@ var ReactCSSTransitionGroup = React.createClass({
|
|
|
41
37
|
};
|
|
42
38
|
},
|
|
43
39
|
|
|
44
|
-
_wrapChild: function(child) {
|
|
40
|
+
_wrapChild: function (child) {
|
|
45
41
|
// We need to provide this childFactory so that
|
|
46
42
|
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
|
|
47
43
|
// leave while it is leaving.
|
|
48
|
-
return ReactCSSTransitionGroupChild(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
child
|
|
56
|
-
);
|
|
44
|
+
return ReactCSSTransitionGroupChild({
|
|
45
|
+
name: this.props.transitionName,
|
|
46
|
+
appear: this.props.transitionAppear,
|
|
47
|
+
enter: this.props.transitionEnter,
|
|
48
|
+
leave: this.props.transitionLeave
|
|
49
|
+
}, child);
|
|
57
50
|
},
|
|
58
51
|
|
|
59
|
-
render: function() {
|
|
60
|
-
return (
|
|
61
|
-
ReactTransitionGroup(
|
|
62
|
-
assign({}, this.props, {childFactory: this._wrapChild})
|
|
63
|
-
)
|
|
64
|
-
);
|
|
52
|
+
render: function () {
|
|
53
|
+
return ReactTransitionGroup(assign({}, this.props, { childFactory: this._wrapChild }));
|
|
65
54
|
}
|
|
66
55
|
});
|
|
67
56
|
|
|
68
|
-
module.exports = ReactCSSTransitionGroup;
|
|
57
|
+
module.exports = ReactCSSTransitionGroup;
|