react 0.8.0 → 0.9.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 +0 -8
- package/addons.js +0 -3
- package/lib/AutoFocusMixin.js +30 -0
- package/lib/CSSCore.js +22 -21
- package/lib/CSSProperty.js +31 -0
- package/lib/ChangeEventPlugin.js +26 -4
- package/lib/ClientReactRootIndex.js +30 -0
- package/lib/CompositionEventPlugin.js +57 -9
- package/lib/DOMChildrenOperations.js +32 -2
- package/lib/DOMProperty.js +2 -0
- package/lib/DOMPropertyOperations.js +14 -1
- package/lib/Danger.js +8 -7
- package/lib/DefaultDOMPropertyConfig.js +12 -2
- package/lib/EnterLeaveEventPlugin.js +37 -4
- package/lib/EventConstants.js +3 -0
- package/lib/EventListener.js +42 -34
- package/lib/EventPluginHub.js +113 -12
- package/lib/EventPluginRegistry.js +39 -16
- package/lib/EventPluginUtils.js +32 -3
- package/lib/EventPropagators.js +6 -42
- package/lib/ExecutionEnvironment.js +3 -0
- package/lib/LinkedValueUtils.js +161 -0
- package/lib/PooledClass.js +6 -0
- package/lib/React.js +27 -3
- package/lib/ReactCSSTransitionGroup.js +65 -0
- package/lib/{ReactTransitionableChild.js → ReactCSSTransitionGroupChild.js} +21 -35
- package/lib/ReactComponent.js +87 -52
- package/lib/ReactComponentBrowserEnvironment.js +67 -49
- package/lib/ReactComponentEnvironment.js +2 -0
- package/lib/ReactCompositeComponent.js +547 -112
- package/lib/ReactContext.js +67 -0
- package/lib/ReactDOM.js +13 -0
- package/lib/ReactDOMButton.js +4 -0
- package/lib/ReactDOMComponent.js +46 -21
- package/lib/ReactDOMForm.js +9 -2
- package/lib/ReactDOMIDOperations.js +105 -60
- package/lib/ReactDOMImg.js +58 -0
- package/lib/ReactDOMInput.js +26 -14
- package/lib/ReactDOMOption.js +1 -0
- package/lib/ReactDOMSelect.js +36 -17
- package/lib/ReactDOMTextarea.js +12 -8
- package/lib/ReactDefaultInjection.js +50 -26
- package/lib/ReactDefaultPerf.js +207 -370
- package/lib/ReactDefaultPerfAnalysis.js +199 -0
- package/lib/ReactErrorUtils.js +5 -14
- package/lib/ReactEventEmitter.js +141 -145
- package/lib/ReactEventEmitterMixin.js +0 -32
- package/lib/ReactEventTopLevelCallback.js +32 -12
- package/lib/ReactInjection.js +39 -0
- package/lib/ReactInstanceHandles.js +35 -19
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMount.js +127 -103
- package/lib/ReactMountReady.js +1 -1
- package/lib/ReactMultiChild.js +30 -46
- package/lib/ReactMultiChildUpdateTypes.js +2 -0
- package/lib/ReactOwner.js +10 -2
- package/lib/ReactPerf.js +5 -8
- package/lib/ReactPropTransferer.js +40 -21
- package/lib/ReactPropTypeLocationNames.js +31 -0
- package/lib/ReactPropTypeLocations.js +29 -0
- package/lib/ReactPropTypes.js +248 -47
- package/lib/ReactPutListenerQueue.js +61 -0
- package/lib/ReactReconcileTransaction.js +20 -0
- package/lib/ReactRootIndex.js +36 -0
- package/lib/ReactServerRendering.js +8 -11
- package/lib/ReactTextComponent.js +8 -3
- package/lib/{ReactTransitionKeySet.js → ReactTransitionChildMapping.js} +42 -47
- package/lib/ReactTransitionGroup.js +132 -57
- package/lib/ReactUpdates.js +14 -11
- package/lib/ReactWithAddons.js +7 -2
- package/lib/SelectEventPlugin.js +22 -39
- package/lib/ServerReactRootIndex.js +36 -0
- package/lib/SimpleEventPlugin.js +54 -6
- package/lib/SyntheticClipboardEvent.js +7 -1
- package/lib/SyntheticDragEvent.js +44 -0
- package/lib/SyntheticEvent.js +2 -1
- package/lib/SyntheticKeyboardEvent.js +4 -2
- package/lib/SyntheticWheelEvent.js +10 -7
- package/lib/Transaction.js +61 -36
- package/lib/cloneWithProps.js +59 -0
- package/lib/createArrayFrom.js +10 -13
- package/lib/createFullPageComponent.js +63 -0
- package/lib/cx.js +2 -2
- package/lib/flattenChildren.js +5 -2
- package/lib/getActiveElement.js +4 -3
- package/lib/getEventKey.js +85 -0
- package/lib/getMarkupWrap.js +10 -0
- package/lib/getTextContentAccessor.js +5 -3
- package/lib/getUnboundedScrollPosition.js +2 -2
- package/lib/invariant.js +12 -4
- package/lib/isEventSupported.js +7 -11
- package/lib/mergeHelpers.js +5 -6
- package/lib/onlyChild.js +43 -0
- package/lib/shouldUpdateReactComponent.js +58 -0
- package/lib/toArray.js +75 -0
- package/lib/traverseAllChildren.js +69 -7
- package/lib/warning.js +40 -0
- package/package.json +2 -3
- package/react.js +0 -3
- package/ReactJSErrors.js +0 -40
- package/lib/$.js +0 -46
- package/lib/CallbackRegistry.js +0 -91
- package/lib/LinkedValueMixin.js +0 -68
- package/lib/ex.js +0 -49
- package/lib/filterAttributes.js +0 -45
- package/lib/ge.js +0 -76
- package/lib/mutateHTMLNodeWithMarkup.js +0 -100
|
@@ -1,100 +0,0 @@
|
|
|
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 mutateHTMLNodeWithMarkup
|
|
17
|
-
* @typechecks static-only
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/*jslint evil: true */
|
|
21
|
-
|
|
22
|
-
'use strict';
|
|
23
|
-
|
|
24
|
-
var createNodesFromMarkup = require("./createNodesFromMarkup");
|
|
25
|
-
var filterAttributes = require("./filterAttributes");
|
|
26
|
-
var invariant = require("./invariant");
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* You can't set the innerHTML of a document. Unless you have
|
|
30
|
-
* this function.
|
|
31
|
-
*
|
|
32
|
-
* @param {DOMElement} node with tagName == 'html'
|
|
33
|
-
* @param {string} markup markup string including <html>.
|
|
34
|
-
*/
|
|
35
|
-
function mutateHTMLNodeWithMarkup(node, markup) {
|
|
36
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
37
|
-
node.tagName.toLowerCase() === 'html',
|
|
38
|
-
'mutateHTMLNodeWithMarkup(): node must have tagName of "html", got %s',
|
|
39
|
-
node.tagName
|
|
40
|
-
) : invariant(node.tagName.toLowerCase() === 'html'));
|
|
41
|
-
|
|
42
|
-
markup = markup.trim();
|
|
43
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
44
|
-
markup.toLowerCase().indexOf('<html') === 0,
|
|
45
|
-
'mutateHTMLNodeWithMarkup(): markup must start with <html'
|
|
46
|
-
) : invariant(markup.toLowerCase().indexOf('<html') === 0));
|
|
47
|
-
|
|
48
|
-
// First let's extract the various pieces of markup.
|
|
49
|
-
var htmlOpenTagEnd = markup.indexOf('>') + 1;
|
|
50
|
-
var htmlCloseTagStart = markup.lastIndexOf('<');
|
|
51
|
-
var htmlOpenTag = markup.substring(0, htmlOpenTagEnd);
|
|
52
|
-
var innerHTML = markup.substring(htmlOpenTagEnd, htmlCloseTagStart);
|
|
53
|
-
|
|
54
|
-
// Now for the fun stuff. Pass through both sets of attributes and
|
|
55
|
-
// bring them up-to-date. We get the new set by creating a markup
|
|
56
|
-
// fragment.
|
|
57
|
-
var shouldExtractAttributes = htmlOpenTag.indexOf(' ') > -1;
|
|
58
|
-
var attributeHolder = null;
|
|
59
|
-
|
|
60
|
-
if (shouldExtractAttributes) {
|
|
61
|
-
// We extract the attributes by creating a <span> and evaluating
|
|
62
|
-
// the node.
|
|
63
|
-
attributeHolder = createNodesFromMarkup(
|
|
64
|
-
htmlOpenTag.replace('html ', 'span ') + '</span>'
|
|
65
|
-
)[0];
|
|
66
|
-
|
|
67
|
-
// Add all attributes present in attributeHolder
|
|
68
|
-
var attributesToSet = filterAttributes(
|
|
69
|
-
attributeHolder,
|
|
70
|
-
function(attr) {
|
|
71
|
-
return node.getAttributeNS(attr.namespaceURI, attr.name) !== attr.value;
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
attributesToSet.forEach(function(attr) {
|
|
75
|
-
node.setAttributeNS(attr.namespaceURI, attr.name, attr.value);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Remove all attributes not present in attributeHolder
|
|
80
|
-
var attributesToRemove = filterAttributes(
|
|
81
|
-
node,
|
|
82
|
-
function(attr) {
|
|
83
|
-
// Remove all attributes if attributeHolder is null or if it does not have
|
|
84
|
-
// the desired attribute.
|
|
85
|
-
return !(
|
|
86
|
-
attributeHolder &&
|
|
87
|
-
attributeHolder.hasAttributeNS(attr.namespaceURI, attr.name)
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
attributesToRemove.forEach(function(attr) {
|
|
92
|
-
node.removeAttributeNS(attr.namespaceURI, attr.name);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// Finally, set the inner HTML. No tricks needed. Do this last to
|
|
96
|
-
// minimize likelihood of triggering reflows.
|
|
97
|
-
node.innerHTML = innerHTML;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
module.exports = mutateHTMLNodeWithMarkup;
|