react 0.9.0-rc1 → 0.11.0-rc1
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 +3 -0
- package/dist/JSXTransformer.js +13445 -0
- package/dist/react-with-addons.js +20226 -0
- package/dist/react-with-addons.min.js +22 -0
- package/dist/react.js +18434 -0
- package/dist/react.min.js +21 -0
- package/lib/AutoFocusMixin.js +4 -2
- package/lib/BeforeInputEventPlugin.js +222 -0
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +1 -1
- package/lib/CSSPropertyOperations.js +4 -4
- package/lib/{ReactMountReady.js → CallbackQueue.js} +33 -25
- package/lib/ChangeEventPlugin.js +2 -2
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/CompositionEventPlugin.js +6 -2
- package/lib/DOMChildrenOperations.js +34 -21
- package/lib/DOMProperty.js +52 -22
- package/lib/DOMPropertyOperations.js +29 -17
- package/lib/Danger.js +1 -1
- package/lib/DefaultEventPluginOrder.js +2 -1
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +2 -1
- package/lib/EventListener.js +5 -2
- package/lib/EventPluginHub.js +5 -6
- package/lib/EventPluginRegistry.js +27 -4
- package/lib/EventPluginUtils.js +12 -2
- package/lib/EventPropagators.js +1 -1
- package/lib/ExecutionEnvironment.js +9 -3
- package/lib/{DefaultDOMPropertyConfig.js → HTMLDOMPropertyConfig.js} +47 -58
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +27 -29
- package/lib/LocalEventTrapMixin.js +52 -0
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +39 -4
- package/lib/ReactBrowserComponentMixin.js +46 -0
- package/lib/{ReactEventEmitter.js → ReactBrowserEventEmitter.js} +118 -95
- package/lib/ReactCSSTransitionGroup.js +13 -11
- package/lib/ReactCSSTransitionGroupChild.js +3 -6
- package/lib/ReactChildren.js +35 -14
- package/lib/ReactComponent.js +120 -224
- package/lib/ReactComponentBrowserEnvironment.js +4 -37
- package/lib/ReactComponentWithPureRenderMixin.js +54 -0
- package/lib/ReactCompositeComponent.js +250 -288
- package/lib/ReactContext.js +1 -1
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +26 -24
- package/lib/ReactDOMButton.js +3 -2
- package/lib/ReactDOMComponent.js +43 -24
- package/lib/ReactDOMForm.js +8 -13
- package/lib/ReactDOMIDOperations.js +3 -32
- package/lib/ReactDOMImg.js +8 -14
- package/lib/ReactDOMInput.js +3 -2
- package/lib/ReactDOMOption.js +12 -8
- package/lib/ReactDOMSelect.js +19 -17
- package/lib/ReactDOMSelection.js +36 -11
- package/lib/ReactDOMTextarea.js +10 -8
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +28 -15
- package/lib/ReactDefaultPerf.js +29 -12
- package/lib/ReactDefaultPerfAnalysis.js +5 -1
- package/lib/ReactDescriptor.js +243 -0
- package/lib/ReactDescriptorValidator.js +283 -0
- package/lib/ReactEmptyComponent.js +78 -0
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +2 -4
- package/lib/ReactEventListener.js +189 -0
- package/lib/ReactInjection.js +9 -3
- package/lib/ReactInputSelection.js +3 -2
- package/lib/ReactInstanceHandles.js +1 -1
- package/lib/ReactLink.js +25 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +62 -22
- package/lib/ReactMultiChild.js +19 -14
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactOwner.js +7 -2
- package/lib/ReactPerf.js +1 -1
- package/lib/ReactPropTransferer.js +45 -30
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +222 -238
- package/lib/ReactPutListenerQueue.js +3 -3
- package/lib/ReactReconcileTransaction.js +22 -21
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +42 -12
- package/lib/ReactServerRenderingTransaction.js +115 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +412 -0
- package/lib/ReactTextComponent.js +22 -14
- package/lib/ReactTransitionChildMapping.js +3 -3
- package/lib/ReactTransitionEvents.js +20 -1
- package/lib/ReactTransitionGroup.js +10 -7
- package/lib/ReactUpdates.js +140 -23
- package/lib/ReactWithAddons.js +13 -3
- package/lib/SVGDOMPropertyConfig.js +97 -0
- package/lib/SelectEventPlugin.js +1 -1
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +8 -2
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +1 -1
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +52 -0
- package/lib/SyntheticKeyboardEvent.js +34 -5
- package/lib/SyntheticMouseEvent.js +4 -1
- package/lib/SyntheticTouchEvent.js +5 -2
- package/lib/SyntheticUIEvent.js +25 -3
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/Transaction.js +1 -33
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +11 -9
- package/lib/containsNode.js +1 -1
- package/lib/copyProperties.js +1 -1
- package/lib/createArrayFrom.js +1 -1
- package/lib/createFullPageComponent.js +2 -2
- package/lib/createNodesFromMarkup.js +1 -1
- package/lib/cx.js +1 -1
- package/lib/dangerousStyleValue.js +12 -6
- package/lib/emptyFunction.js +1 -1
- package/lib/{ReactComponentEnvironment.js → emptyObject.js} +7 -6
- package/lib/escapeTextForBrowser.js +3 -4
- package/lib/flattenChildren.js +10 -8
- package/lib/focusNode.js +33 -0
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventKey.js +36 -6
- package/lib/getEventModifierState.js +52 -0
- package/lib/getEventTarget.js +1 -1
- package/lib/getMarkupWrap.js +3 -1
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +2 -2
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +4 -1
- package/lib/hyphenateStyleName.js +46 -0
- package/lib/instantiateReactComponent.js +62 -0
- package/lib/invariant.js +21 -23
- package/lib/isEventSupported.js +1 -1
- package/lib/isNode.js +2 -2
- package/lib/isTextInputElement.js +1 -1
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/keyOf.js +1 -1
- package/lib/{objMap.js → mapObject.js} +9 -4
- package/lib/memoizeStringOnly.js +1 -1
- package/lib/merge.js +1 -1
- package/lib/mergeHelpers.js +12 -1
- package/lib/mergeInto.js +4 -3
- package/lib/mixInto.js +1 -1
- package/lib/monitorCodeUse.js +37 -0
- package/lib/onlyChild.js +4 -4
- package/lib/performance.js +33 -0
- package/lib/performanceNow.js +6 -15
- package/lib/setInnerHTML.js +77 -0
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +15 -29
- package/lib/toArray.js +1 -1
- package/lib/traverseAllChildren.js +10 -6
- package/lib/update.js +171 -0
- package/lib/warning.js +19 -11
- package/package.json +5 -3
- package/lib/ReactEventTopLevelCallback.js +0 -109
- package/lib/createObjectFrom.js +0 -61
- package/lib/objMapKeyVal.js +0 -47
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -44,7 +44,11 @@ var useCompositionEvent = (
|
|
|
44
44
|
// events as triggers.
|
|
45
45
|
var useFallbackData = (
|
|
46
46
|
!useCompositionEvent ||
|
|
47
|
-
|
|
47
|
+
(
|
|
48
|
+
'documentMode' in document &&
|
|
49
|
+
document.documentMode > 8 &&
|
|
50
|
+
document.documentMode <= 11
|
|
51
|
+
)
|
|
48
52
|
);
|
|
49
53
|
|
|
50
54
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -23,6 +23,7 @@ var Danger = require("./Danger");
|
|
|
23
23
|
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
|
|
24
24
|
|
|
25
25
|
var getTextContentAccessor = require("./getTextContentAccessor");
|
|
26
|
+
var invariant = require("./invariant");
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* The DOM property to use when setting text content.
|
|
@@ -41,34 +42,34 @@ var textContentAccessor = getTextContentAccessor();
|
|
|
41
42
|
* @internal
|
|
42
43
|
*/
|
|
43
44
|
function insertChildAt(parentNode, childNode, index) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
if (index >= childNodes.length) {
|
|
54
|
-
parentNode.appendChild(childNode);
|
|
55
|
-
} else {
|
|
56
|
-
parentNode.insertBefore(childNode, childNodes[index]);
|
|
57
|
-
}
|
|
45
|
+
// By exploiting arrays returning `undefined` for an undefined index, we can
|
|
46
|
+
// rely exclusively on `insertBefore(node, null)` instead of also using
|
|
47
|
+
// `appendChild(node)`. However, using `undefined` is not allowed by all
|
|
48
|
+
// browsers so we must replace it with `null`.
|
|
49
|
+
parentNode.insertBefore(
|
|
50
|
+
childNode,
|
|
51
|
+
parentNode.childNodes[index] || null
|
|
52
|
+
);
|
|
58
53
|
}
|
|
59
54
|
|
|
60
|
-
/**
|
|
61
|
-
* Sets the text content of `node` to `text`.
|
|
62
|
-
*
|
|
63
|
-
* @param {DOMElement} node Node to change
|
|
64
|
-
* @param {string} text New text content
|
|
65
|
-
*/
|
|
66
55
|
var updateTextContent;
|
|
67
56
|
if (textContentAccessor === 'textContent') {
|
|
57
|
+
/**
|
|
58
|
+
* Sets the text content of `node` to `text`.
|
|
59
|
+
*
|
|
60
|
+
* @param {DOMElement} node Node to change
|
|
61
|
+
* @param {string} text New text content
|
|
62
|
+
*/
|
|
68
63
|
updateTextContent = function(node, text) {
|
|
69
64
|
node.textContent = text;
|
|
70
65
|
};
|
|
71
66
|
} else {
|
|
67
|
+
/**
|
|
68
|
+
* Sets the text content of `node` to `text`.
|
|
69
|
+
*
|
|
70
|
+
* @param {DOMElement} node Node to change
|
|
71
|
+
* @param {string} text New text content
|
|
72
|
+
*/
|
|
72
73
|
updateTextContent = function(node, text) {
|
|
73
74
|
// In order to preserve newlines correctly, we can't use .innerText to set
|
|
74
75
|
// the contents (see #1080), so we empty the element then append a text node
|
|
@@ -113,6 +114,18 @@ var DOMChildrenOperations = {
|
|
|
113
114
|
var updatedChild = update.parentNode.childNodes[updatedIndex];
|
|
114
115
|
var parentID = update.parentID;
|
|
115
116
|
|
|
117
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
118
|
+
updatedChild,
|
|
119
|
+
'processUpdates(): Unable to find child %s of element. This ' +
|
|
120
|
+
'probably means the DOM was unexpectedly mutated (e.g., by the ' +
|
|
121
|
+
'browser), usually due to forgetting a <tbody> when using tables, ' +
|
|
122
|
+
'nesting <p> or <a> tags, or using non-SVG elements in an <svg> '+
|
|
123
|
+
'parent. Try inspecting the child nodes of the element with React ' +
|
|
124
|
+
'ID `%s`.',
|
|
125
|
+
updatedIndex,
|
|
126
|
+
parentID
|
|
127
|
+
) : invariant(updatedChild));
|
|
128
|
+
|
|
116
129
|
initialChildren = initialChildren || {};
|
|
117
130
|
initialChildren[parentID] = initialChildren[parentID] || [];
|
|
118
131
|
initialChildren[parentID][updatedIndex] = updatedChild;
|
package/lib/DOMProperty.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -32,7 +32,9 @@ var DOMPropertyInjection = {
|
|
|
32
32
|
MUST_USE_PROPERTY: 0x2,
|
|
33
33
|
HAS_SIDE_EFFECTS: 0x4,
|
|
34
34
|
HAS_BOOLEAN_VALUE: 0x8,
|
|
35
|
-
|
|
35
|
+
HAS_NUMERIC_VALUE: 0x10,
|
|
36
|
+
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
|
|
37
|
+
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* Inject some specialized knowledge about the DOM. This takes a config object
|
|
@@ -73,32 +75,36 @@ var DOMPropertyInjection = {
|
|
|
73
75
|
|
|
74
76
|
for (var propName in Properties) {
|
|
75
77
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
76
|
-
!DOMProperty.isStandardName
|
|
78
|
+
!DOMProperty.isStandardName.hasOwnProperty(propName),
|
|
77
79
|
'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
|
|
78
80
|
'\'%s\' which has already been injected. You may be accidentally ' +
|
|
79
81
|
'injecting the same DOM property config twice, or you may be ' +
|
|
80
82
|
'injecting two configs that have conflicting property names.',
|
|
81
83
|
propName
|
|
82
|
-
) : invariant(!DOMProperty.isStandardName
|
|
84
|
+
) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
|
|
83
85
|
|
|
84
86
|
DOMProperty.isStandardName[propName] = true;
|
|
85
87
|
|
|
86
88
|
var lowerCased = propName.toLowerCase();
|
|
87
89
|
DOMProperty.getPossibleStandardName[lowerCased] = propName;
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
if (DOMAttributeNames.hasOwnProperty(propName)) {
|
|
92
|
+
var attributeName = DOMAttributeNames[propName];
|
|
91
93
|
DOMProperty.getPossibleStandardName[attributeName] = propName;
|
|
94
|
+
DOMProperty.getAttributeName[propName] = attributeName;
|
|
95
|
+
} else {
|
|
96
|
+
DOMProperty.getAttributeName[propName] = lowerCased;
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
DOMProperty.getAttributeName[propName] = attributeName || lowerCased;
|
|
95
|
-
|
|
96
99
|
DOMProperty.getPropertyName[propName] =
|
|
97
|
-
DOMPropertyNames
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
DOMPropertyNames.hasOwnProperty(propName) ?
|
|
101
|
+
DOMPropertyNames[propName] :
|
|
102
|
+
propName;
|
|
103
|
+
|
|
104
|
+
if (DOMMutationMethods.hasOwnProperty(propName)) {
|
|
105
|
+
DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
|
|
106
|
+
} else {
|
|
107
|
+
DOMProperty.getMutationMethod[propName] = null;
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
var propConfig = Properties[propName];
|
|
@@ -110,8 +116,12 @@ var DOMPropertyInjection = {
|
|
|
110
116
|
propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;
|
|
111
117
|
DOMProperty.hasBooleanValue[propName] =
|
|
112
118
|
propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;
|
|
119
|
+
DOMProperty.hasNumericValue[propName] =
|
|
120
|
+
propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE;
|
|
113
121
|
DOMProperty.hasPositiveNumericValue[propName] =
|
|
114
122
|
propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE;
|
|
123
|
+
DOMProperty.hasOverloadedBooleanValue[propName] =
|
|
124
|
+
propConfig & DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
|
115
125
|
|
|
116
126
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
117
127
|
!DOMProperty.mustUseAttribute[propName] ||
|
|
@@ -128,12 +138,15 @@ var DOMPropertyInjection = {
|
|
|
128
138
|
) : invariant(DOMProperty.mustUseProperty[propName] ||
|
|
129
139
|
!DOMProperty.hasSideEffects[propName]));
|
|
130
140
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
141
|
+
!!DOMProperty.hasBooleanValue[propName] +
|
|
142
|
+
!!DOMProperty.hasNumericValue[propName] +
|
|
143
|
+
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
|
|
144
|
+
'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
|
|
145
|
+
'numeric value, but not a combination: %s',
|
|
134
146
|
propName
|
|
135
|
-
) : invariant(
|
|
136
|
-
|
|
147
|
+
) : invariant(!!DOMProperty.hasBooleanValue[propName] +
|
|
148
|
+
!!DOMProperty.hasNumericValue[propName] +
|
|
149
|
+
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
152
|
};
|
|
@@ -217,6 +230,13 @@ var DOMProperty = {
|
|
|
217
230
|
*/
|
|
218
231
|
hasBooleanValue: {},
|
|
219
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Whether the property must be numeric or parse as a
|
|
235
|
+
* numeric and should be removed when set to a falsey value.
|
|
236
|
+
* @type {Object}
|
|
237
|
+
*/
|
|
238
|
+
hasNumericValue: {},
|
|
239
|
+
|
|
220
240
|
/**
|
|
221
241
|
* Whether the property must be positive numeric or parse as a positive
|
|
222
242
|
* numeric and should be removed when set to a falsey value.
|
|
@@ -224,6 +244,14 @@ var DOMProperty = {
|
|
|
224
244
|
*/
|
|
225
245
|
hasPositiveNumericValue: {},
|
|
226
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Whether the property can be used as a flag as well as with a value. Removed
|
|
249
|
+
* when strictly equal to false; present without a value when strictly equal
|
|
250
|
+
* to true; present with a value otherwise.
|
|
251
|
+
* @type {Object}
|
|
252
|
+
*/
|
|
253
|
+
hasOverloadedBooleanValue: {},
|
|
254
|
+
|
|
227
255
|
/**
|
|
228
256
|
* All of the isCustomAttribute() functions that have been injected.
|
|
229
257
|
*/
|
|
@@ -234,11 +262,13 @@ var DOMProperty = {
|
|
|
234
262
|
* @method
|
|
235
263
|
*/
|
|
236
264
|
isCustomAttribute: function(attributeName) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
265
|
+
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
|
|
266
|
+
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
|
|
267
|
+
if (isCustomAttributeFn(attributeName)) {
|
|
268
|
+
return true;
|
|
240
269
|
}
|
|
241
|
-
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
242
272
|
},
|
|
243
273
|
|
|
244
274
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -23,11 +23,14 @@ var DOMProperty = require("./DOMProperty");
|
|
|
23
23
|
|
|
24
24
|
var escapeTextForBrowser = require("./escapeTextForBrowser");
|
|
25
25
|
var memoizeStringOnly = require("./memoizeStringOnly");
|
|
26
|
+
var warning = require("./warning");
|
|
26
27
|
|
|
27
28
|
function shouldIgnoreValue(name, value) {
|
|
28
29
|
return value == null ||
|
|
29
|
-
DOMProperty.hasBooleanValue[name] && !value ||
|
|
30
|
-
DOMProperty.
|
|
30
|
+
(DOMProperty.hasBooleanValue[name] && !value) ||
|
|
31
|
+
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
|
|
32
|
+
(DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
|
|
33
|
+
(DOMProperty.hasOverloadedBooleanValue[name] && value === false);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
|
|
@@ -44,7 +47,8 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
44
47
|
var warnedProperties = {};
|
|
45
48
|
|
|
46
49
|
var warnUnknownProperty = function(name) {
|
|
47
|
-
if (reactProps
|
|
50
|
+
if (reactProps.hasOwnProperty(name) && reactProps[name] ||
|
|
51
|
+
warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
54
|
|
|
@@ -52,16 +56,20 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
52
56
|
var lowerCasedName = name.toLowerCase();
|
|
53
57
|
|
|
54
58
|
// data-* attributes should be lowercase; suggest the lowercase version
|
|
55
|
-
var standardName =
|
|
56
|
-
|
|
59
|
+
var standardName = (
|
|
60
|
+
DOMProperty.isCustomAttribute(lowerCasedName) ?
|
|
61
|
+
lowerCasedName :
|
|
62
|
+
DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
|
|
63
|
+
DOMProperty.getPossibleStandardName[lowerCasedName] :
|
|
64
|
+
null
|
|
65
|
+
);
|
|
57
66
|
|
|
58
67
|
// For now, only warn when we have a suggested correction. This prevents
|
|
59
68
|
// logging too much when using transferPropsTo.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
69
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
70
|
+
standardName == null,
|
|
71
|
+
'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'
|
|
72
|
+
) : null);
|
|
65
73
|
|
|
66
74
|
};
|
|
67
75
|
}
|
|
@@ -90,12 +98,14 @@ var DOMPropertyOperations = {
|
|
|
90
98
|
* @return {?string} Markup string, or null if the property was invalid.
|
|
91
99
|
*/
|
|
92
100
|
createMarkupForProperty: function(name, value) {
|
|
93
|
-
if (DOMProperty.isStandardName
|
|
101
|
+
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
|
|
102
|
+
DOMProperty.isStandardName[name]) {
|
|
94
103
|
if (shouldIgnoreValue(name, value)) {
|
|
95
104
|
return '';
|
|
96
105
|
}
|
|
97
106
|
var attributeName = DOMProperty.getAttributeName[name];
|
|
98
|
-
if (DOMProperty.hasBooleanValue[name]
|
|
107
|
+
if (DOMProperty.hasBooleanValue[name] ||
|
|
108
|
+
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
|
|
99
109
|
return escapeTextForBrowser(attributeName);
|
|
100
110
|
}
|
|
101
111
|
return processAttributeNameAndPrefix(attributeName) +
|
|
@@ -120,7 +130,8 @@ var DOMPropertyOperations = {
|
|
|
120
130
|
* @param {*} value
|
|
121
131
|
*/
|
|
122
132
|
setValueForProperty: function(node, name, value) {
|
|
123
|
-
if (DOMProperty.isStandardName
|
|
133
|
+
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
|
|
134
|
+
DOMProperty.isStandardName[name]) {
|
|
124
135
|
var mutationMethod = DOMProperty.getMutationMethod[name];
|
|
125
136
|
if (mutationMethod) {
|
|
126
137
|
mutationMethod(node, value);
|
|
@@ -136,7 +147,7 @@ var DOMPropertyOperations = {
|
|
|
136
147
|
}
|
|
137
148
|
} else if (DOMProperty.isCustomAttribute(name)) {
|
|
138
149
|
if (value == null) {
|
|
139
|
-
node.removeAttribute(
|
|
150
|
+
node.removeAttribute(name);
|
|
140
151
|
} else {
|
|
141
152
|
node.setAttribute(name, '' + value);
|
|
142
153
|
}
|
|
@@ -152,7 +163,8 @@ var DOMPropertyOperations = {
|
|
|
152
163
|
* @param {string} name
|
|
153
164
|
*/
|
|
154
165
|
deleteValueForProperty: function(node, name) {
|
|
155
|
-
if (DOMProperty.isStandardName
|
|
166
|
+
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
|
|
167
|
+
DOMProperty.isStandardName[name]) {
|
|
156
168
|
var mutationMethod = DOMProperty.getMutationMethod[name];
|
|
157
169
|
if (mutationMethod) {
|
|
158
170
|
mutationMethod(node, undefined);
|
|
@@ -162,7 +174,7 @@ var DOMPropertyOperations = {
|
|
|
162
174
|
var propName = DOMProperty.getPropertyName[name];
|
|
163
175
|
var defaultValue = DOMProperty.getDefaultValueForProperty(
|
|
164
176
|
node.nodeName,
|
|
165
|
-
|
|
177
|
+
propName
|
|
166
178
|
);
|
|
167
179
|
if (!DOMProperty.hasSideEffects[name] ||
|
|
168
180
|
node[propName] !== defaultValue) {
|
package/lib/Danger.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -37,6 +37,7 @@ var DefaultEventPluginOrder = [
|
|
|
37
37
|
keyOf({ChangeEventPlugin: null}),
|
|
38
38
|
keyOf({SelectEventPlugin: null}),
|
|
39
39
|
keyOf({CompositionEventPlugin: null}),
|
|
40
|
+
keyOf({BeforeInputEventPlugin: null}),
|
|
40
41
|
keyOf({AnalyticsEventPlugin: null}),
|
|
41
42
|
keyOf({MobileSafariClickEventPlugin: null})
|
|
42
43
|
];
|
package/lib/EventConstants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -61,6 +61,7 @@ var topLevelTypes = keyMirror({
|
|
|
61
61
|
topScroll: null,
|
|
62
62
|
topSelectionChange: null,
|
|
63
63
|
topSubmit: null,
|
|
64
|
+
topTextInput: null,
|
|
64
65
|
topTouchCancel: null,
|
|
65
66
|
topTouchEnd: null,
|
|
66
67
|
topTouchMove: null,
|
package/lib/EventListener.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @providesModule EventListener
|
|
3
|
+
* @typechecks
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
var emptyFunction = require("./emptyFunction");
|
|
@@ -29,7 +30,7 @@ var EventListener = {
|
|
|
29
30
|
target.attachEvent('on' + eventType, callback);
|
|
30
31
|
return {
|
|
31
32
|
remove: function() {
|
|
32
|
-
target.detachEvent(eventType, callback);
|
|
33
|
+
target.detachEvent('on' + eventType, callback);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -63,7 +64,9 @@ var EventListener = {
|
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
|
-
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
registerDefault: function() {}
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
module.exports = EventListener;
|
package/lib/EventPluginHub.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
|
|
21
21
|
var EventPluginRegistry = require("./EventPluginRegistry");
|
|
22
22
|
var EventPluginUtils = require("./EventPluginUtils");
|
|
23
|
-
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
24
23
|
|
|
25
24
|
var accumulate = require("./accumulate");
|
|
26
25
|
var forEachAccumulated = require("./forEachAccumulated");
|
|
27
26
|
var invariant = require("./invariant");
|
|
28
27
|
var isEventSupported = require("./isEventSupported");
|
|
28
|
+
var monitorCodeUse = require("./monitorCodeUse");
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal store for event listeners
|
|
@@ -141,6 +141,8 @@ var EventPluginHub = {
|
|
|
141
141
|
|
|
142
142
|
},
|
|
143
143
|
|
|
144
|
+
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
|
|
145
|
+
|
|
144
146
|
registrationNameModules: EventPluginRegistry.registrationNameModules,
|
|
145
147
|
|
|
146
148
|
/**
|
|
@@ -151,10 +153,6 @@ var EventPluginHub = {
|
|
|
151
153
|
* @param {?function} listener The callback to store.
|
|
152
154
|
*/
|
|
153
155
|
putListener: function(id, registrationName, listener) {
|
|
154
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
155
|
-
ExecutionEnvironment.canUseDOM,
|
|
156
|
-
'Cannot call putListener() in a non-DOM environment.'
|
|
157
|
-
) : invariant(ExecutionEnvironment.canUseDOM));
|
|
158
156
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
159
157
|
!listener || typeof listener === 'function',
|
|
160
158
|
'Expected %s listener to be a function, instead got type %s',
|
|
@@ -166,6 +164,7 @@ var EventPluginHub = {
|
|
|
166
164
|
// bubble.
|
|
167
165
|
if (registrationName === 'onScroll' &&
|
|
168
166
|
!isEventSupported('scroll', true)) {
|
|
167
|
+
monitorCodeUse('react_no_scroll_event');
|
|
169
168
|
console.warn('This browser doesn\'t support the `onScroll` event');
|
|
170
169
|
}
|
|
171
170
|
}
|