react 0.14.0-alpha2 → 0.14.0-beta3
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 +5 -2
- package/addons.js +6 -3
- package/dist/JSXTransformer.js +634 -274
- package/dist/react-with-addons.js +5350 -4954
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4777 -4408
- package/dist/react.min.js +6 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +16 -14
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +82 -117
- package/lib/DOMPropertyOperations.js +78 -33
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +8 -8
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +13 -13
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +17 -17
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +13 -3
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +50 -38
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +14 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +20 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +9 -9
- package/lib/ReactClass.js +65 -83
- package/lib/ReactComponent.js +22 -17
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +80 -111
- package/lib/ReactDOM.js +72 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +378 -56
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +23 -23
- package/lib/ReactDOMInput.js +83 -99
- package/lib/ReactDOMOption.js +25 -45
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -71
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +22 -83
- package/lib/ReactElementValidator.js +48 -117
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +57 -12
- package/lib/ReactFragment.js +22 -17
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +88 -88
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -8
- package/lib/ReactNoopUpdateQueue.js +118 -0
- 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 +49 -11
- package/lib/ReactReconcileTransaction.js +8 -8
- package/lib/ReactReconciler.js +18 -20
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +7 -7
- package/lib/ReactTestUtils.js +80 -58
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +61 -36
- package/lib/ReactUpdates.js +14 -17
- package/lib/ReactWithAddons.js +14 -16
- 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 +14 -15
- package/lib/SimpleEventPlugin.js +205 -29
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +9 -8
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +3 -3
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +5 -5
- package/lib/SyntheticTouchEvent.js +4 -4
- package/lib/SyntheticUIEvent.js +4 -4
- package/lib/SyntheticWheelEvent.js +3 -3
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +16 -10
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +47 -0
- package/lib/findDOMNode.js +11 -12
- package/lib/flattenChildren.js +4 -4
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +24 -20
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +2 -2
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +15 -14
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +14 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +53 -1
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- package/lib/ReactDOMClient.js +0 -85
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- 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/createFullPageComponent.js +0 -51
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -115
- 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/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -61
package/lib/ReactDOMForm.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 ReactDOMForm
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var EventConstants = require("./EventConstants");
|
|
15
|
-
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
|
|
16
|
-
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
17
|
-
var ReactClass = require("./ReactClass");
|
|
18
|
-
var ReactElement = require("./ReactElement");
|
|
19
|
-
|
|
20
|
-
var form = ReactElement.createFactory('form');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
|
|
24
|
-
* to capture it on the <form> element itself. There are lots of hacks we could
|
|
25
|
-
* do to accomplish this, but the most reliable is to make <form> a
|
|
26
|
-
* composite component and use `componentDidMount` to attach the event handlers.
|
|
27
|
-
*/
|
|
28
|
-
var ReactDOMForm = ReactClass.createClass({
|
|
29
|
-
displayName: 'ReactDOMForm',
|
|
30
|
-
tagName: 'FORM',
|
|
31
|
-
|
|
32
|
-
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
|
|
33
|
-
|
|
34
|
-
render: function () {
|
|
35
|
-
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
|
|
36
|
-
// `jshint` fails to parse JSX so in order for linting to work in the open
|
|
37
|
-
// source repo, we need to just use `ReactDOM.form`.
|
|
38
|
-
return form(this.props);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
componentDidMount: function () {
|
|
42
|
-
this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
|
|
43
|
-
this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
module.exports = ReactDOMForm;
|
package/lib/ReactDOMIframe.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 ReactDOMIframe
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var EventConstants = require("./EventConstants");
|
|
15
|
-
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
|
|
16
|
-
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
17
|
-
var ReactClass = require("./ReactClass");
|
|
18
|
-
var ReactElement = require("./ReactElement");
|
|
19
|
-
|
|
20
|
-
var iframe = ReactElement.createFactory('iframe');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
|
|
24
|
-
* capture it on the <iframe> element itself. There are lots of hacks we could
|
|
25
|
-
* do to accomplish this, but the most reliable is to make <iframe> a composite
|
|
26
|
-
* component and use `componentDidMount` to attach the event handlers.
|
|
27
|
-
*/
|
|
28
|
-
var ReactDOMIframe = ReactClass.createClass({
|
|
29
|
-
displayName: 'ReactDOMIframe',
|
|
30
|
-
tagName: 'IFRAME',
|
|
31
|
-
|
|
32
|
-
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
|
|
33
|
-
|
|
34
|
-
render: function () {
|
|
35
|
-
return iframe(this.props);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
componentDidMount: function () {
|
|
39
|
-
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
module.exports = ReactDOMIframe;
|
package/lib/ReactDOMImg.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 ReactDOMImg
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var EventConstants = require("./EventConstants");
|
|
15
|
-
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
|
|
16
|
-
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
17
|
-
var ReactClass = require("./ReactClass");
|
|
18
|
-
var ReactElement = require("./ReactElement");
|
|
19
|
-
|
|
20
|
-
var img = ReactElement.createFactory('img');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
|
|
24
|
-
* capture it on the <img> element itself. There are lots of hacks we could do
|
|
25
|
-
* to accomplish this, but the most reliable is to make <img> a composite
|
|
26
|
-
* component and use `componentDidMount` to attach the event handlers.
|
|
27
|
-
*/
|
|
28
|
-
var ReactDOMImg = ReactClass.createClass({
|
|
29
|
-
displayName: 'ReactDOMImg',
|
|
30
|
-
tagName: 'IMG',
|
|
31
|
-
|
|
32
|
-
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
|
|
33
|
-
|
|
34
|
-
render: function () {
|
|
35
|
-
return img(this.props);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
componentDidMount: function () {
|
|
39
|
-
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
|
|
40
|
-
this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
module.exports = ReactDOMImg;
|
package/lib/ReactLifeCycle.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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 ReactLifeCycle
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This module manages the bookkeeping when a component is in the process
|
|
16
|
-
* of being mounted or being unmounted. This is used as a way to enforce
|
|
17
|
-
* invariants (or warnings) when it is not recommended to call
|
|
18
|
-
* setState/forceUpdate.
|
|
19
|
-
*
|
|
20
|
-
* currentlyMountingInstance: During the construction phase, it is not possible
|
|
21
|
-
* to trigger an update since the instance is not fully mounted yet. However, we
|
|
22
|
-
* currently allow this as a convenience for mutating the initial state.
|
|
23
|
-
*
|
|
24
|
-
* currentlyUnmountingInstance: During the unmounting phase, the instance is
|
|
25
|
-
* still mounted and can therefore schedule an update. However, this is not
|
|
26
|
-
* recommended and probably an error since it's about to be unmounted.
|
|
27
|
-
* Therefore we still want to trigger in an error for that case.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
var ReactLifeCycle = {
|
|
31
|
-
currentlyMountingInstance: null,
|
|
32
|
-
currentlyUnmountingInstance: null
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
module.exports = ReactLifeCycle;
|
package/lib/camelize.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 camelize
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
"use strict";
|
|
14
|
-
|
|
15
|
-
var _hyphenPattern = /-(.)/g;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Camelcases a hyphenated string, for example:
|
|
19
|
-
*
|
|
20
|
-
* > camelize('background-color')
|
|
21
|
-
* < "backgroundColor"
|
|
22
|
-
*
|
|
23
|
-
* @param {string} string
|
|
24
|
-
* @return {string}
|
|
25
|
-
*/
|
|
26
|
-
function camelize(string) {
|
|
27
|
-
return string.replace(_hyphenPattern, function (_, character) {
|
|
28
|
-
return character.toUpperCase();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = camelize;
|
package/lib/camelizeStyleName.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-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 camelizeStyleName
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var camelize = require("./camelize");
|
|
16
|
-
|
|
17
|
-
var msPattern = /^-ms-/;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Camelcases a hyphenated CSS property name, for example:
|
|
21
|
-
*
|
|
22
|
-
* > camelizeStyleName('background-color')
|
|
23
|
-
* < "backgroundColor"
|
|
24
|
-
* > camelizeStyleName('-moz-transition')
|
|
25
|
-
* < "MozTransition"
|
|
26
|
-
* > camelizeStyleName('-ms-transition')
|
|
27
|
-
* < "msTransition"
|
|
28
|
-
*
|
|
29
|
-
* As Andi Smith suggests
|
|
30
|
-
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
|
|
31
|
-
* is converted to lowercase `ms`.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} string
|
|
34
|
-
* @return {string}
|
|
35
|
-
*/
|
|
36
|
-
function camelizeStyleName(string) {
|
|
37
|
-
return camelize(string.replace(msPattern, 'ms-'));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = camelizeStyleName;
|
package/lib/containsNode.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 containsNode
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var isTextNode = require("./isTextNode");
|
|
16
|
-
|
|
17
|
-
/*jslint bitwise:true */
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Checks if a given DOM node contains or is another DOM node.
|
|
21
|
-
*
|
|
22
|
-
* @param {?DOMNode} outerNode Outer DOM node.
|
|
23
|
-
* @param {?DOMNode} innerNode Inner DOM node.
|
|
24
|
-
* @return {boolean} True if `outerNode` contains or is `innerNode`.
|
|
25
|
-
*/
|
|
26
|
-
function containsNode(_x, _x2) {
|
|
27
|
-
var _again = true;
|
|
28
|
-
|
|
29
|
-
_function: while (_again) {
|
|
30
|
-
var outerNode = _x,
|
|
31
|
-
innerNode = _x2;
|
|
32
|
-
_again = false;
|
|
33
|
-
|
|
34
|
-
if (!outerNode || !innerNode) {
|
|
35
|
-
return false;
|
|
36
|
-
} else if (outerNode === innerNode) {
|
|
37
|
-
return true;
|
|
38
|
-
} else if (isTextNode(outerNode)) {
|
|
39
|
-
return false;
|
|
40
|
-
} else if (isTextNode(innerNode)) {
|
|
41
|
-
_x = outerNode;
|
|
42
|
-
_x2 = innerNode.parentNode;
|
|
43
|
-
_again = true;
|
|
44
|
-
continue _function;
|
|
45
|
-
} else if (outerNode.contains) {
|
|
46
|
-
return outerNode.contains(innerNode);
|
|
47
|
-
} else if (outerNode.compareDocumentPosition) {
|
|
48
|
-
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
|
|
49
|
-
} else {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = containsNode;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 createArrayFromMixed
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var toArray = require("./toArray");
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Perform a heuristic test to determine if an object is "array-like".
|
|
19
|
-
*
|
|
20
|
-
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
|
|
21
|
-
* Joshu replied: "Mu."
|
|
22
|
-
*
|
|
23
|
-
* This function determines if its argument has "array nature": it returns
|
|
24
|
-
* true if the argument is an actual array, an `arguments' object, or an
|
|
25
|
-
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
|
|
26
|
-
*
|
|
27
|
-
* It will return false for other array-like objects like Filelist.
|
|
28
|
-
*
|
|
29
|
-
* @param {*} obj
|
|
30
|
-
* @return {boolean}
|
|
31
|
-
*/
|
|
32
|
-
function hasArrayNature(obj) {
|
|
33
|
-
return (
|
|
34
|
-
// not null/false
|
|
35
|
-
!!obj && (typeof obj == 'object' || typeof obj == 'function') && 'length' in obj &&
|
|
36
|
-
// not window
|
|
37
|
-
!('setInterval' in obj) && typeof obj.nodeType != 'number' && (
|
|
38
|
-
// a real array
|
|
39
|
-
(Array.isArray(obj) || 'callee' in obj || 'item' in obj))
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Ensure that the argument is an array by wrapping it in an array if it is not.
|
|
45
|
-
* Creates a copy of the argument if it is already an array.
|
|
46
|
-
*
|
|
47
|
-
* This is mostly useful idiomatically:
|
|
48
|
-
*
|
|
49
|
-
* var createArrayFromMixed = require('createArrayFromMixed');
|
|
50
|
-
*
|
|
51
|
-
* function takesOneOrMoreThings(things) {
|
|
52
|
-
* things = createArrayFromMixed(things);
|
|
53
|
-
* ...
|
|
54
|
-
* }
|
|
55
|
-
*
|
|
56
|
-
* This allows you to treat `things' as an array, but accept scalars in the API.
|
|
57
|
-
*
|
|
58
|
-
* If you need to convert an array-like object, like `arguments`, into an array
|
|
59
|
-
* use toArray instead.
|
|
60
|
-
*
|
|
61
|
-
* @param {*} obj
|
|
62
|
-
* @return {array}
|
|
63
|
-
*/
|
|
64
|
-
function createArrayFromMixed(obj) {
|
|
65
|
-
if (!hasArrayNature(obj)) {
|
|
66
|
-
return [obj];
|
|
67
|
-
} else if (Array.isArray(obj)) {
|
|
68
|
-
return obj.slice();
|
|
69
|
-
} else {
|
|
70
|
-
return toArray(obj);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
module.exports = createArrayFromMixed;
|
|
75
|
-
|
|
76
|
-
// arrays are objects, NodeLists are functions in Safari
|
|
77
|
-
|
|
78
|
-
// quacks like an array
|
|
79
|
-
|
|
80
|
-
// no DOM node should be considered an array-like
|
|
81
|
-
// a 'select' element has 'length' and 'item' properties on IE8
|
|
82
|
-
|
|
83
|
-
// arguments
|
|
84
|
-
|
|
85
|
-
// HTMLCollection/NodeList
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 createFullPageComponent
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
// Defeat circular references by requiring this directly.
|
|
16
|
-
var ReactClass = require("./ReactClass");
|
|
17
|
-
var ReactElement = require("./ReactElement");
|
|
18
|
-
|
|
19
|
-
var invariant = require("./invariant");
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create a component that will throw an exception when unmounted.
|
|
23
|
-
*
|
|
24
|
-
* Components like <html> <head> and <body> can't be removed or added
|
|
25
|
-
* easily in a cross-browser way, however it's valuable to be able to
|
|
26
|
-
* take advantage of React's reconciliation for styling and <title>
|
|
27
|
-
* management. So we just document it and throw in dangerous cases.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} tag The tag to wrap
|
|
30
|
-
* @return {function} convenience constructor of new component
|
|
31
|
-
*/
|
|
32
|
-
function createFullPageComponent(tag) {
|
|
33
|
-
var elementFactory = ReactElement.createFactory(tag);
|
|
34
|
-
|
|
35
|
-
var FullPageComponent = ReactClass.createClass({
|
|
36
|
-
tagName: tag.toUpperCase(),
|
|
37
|
-
displayName: 'ReactFullPageComponent' + tag,
|
|
38
|
-
|
|
39
|
-
componentWillUnmount: function () {
|
|
40
|
-
'production' !== process.env.NODE_ENV ? invariant(false, '%s tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, <head>, ' + 'and <body>) reliably and efficiently. To fix this, have a single ' + 'top-level component that never unmounts render these elements.', this.constructor.displayName) : invariant(false);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
render: function () {
|
|
44
|
-
return elementFactory(this.props);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return FullPageComponent;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports = createFullPageComponent;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 createNodesFromMarkup
|
|
10
|
-
* @typechecks
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/*jslint evil: true, sub: true */
|
|
14
|
-
|
|
15
|
-
'use strict';
|
|
16
|
-
|
|
17
|
-
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
18
|
-
|
|
19
|
-
var createArrayFromMixed = require("./createArrayFromMixed");
|
|
20
|
-
var getMarkupWrap = require("./getMarkupWrap");
|
|
21
|
-
var invariant = require("./invariant");
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Dummy container used to render all markup.
|
|
25
|
-
*/
|
|
26
|
-
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Pattern used by `getNodeName`.
|
|
30
|
-
*/
|
|
31
|
-
var nodeNamePattern = /^\s*<(\w+)/;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Extracts the `nodeName` of the first element in a string of markup.
|
|
35
|
-
*
|
|
36
|
-
* @param {string} markup String of markup.
|
|
37
|
-
* @return {?string} Node name of the supplied markup.
|
|
38
|
-
*/
|
|
39
|
-
function getNodeName(markup) {
|
|
40
|
-
var nodeNameMatch = markup.match(nodeNamePattern);
|
|
41
|
-
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Creates an array containing the nodes rendered from the supplied markup. The
|
|
46
|
-
* optionally supplied `handleScript` function will be invoked once for each
|
|
47
|
-
* <script> element that is rendered. If no `handleScript` function is supplied,
|
|
48
|
-
* an exception is thrown if any <script> elements are rendered.
|
|
49
|
-
*
|
|
50
|
-
* @param {string} markup A string of valid HTML markup.
|
|
51
|
-
* @param {?function} handleScript Invoked once for each rendered <script>.
|
|
52
|
-
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
|
|
53
|
-
*/
|
|
54
|
-
function createNodesFromMarkup(markup, handleScript) {
|
|
55
|
-
var node = dummyNode;
|
|
56
|
-
'production' !== process.env.NODE_ENV ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode);
|
|
57
|
-
var nodeName = getNodeName(markup);
|
|
58
|
-
|
|
59
|
-
var wrap = nodeName && getMarkupWrap(nodeName);
|
|
60
|
-
if (wrap) {
|
|
61
|
-
node.innerHTML = wrap[1] + markup + wrap[2];
|
|
62
|
-
|
|
63
|
-
var wrapDepth = wrap[0];
|
|
64
|
-
while (wrapDepth--) {
|
|
65
|
-
node = node.lastChild;
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
node.innerHTML = markup;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var scripts = node.getElementsByTagName('script');
|
|
72
|
-
if (scripts.length) {
|
|
73
|
-
'production' !== process.env.NODE_ENV ? invariant(handleScript, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(handleScript);
|
|
74
|
-
createArrayFromMixed(scripts).forEach(handleScript);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var nodes = createArrayFromMixed(node.childNodes);
|
|
78
|
-
while (node.lastChild) {
|
|
79
|
-
node.removeChild(node.lastChild);
|
|
80
|
-
}
|
|
81
|
-
return nodes;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
module.exports = createNodesFromMarkup;
|