react 0.14.0-beta1 → 0.14.0
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/addons.js +8 -3
- package/dist/react-with-addons.js +5048 -4095
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4555 -3729
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +27 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +15 -14
- package/lib/DOMChildrenOperations.js +22 -7
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +23 -10
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +18 -10
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +29 -21
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +34 -38
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +24 -4
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +3 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +36 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +48 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +72 -32
- package/lib/ReactClass.js +46 -46
- package/lib/ReactComponent.js +18 -16
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +95 -44
- package/lib/ReactDOM.js +74 -159
- package/lib/ReactDOMComponent.js +235 -93
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -81
- package/lib/ReactDOMInput.js +18 -9
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +9 -9
- package/lib/ReactDOMSelection.js +19 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +14 -12
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -25
- package/lib/ReactDefaultPerf.js +17 -11
- package/lib/ReactDefaultPerfAnalysis.js +13 -12
- package/lib/ReactElement.js +85 -39
- package/lib/ReactElementValidator.js +47 -90
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +53 -9
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +33 -21
- package/lib/ReactFragment.js +27 -118
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +186 -85
- package/lib/ReactMultiChild.js +119 -25
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +38 -9
- package/lib/ReactReconcileTransaction.js +10 -8
- package/lib/ReactReconciler.js +5 -6
- package/lib/ReactRef.js +14 -2
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +6 -5
- package/lib/ReactTestUtils.js +47 -39
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +19 -19
- package/lib/ReactUpdates.js +15 -15
- package/lib/{performance.js → ReactVersion.js} +3 -12
- package/lib/ReactWithAddons.js +24 -15
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +19 -9
- package/lib/SimpleEventPlugin.js +198 -43
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +18 -4
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +7 -7
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +7 -6
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/{isTextNode.js → getTestDocument.js} +7 -11
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +15 -17
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +216 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +34 -0
- package/lib/traverseAllChildren.js +25 -18
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +1 -51
- package/dist/JSXTransformer.js +0 -17588
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -93
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/joinClasses.js +0 -39
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/memoizeStringOnly.js +0 -31
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
package/lib/EventPluginUtils.js
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var ReactErrorUtils = require('./ReactErrorUtils');
|
|
15
16
|
|
|
16
|
-
var invariant = require(
|
|
17
|
-
var warning = require(
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
|
+
var warning = require('fbjs/lib/warning');
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Injected dependencies:
|
|
@@ -28,8 +29,8 @@ var injection = {
|
|
|
28
29
|
Mount: null,
|
|
29
30
|
injectMount: function (InjectedMount) {
|
|
30
31
|
injection.Mount = InjectedMount;
|
|
31
|
-
if (
|
|
32
|
-
|
|
32
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
33
|
+
process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
};
|
|
@@ -48,7 +49,7 @@ function isStartish(topLevelType) {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
var validateEventDispatches;
|
|
51
|
-
if (
|
|
52
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
52
53
|
validateEventDispatches = function (event) {
|
|
53
54
|
var dispatchListeners = event._dispatchListeners;
|
|
54
55
|
var dispatchIDs = event._dispatchIDs;
|
|
@@ -58,19 +59,35 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
58
59
|
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
|
|
59
60
|
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* Dispatch the event to the listener.
|
|
68
|
+
* @param {SyntheticEvent} event SyntheticEvent to handle
|
|
69
|
+
* @param {boolean} simulated If the event is simulated (changes exn behavior)
|
|
70
|
+
* @param {function} listener Application-level callback
|
|
71
|
+
* @param {string} domID DOM id to pass to the callback.
|
|
69
72
|
*/
|
|
70
|
-
function
|
|
73
|
+
function executeDispatch(event, simulated, listener, domID) {
|
|
74
|
+
var type = event.type || 'unknown-event';
|
|
75
|
+
event.currentTarget = injection.Mount.getNode(domID);
|
|
76
|
+
if (simulated) {
|
|
77
|
+
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
|
|
78
|
+
} else {
|
|
79
|
+
ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
|
|
80
|
+
}
|
|
81
|
+
event.currentTarget = null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Standard/simple iteration through an event's collected dispatches.
|
|
86
|
+
*/
|
|
87
|
+
function executeDispatchesInOrder(event, simulated) {
|
|
71
88
|
var dispatchListeners = event._dispatchListeners;
|
|
72
89
|
var dispatchIDs = event._dispatchIDs;
|
|
73
|
-
if (
|
|
90
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
74
91
|
validateEventDispatches(event);
|
|
75
92
|
}
|
|
76
93
|
if (Array.isArray(dispatchListeners)) {
|
|
@@ -79,31 +96,11 @@ function forEachEventDispatch(event, cb) {
|
|
|
79
96
|
break;
|
|
80
97
|
}
|
|
81
98
|
// Listeners and IDs are two parallel arrays that are always in sync.
|
|
82
|
-
|
|
99
|
+
executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
|
|
83
100
|
}
|
|
84
101
|
} else if (dispatchListeners) {
|
|
85
|
-
|
|
102
|
+
executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
|
|
86
103
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Default implementation of PluginModule.executeDispatch().
|
|
91
|
-
* @param {SyntheticEvent} event SyntheticEvent to handle
|
|
92
|
-
* @param {function} listener Application-level callback
|
|
93
|
-
* @param {string} domID DOM id to pass to the callback.
|
|
94
|
-
*/
|
|
95
|
-
function executeDispatch(event, listener, domID) {
|
|
96
|
-
event.currentTarget = injection.Mount.getNode(domID);
|
|
97
|
-
var returnValue = listener(event, domID);
|
|
98
|
-
event.currentTarget = null;
|
|
99
|
-
return returnValue;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Standard/simple iteration through an event's collected dispatches.
|
|
104
|
-
*/
|
|
105
|
-
function executeDispatchesInOrder(event, cb) {
|
|
106
|
-
forEachEventDispatch(event, cb);
|
|
107
104
|
event._dispatchListeners = null;
|
|
108
105
|
event._dispatchIDs = null;
|
|
109
106
|
}
|
|
@@ -118,7 +115,7 @@ function executeDispatchesInOrder(event, cb) {
|
|
|
118
115
|
function executeDispatchesInOrderStopAtTrueImpl(event) {
|
|
119
116
|
var dispatchListeners = event._dispatchListeners;
|
|
120
117
|
var dispatchIDs = event._dispatchIDs;
|
|
121
|
-
if (
|
|
118
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
122
119
|
validateEventDispatches(event);
|
|
123
120
|
}
|
|
124
121
|
if (Array.isArray(dispatchListeners)) {
|
|
@@ -159,12 +156,12 @@ function executeDispatchesInOrderStopAtTrue(event) {
|
|
|
159
156
|
* @return {*} The return value of executing the single dispatch.
|
|
160
157
|
*/
|
|
161
158
|
function executeDirectDispatch(event) {
|
|
162
|
-
if (
|
|
159
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
163
160
|
validateEventDispatches(event);
|
|
164
161
|
}
|
|
165
162
|
var dispatchListener = event._dispatchListeners;
|
|
166
163
|
var dispatchID = event._dispatchIDs;
|
|
167
|
-
!!Array.isArray(dispatchListener) ?
|
|
164
|
+
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
|
|
168
165
|
var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
|
|
169
166
|
event._dispatchListeners = null;
|
|
170
167
|
event._dispatchIDs = null;
|
|
@@ -188,7 +185,6 @@ var EventPluginUtils = {
|
|
|
188
185
|
isStartish: isStartish,
|
|
189
186
|
|
|
190
187
|
executeDirectDispatch: executeDirectDispatch,
|
|
191
|
-
executeDispatch: executeDispatch,
|
|
192
188
|
executeDispatchesInOrder: executeDispatchesInOrder,
|
|
193
189
|
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
|
|
194
190
|
hasDispatches: hasDispatches,
|
package/lib/EventPropagators.js
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
15
|
-
var EventPluginHub = require(
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var EventPluginHub = require('./EventPluginHub');
|
|
16
16
|
|
|
17
|
-
var warning = require(
|
|
17
|
+
var warning = require('fbjs/lib/warning');
|
|
18
18
|
|
|
19
|
-
var accumulateInto = require(
|
|
20
|
-
var forEachAccumulated = require(
|
|
19
|
+
var accumulateInto = require('./accumulateInto');
|
|
20
|
+
var forEachAccumulated = require('./forEachAccumulated');
|
|
21
21
|
|
|
22
22
|
var PropagationPhases = EventConstants.PropagationPhases;
|
|
23
23
|
var getListener = EventPluginHub.getListener;
|
|
@@ -38,8 +38,8 @@ function listenerAtPhase(id, event, propagationPhase) {
|
|
|
38
38
|
* "dispatch" object that pairs the event with the listener.
|
|
39
39
|
*/
|
|
40
40
|
function accumulateDirectionalDispatches(domID, upwards, event) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
41
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
42
|
+
process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
|
|
43
43
|
}
|
|
44
44
|
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
|
|
45
45
|
var listener = listenerAtPhase(domID, event, phase);
|
|
@@ -52,7 +52,7 @@ function accumulateDirectionalDispatches(domID, upwards, event) {
|
|
|
52
52
|
/**
|
|
53
53
|
* Collect dispatches (must be entirely collected before dispatching - see unit
|
|
54
54
|
* tests). Lazily allocate the array to conserve memory. We must loop through
|
|
55
|
-
* each event and perform the traversal for each one. We
|
|
55
|
+
* each event and perform the traversal for each one. We cannot perform a
|
|
56
56
|
* single traversal for the entire collection of events because each event may
|
|
57
57
|
* have a different target.
|
|
58
58
|
*/
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var PooledClass = require(
|
|
15
|
+
var PooledClass = require('./PooledClass');
|
|
16
16
|
|
|
17
|
-
var assign = require(
|
|
18
|
-
var getTextContentAccessor = require(
|
|
17
|
+
var assign = require('./Object.assign');
|
|
18
|
+
var getTextContentAccessor = require('./getTextContentAccessor');
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* This helper class stores information about text content of a target node,
|
|
@@ -35,6 +35,12 @@ function FallbackCompositionState(root) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
assign(FallbackCompositionState.prototype, {
|
|
38
|
+
destructor: function () {
|
|
39
|
+
this._root = null;
|
|
40
|
+
this._startText = null;
|
|
41
|
+
this._fallbackText = null;
|
|
42
|
+
},
|
|
43
|
+
|
|
38
44
|
/**
|
|
39
45
|
* Get current text of input.
|
|
40
46
|
*
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var DOMProperty = require(
|
|
15
|
-
var ExecutionEnvironment = require(
|
|
14
|
+
var DOMProperty = require('./DOMProperty');
|
|
15
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
16
16
|
|
|
17
17
|
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
|
18
18
|
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
|
@@ -92,6 +92,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
92
92
|
httpEquiv: null,
|
|
93
93
|
icon: null,
|
|
94
94
|
id: MUST_USE_PROPERTY,
|
|
95
|
+
inputMode: MUST_USE_ATTRIBUTE,
|
|
95
96
|
is: MUST_USE_ATTRIBUTE,
|
|
96
97
|
keyParams: MUST_USE_ATTRIBUTE,
|
|
97
98
|
keyType: MUST_USE_ATTRIBUTE,
|
|
@@ -144,6 +145,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
144
145
|
start: HAS_NUMERIC_VALUE,
|
|
145
146
|
step: null,
|
|
146
147
|
style: null,
|
|
148
|
+
summary: null,
|
|
147
149
|
tabIndex: null,
|
|
148
150
|
target: null,
|
|
149
151
|
title: null,
|
|
@@ -152,6 +154,20 @@ var HTMLDOMPropertyConfig = {
|
|
|
152
154
|
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
|
|
153
155
|
width: MUST_USE_ATTRIBUTE,
|
|
154
156
|
wmode: MUST_USE_ATTRIBUTE,
|
|
157
|
+
wrap: null,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* RDFa Properties
|
|
161
|
+
*/
|
|
162
|
+
about: MUST_USE_ATTRIBUTE,
|
|
163
|
+
datatype: MUST_USE_ATTRIBUTE,
|
|
164
|
+
inlist: MUST_USE_ATTRIBUTE,
|
|
165
|
+
prefix: MUST_USE_ATTRIBUTE,
|
|
166
|
+
// property is also supported for OpenGraph in meta tags.
|
|
167
|
+
property: MUST_USE_ATTRIBUTE,
|
|
168
|
+
resource: MUST_USE_ATTRIBUTE,
|
|
169
|
+
'typeof': MUST_USE_ATTRIBUTE,
|
|
170
|
+
vocab: MUST_USE_ATTRIBUTE,
|
|
155
171
|
|
|
156
172
|
/**
|
|
157
173
|
* Non-standard Properties
|
|
@@ -160,6 +176,8 @@ var HTMLDOMPropertyConfig = {
|
|
|
160
176
|
// keyboard hints.
|
|
161
177
|
autoCapitalize: null,
|
|
162
178
|
autoCorrect: null,
|
|
179
|
+
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
|
|
180
|
+
autoSave: null,
|
|
163
181
|
// itemProp, itemScope, itemType are for
|
|
164
182
|
// Microdata support. See http://schema.org/docs/gs.html
|
|
165
183
|
itemProp: MUST_USE_ATTRIBUTE,
|
|
@@ -170,8 +188,9 @@ var HTMLDOMPropertyConfig = {
|
|
|
170
188
|
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
|
|
171
189
|
itemID: MUST_USE_ATTRIBUTE,
|
|
172
190
|
itemRef: MUST_USE_ATTRIBUTE,
|
|
173
|
-
//
|
|
174
|
-
|
|
191
|
+
// results show looking glass icon and recent searches on input
|
|
192
|
+
// search fields in WebKit/Blink
|
|
193
|
+
results: null,
|
|
175
194
|
// IE-only attribute that specifies security restrictions on an iframe
|
|
176
195
|
// as an alternative to the sandbox attribute on IE<10
|
|
177
196
|
security: MUST_USE_ATTRIBUTE,
|
|
@@ -190,6 +209,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
190
209
|
autoCorrect: 'autocorrect',
|
|
191
210
|
autoFocus: 'autofocus',
|
|
192
211
|
autoPlay: 'autoplay',
|
|
212
|
+
autoSave: 'autosave',
|
|
193
213
|
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
|
|
194
214
|
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
|
|
195
215
|
encType: 'encoding',
|
package/lib/LinkedStateMixin.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactLink = require(
|
|
16
|
-
var ReactStateSetters = require(
|
|
15
|
+
var ReactLink = require('./ReactLink');
|
|
16
|
+
var ReactStateSetters = require('./ReactStateSetters');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A simple mixin around ReactLink.forState().
|
package/lib/LinkedValueUtils.js
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactPropTypes = require(
|
|
16
|
-
var ReactPropTypeLocations = require(
|
|
15
|
+
var ReactPropTypes = require('./ReactPropTypes');
|
|
16
|
+
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
17
17
|
|
|
18
|
-
var invariant = require(
|
|
19
|
-
var warning = require(
|
|
18
|
+
var invariant = require('fbjs/lib/invariant');
|
|
19
|
+
var warning = require('fbjs/lib/warning');
|
|
20
20
|
|
|
21
21
|
var hasReadOnlyValue = {
|
|
22
22
|
'button': true,
|
|
@@ -29,16 +29,16 @@ var hasReadOnlyValue = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
function _assertSingleLink(inputProps) {
|
|
32
|
-
!(inputProps.checkedLink == null || inputProps.valueLink == null) ?
|
|
32
|
+
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
|
|
33
33
|
}
|
|
34
34
|
function _assertValueLink(inputProps) {
|
|
35
35
|
_assertSingleLink(inputProps);
|
|
36
|
-
!(inputProps.value == null && inputProps.onChange == null) ?
|
|
36
|
+
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function _assertCheckedLink(inputProps) {
|
|
40
40
|
_assertSingleLink(inputProps);
|
|
41
|
-
!(inputProps.checked == null && inputProps.onChange == null) ?
|
|
41
|
+
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
var propTypes = {
|
|
@@ -84,7 +84,7 @@ var LinkedValueUtils = {
|
|
|
84
84
|
loggedTypeFailures[error.message] = true;
|
|
85
85
|
|
|
86
86
|
var addendum = getDeclarationErrorAddendum(owner);
|
|
87
|
-
|
|
87
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule MetaMatchers
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This modules adds a jasmine matcher toEqualSpecsIn that can be used to
|
|
16
|
+
* compare the specs in two different "describe" functions and their result.
|
|
17
|
+
* It can be used to test a test.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function getRunnerWithResults(describeFunction) {
|
|
21
|
+
if (describeFunction._cachedRunner) {
|
|
22
|
+
// Cached result of execution. This is a convenience way to test against
|
|
23
|
+
// the same authorative function multiple times.
|
|
24
|
+
return describeFunction._cachedRunner;
|
|
25
|
+
}
|
|
26
|
+
// Patch the current global environment.
|
|
27
|
+
var env = new jasmine.Env();
|
|
28
|
+
// Execute the tests synchronously.
|
|
29
|
+
env.updateInterval = 0;
|
|
30
|
+
var outerGetEnv = jasmine.getEnv;
|
|
31
|
+
jasmine.getEnv = function () {
|
|
32
|
+
return env;
|
|
33
|
+
};
|
|
34
|
+
// TODO: Bring over matchers from the existing environment.
|
|
35
|
+
var runner = env.currentRunner();
|
|
36
|
+
try {
|
|
37
|
+
env.describe('', describeFunction);
|
|
38
|
+
env.execute();
|
|
39
|
+
} finally {
|
|
40
|
+
// Restore the environment.
|
|
41
|
+
jasmine.getEnv = outerGetEnv;
|
|
42
|
+
}
|
|
43
|
+
describeFunction._cachedRunner = runner;
|
|
44
|
+
return runner;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function compareSpec(actual, expected) {
|
|
48
|
+
if (actual.results().totalCount !== expected.results().totalCount) {
|
|
49
|
+
return 'Expected ' + expected.results().totalCount + ' expects, ' + 'but got ' + actual.results().totalCount + ':' + actual.getFullName();
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function includesDescription(specs, description, startIndex) {
|
|
55
|
+
for (var i = startIndex; i < specs.length; i++) {
|
|
56
|
+
if (specs[i].description === description) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function compareSpecs(actualSpecs, expectedSpecs) {
|
|
64
|
+
for (var i = 0; i < actualSpecs.length && i < expectedSpecs.length; i++) {
|
|
65
|
+
var actual = actualSpecs[i];
|
|
66
|
+
var expected = expectedSpecs[i];
|
|
67
|
+
if (actual.description === expected.description) {
|
|
68
|
+
var errorMessage = compareSpec(actual, expected);
|
|
69
|
+
if (errorMessage) {
|
|
70
|
+
return errorMessage;
|
|
71
|
+
}
|
|
72
|
+
continue;
|
|
73
|
+
} else if (includesDescription(actualSpecs, expected.description, i)) {
|
|
74
|
+
return 'Did not expect the spec:' + actualSpecs[i].getFullName();
|
|
75
|
+
} else {
|
|
76
|
+
return 'Expected an equivalent to:' + expectedSpecs[i].getFullName();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (i < actualSpecs.length) {
|
|
80
|
+
return 'Did not expect the spec:' + actualSpecs[i].getFullName();
|
|
81
|
+
}
|
|
82
|
+
if (i < expectedSpecs.length) {
|
|
83
|
+
return 'Expected an equivalent to:' + expectedSpecs[i].getFullName();
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function compareDescription(a, b) {
|
|
89
|
+
if (a.description === b.description) {
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
return a.description < b.description ? -1 : 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function compareRunners(actual, expected) {
|
|
96
|
+
return compareSpecs(actual.specs().sort(compareDescription), expected.specs().sort(compareDescription));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var MetaMatchers = {
|
|
100
|
+
toEqualSpecsIn: function (expectedDescribeFunction) {
|
|
101
|
+
var actualDescribeFunction = this.actual;
|
|
102
|
+
if (typeof actualDescribeFunction !== 'function') {
|
|
103
|
+
throw Error('toEqualSpecsIn() should be used on a describe function');
|
|
104
|
+
}
|
|
105
|
+
if (typeof expectedDescribeFunction !== 'function') {
|
|
106
|
+
throw Error('toEqualSpecsIn() should be passed a describe function');
|
|
107
|
+
}
|
|
108
|
+
var actual = getRunnerWithResults(actualDescribeFunction);
|
|
109
|
+
var expected = getRunnerWithResults(expectedDescribeFunction);
|
|
110
|
+
var errorMessage = compareRunners(actual, expected);
|
|
111
|
+
this.message = function () {
|
|
112
|
+
return [errorMessage, 'The specs are equal. Expected them to be different.'];
|
|
113
|
+
};
|
|
114
|
+
return !errorMessage;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
module.exports = MetaMatchers;
|