Socket
Socket
Sign inDemoInstall

react

Package Overview
Dependencies
38
Maintainers
4
Versions
1793
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.14.0-beta3 to 0.14.0-rc1

dist/react-dom.js

2

addons.js

@@ -0,1 +1,3 @@

'use strict';
var warning = require('fbjs/lib/warning');

@@ -2,0 +4,0 @@ warning(

3

lib/ChangeEventPlugin.js

@@ -21,2 +21,3 @@ /**

var getEventTarget = require('./getEventTarget');
var isEventSupported = require('./isEventSupported');

@@ -61,3 +62,3 @@ var isTextInputElement = require('./isTextInputElement');

function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, nativeEvent.target);
var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);

@@ -64,0 +65,0 @@

@@ -42,2 +42,3 @@ /**

fillOpacity: true,
stopOpacity: true,
strokeDashoffset: true,

@@ -83,7 +84,13 @@ strokeOpacity: true,

background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPosition: true,
backgroundRepeat: true,
backgroundColor: true
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {

@@ -121,2 +128,7 @@ borderWidth: true,

fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}

@@ -123,0 +135,0 @@ };

@@ -28,4 +28,12 @@ /**

var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat

@@ -147,3 +155,3 @@ if (document.documentElement.style.cssFloat === undefined) {

} else {
var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {

@@ -150,0 +158,0 @@ // Shorthand property that IE8 won't like unsetting, so unset each

@@ -52,3 +52,3 @@ /**

dangerouslyRenderMarkup: function (markupList) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'React.renderToString for server rendering.') : invariant(false) : undefined;
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;

@@ -131,7 +131,12 @@ var markupByNodeName = {};

dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'React.renderToString for server rendering.') : invariant(false) : undefined;
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
!markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
!(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See React.renderToString().') : invariant(false) : undefined;
!(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
var newChild;
if (typeof markup === 'string') {
newChild = createNodesFromMarkup(markup, emptyFunction)[0];
} else {
newChild = markup;
}
oldChild.parentNode.replaceChild(newChild, oldChild);

@@ -138,0 +143,0 @@ }

@@ -23,2 +23,3 @@ /**

* @param {string} newModule The module that fn will exist in
* @param {string} newPackage The module that fn will exist in
* @param {*} ctx The context this forwarded call should run in

@@ -28,3 +29,3 @@ * @param {function} fn The function to forward on to

*/
function deprecated(fnName, newModule, ctx, fn) {
function deprecated(fnName, newModule, newPackage, ctx, fn) {
var warned = false;

@@ -37,3 +38,3 @@ if (process.env.NODE_ENV !== 'production') {

// Otherwise the build tools will attempt to build a '%s' module.
'`require' + '("react").%s` is deprecated. Please use `require' + '("%s").%s` ' + 'instead.', fnName, newModule, fnName) : undefined;
'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
warned = true;

@@ -40,0 +41,0 @@ return fn.apply(ctx, arguments);

@@ -85,3 +85,9 @@ /**

var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
var renderedMarkup;
// markupList is either a list of markup or just a list of elements
if (markupList.length && typeof markupList[0] === 'string') {
renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
} else {
renderedMarkup = markupList;
}

@@ -88,0 +94,0 @@ // Remove updated children first so that `toIndex` is consistent.

@@ -21,3 +21,3 @@ /**

// Simplified subset
var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][a-zA-Z_\.\-\d]*$/;
var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
var illegalAttributeNameCache = {};

@@ -87,2 +87,6 @@ var validatedAttributeNameCache = {};

setAttributeForID: function (node, id) {
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**

@@ -153,2 +157,4 @@ * Creates markup for a property.

node.setAttributeNS(namespace, attributeName, '' + value);
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
node.setAttribute(attributeName, '');
} else {

@@ -155,0 +161,0 @@ node.setAttribute(attributeName, '' + value);

@@ -79,9 +79,20 @@ /**

var from, to;
var from;
var to;
var fromID = '';
var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) || win;
fromID = topLevelTargetID;
to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
if (to) {
toID = ReactMount.getID(to);
} else {
to = win;
}
to = to || win;
} else {
from = win;
to = topLevelTarget;
toID = topLevelTargetID;
}

@@ -94,5 +105,2 @@

var fromID = from ? ReactMount.getID(from) : '';
var toID = to ? ReactMount.getID(to) : '';
var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);

@@ -99,0 +107,0 @@ leave.type = 'mouseleave';

@@ -74,4 +74,4 @@ /**

topStalled: null,
topSubmit: null,
topSuspend: null,
topSubmit: null,
topTextInput: null,

@@ -78,0 +78,0 @@ topTimeUpdate: null,

@@ -16,2 +16,3 @@ /**

var EventPluginUtils = require('./EventPluginUtils');
var ReactErrorUtils = require('./ReactErrorUtils');

@@ -42,9 +43,3 @@ var accumulateInto = require('./accumulateInto');

if (event) {
var executeDispatch = EventPluginUtils.executeDispatch;
// Plugins can provide custom behavior when dispatching events.
var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
if (PluginModule && PluginModule.executeDispatch) {
executeDispatch = PluginModule.executeDispatch;
}
EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
EventPluginUtils.executeDispatchesInOrder(event);

@@ -258,2 +253,4 @@ if (!event.isPersistent()) {

!!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
// This would be a good time to rethrow if any of the event handlers threw.
ReactErrorUtils.rethrowCaughtError();
},

@@ -260,0 +257,0 @@

@@ -15,2 +15,3 @@ /**

var EventConstants = require('./EventConstants');
var ReactErrorUtils = require('./ReactErrorUtils');

@@ -67,7 +68,18 @@ var invariant = require('fbjs/lib/invariant');

/**
* Invokes `cb(event, listener, id)`. Avoids using call if no scope is
* provided. The `(listener,id)` pair effectively forms the "dispatch" but are
* kept separate to conserve memory.
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {function} listener Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function forEachEventDispatch(event, cb) {
function executeDispatch(event, listener, domID) {
var type = event.type || 'unknown-event';
event.currentTarget = injection.Mount.getNode(domID);
ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event) {
var dispatchListeners = event._dispatchListeners;

@@ -84,27 +96,7 @@ var dispatchIDs = event._dispatchIDs;

// Listeners and IDs are two parallel arrays that are always in sync.
cb(event, dispatchListeners[i], dispatchIDs[i]);
executeDispatch(event, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
cb(event, dispatchListeners, dispatchIDs);
executeDispatch(event, dispatchListeners, dispatchIDs);
}
}
/**
* Default implementation of PluginModule.executeDispatch().
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {function} listener Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, listener, domID) {
event.currentTarget = injection.Mount.getNode(domID);
var returnValue = listener(event, domID);
event.currentTarget = null;
return returnValue;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, cb) {
forEachEventDispatch(event, cb);
event._dispatchListeners = null;

@@ -194,3 +186,2 @@ event._dispatchIDs = null;

executeDirectDispatch: executeDirectDispatch,
executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,

@@ -197,0 +188,0 @@ executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,

@@ -55,3 +55,3 @@ /**

* tests). Lazily allocate the array to conserve memory. We must loop through
* each event and perform the traversal for each one. We can not perform a
* each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may

@@ -58,0 +58,0 @@ * have a different target.

@@ -38,2 +38,8 @@ /**

assign(FallbackCompositionState.prototype, {
destructor: function () {
this._root = null;
this._startText = null;
this._fallbackText = null;
},
/**

@@ -40,0 +46,0 @@ * Get current text of input.

@@ -45,3 +45,3 @@ /**

}
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Component (with keys: %s) contains `render` method ' + 'but is not mounted in the DOM', Object.keys(componentOrElement)) : invariant(false) : undefined;
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;

@@ -48,0 +48,0 @@ }

@@ -148,2 +148,3 @@ /**

style: null,
summary: null,
tabIndex: null,

@@ -166,2 +167,4 @@ target: null,

autoCorrect: null,
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
autoSave: null,
// itemProp, itemScope, itemType are for

@@ -179,2 +182,5 @@ // Microdata support. See http://schema.org/docs/gs.html

property: null,
// results show looking glass icon and recent searches on input
// search fields in WebKit/Blink
results: null,
// IE-only attribute that specifies security restrictions on an iframe

@@ -198,2 +204,3 @@ // as an alternative to the sandbox attribute on IE<10

autoPlay: 'autoplay',
autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.

@@ -200,0 +207,0 @@ // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding

@@ -61,6 +61,4 @@ /**

if (node === null || node === false) {
node = ReactEmptyComponent.emptyElement;
}
if (typeof node === 'object') {
instance = new ReactEmptyComponent(instantiateReactComponent);
} else if (typeof node === 'object') {
var element = node;

@@ -74,3 +72,3 @@ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;

// This is temporarily available for custom components that are not string
// represenations. I.e. ART. Once those are updated to use the string
// representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.

@@ -77,0 +75,0 @@ instance = new element.type(element);

@@ -81,5 +81,3 @@ /**

!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
if (instance.destructor) {
instance.destructor();
}
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {

@@ -86,0 +84,0 @@ Klass.instancePool.push(instance);

@@ -19,11 +19,22 @@ /**

var assign = require('./Object.assign');
var deprecated = require('./deprecated');
// `version` will be added here by ReactIsomorphic.
var React = {};
assign(React, ReactIsomorphic);
assign(React, ReactDOM);
assign(React, ReactDOMServer);
React.version = '0.14.0-beta3';
assign(React, {
// ReactDOM
findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
// ReactDOMServer
renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
});
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
module.exports = React;

@@ -30,3 +30,3 @@ /**

getDOMNode: function () {
process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'React.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
this.constructor[didWarnKey] = true;

@@ -33,0 +33,0 @@ return findDOMNode(this);

@@ -126,4 +126,4 @@ /**

topMouseUp: 'mouseup',
topPaste: 'paste',
topPause: 'pause',
topPaste: 'paste',
topPlay: 'play',

@@ -133,5 +133,5 @@ topPlaying: 'playing',

topRateChange: 'ratechange',
topScroll: 'scroll',
topSeeked: 'seeked',
topSeeking: 'seeking',
topSeeked: 'seeked',
topScroll: 'scroll',
topSelectionChange: 'selectionchange',

@@ -138,0 +138,0 @@ topStalled: 'stalled',

@@ -17,3 +17,2 @@ /**

var flattenChildren = require('./flattenChildren');
var instantiateReactComponent = require('./instantiateReactComponent');

@@ -62,3 +61,3 @@ var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');

* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction

@@ -69,3 +68,3 @@ * @param {object} context

*/
updateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators

@@ -76,3 +75,2 @@ // instead of for..in we can zip the iterators and check if an item has

// can quickly bailout if nothing has changed.
var nextChildren = flattenChildren(nextNestedChildrenElements);
if (!nextChildren && !prevChildren) {

@@ -89,3 +87,3 @@ return null;

var nextElement = nextChildren[name];
if (shouldUpdateReactComponent(prevElement, nextElement)) {
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);

@@ -92,0 +90,0 @@ nextChildren[name] = prevChild;

@@ -15,10 +15,15 @@ /**

var PooledClass = require('./PooledClass');
var ReactFragment = require('./ReactFragment');
var ReactElement = require('./ReactElement');
var emptyFunction = require('fbjs/lib/emptyFunction');
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var threeArgumentPooler = PooledClass.threeArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
}
/**

@@ -37,7 +42,14 @@ * PooledClass representing the bookkeeping associated with performing a child

}
ForEachBookKeeping.prototype.destructor = function () {
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(traverseContext, child, name) {
var bookKeeping = traverseContext;
bookKeeping.func.call(bookKeeping.context, child, bookKeeping.count++);
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func;
var context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}

@@ -59,3 +71,2 @@

}
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);

@@ -75,4 +86,5 @@ traverseAllChildren(children, forEachSingleChild, traverseContext);

*/
function MapBookKeeping(mapResult, mapFunction, mapContext) {
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;

@@ -82,17 +94,39 @@ this.context = mapContext;

}
PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
MapBookKeeping.prototype.destructor = function () {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(traverseContext, child, name) {
var bookKeeping = traverseContext;
var mapResult = bookKeeping.result;
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result;
var keyPrefix = bookKeeping.keyPrefix;
var func = bookKeeping.func;
var context = bookKeeping.context;
var keyUnique = mapResult[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'ReactChildren.map(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement.isValidElement(mappedChild)) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
if (keyUnique) {
var mappedChild = bookKeeping.func.call(bookKeeping.context, child, bookKeeping.count++);
mapResult[name] = mappedChild;
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}

@@ -106,5 +140,2 @@

*
* TODO: This may likely break any calls to `ReactChildren.map` that were
* previously relying on the fact that we guarded against null children.
*
* @param {?*} children Children tree container.

@@ -119,8 +150,5 @@ * @param {function(*, int)} func The map function.

}
var mapResult = {};
var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
return ReactFragment.create(mapResult);
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}

@@ -143,8 +171,20 @@

/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
count: countChildren
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray
};
module.exports = ReactChildren;

@@ -16,3 +16,2 @@ /**

var ReactElement = require('./ReactElement');
var ReactErrorUtils = require('./ReactErrorUtils');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');

@@ -62,3 +61,3 @@ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');

warnedSetProps = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call React.render again at the top level.') : undefined;
process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
}

@@ -363,5 +362,6 @@ }

mixStaticSpecIntoComponent(Constructor, statics);
}
};
},
autobind: function () {} };
// noop
function validateTypeDef(Constructor, typeDef, location) {

@@ -435,3 +435,3 @@ for (var propName in typeDef) {

var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined;
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;

@@ -600,3 +600,3 @@ if (shouldAutoBind) {

var method = component.__reactAutoBindMap[autoBindKey];
component[autoBindKey] = bindAutoBindMethod(component, ReactErrorUtils.guard(method, component.constructor.displayName + '.' + autoBindKey));
component[autoBindKey] = bindAutoBindMethod(component, method);
}

@@ -728,2 +728,3 @@ }

Constructor.prototype.constructor = Constructor;
Constructor.isReactClass = {};

@@ -730,0 +731,0 @@ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));

@@ -32,2 +32,4 @@ /**

ReactComponent.isReactClass = {};
/**

@@ -97,7 +99,7 @@ * Sets a subset of the state. Always use this to mutate

var deprecatedAPIs = {
getDOMNode: ['getDOMNode', 'Use React.findDOMNode(component) instead.'],
getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceProps: ['replaceProps', 'Instead, call React.render again at the top level.'],
replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
setProps: ['setProps', 'Instead, call React.render again at the top level.']
setProps: ['setProps', 'Instead, call render again at the top level.']
};

@@ -104,0 +106,0 @@ var defineDeprecationWarning = function (methodName, info) {

@@ -31,2 +31,3 @@ /**

expect(instance).not.toBeNull();
expect(instance).not.toBeUndefined();

@@ -142,2 +143,7 @@ !ReactTestUtils.isCompositeComponent(instance) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'reactComponentExpect(...): instance must be a composite component') : invariant(false) : undefined;

toBeEmptyComponent: function () {
var element = this._instance._currentElement;
return element === null || element === false;
},
toBePresent: function () {

@@ -144,0 +150,0 @@ expect(this.instance()).toBeTruthy();

@@ -41,2 +41,8 @@ /**

function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
return new Component(this.props, this.context, this.updater);
};
/**

@@ -130,8 +136,31 @@ * ------------------ The Life-Cycle of a Composite Component ------------------

// Initialize the public class
var inst = new Component(publicProps, publicContext, ReactUpdateQueue);
var inst;
var renderedElement;
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
} finally {
ReactCurrentOwner.current = null;
}
} else {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
}
if (inst === null || inst === false || ReactElement.isValidElement(inst)) {
renderedElement = inst;
inst = new StatelessComponent(Component);
}
if (process.env.NODE_ENV !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
process.env.NODE_ENV !== 'production' ? warning(inst.render != null, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render` in your ' + 'component or you may have accidentally tried to render an element ' + 'whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
if (inst.render == null) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
} else {
// We support ES6 inheriting from React.Component, the module pattern,
// and stateless components, but not ES6 classes that don't extend
process.env.NODE_ENV !== 'production' ? warning(Component.isReactClass || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
}
}

@@ -183,3 +212,6 @@

var renderedElement = this._renderValidatedComponent();
// If not a stateless component, we now render
if (renderedElement === undefined) {
renderedElement = this._renderValidatedComponent();
}

@@ -211,2 +243,3 @@ this._renderedComponent = this._instantiateReactComponent(renderedElement);

this._renderedComponent = null;
this._instance = null;

@@ -347,3 +380,3 @@ // Reset pending fields

// We may want to extend this logic for similar errors in
// React.render calls, so I'm abstracting it away into
// top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future

@@ -591,2 +624,3 @@ var addendum = getDeclarationErrorAddendum(this);

var inst = this.getPublicInstance();
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;

@@ -622,3 +656,3 @@ refs[ref] = component.getPublicInstance();

* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by React.render. Can be null for stateless
* is exposed by refs and returned by render. Can be null for stateless
* components.

@@ -630,3 +664,7 @@ *

getPublicInstance: function () {
return this._instance;
var inst = this._instance;
if (inst instanceof StatelessComponent) {
return null;
}
return inst;
},

@@ -633,0 +671,0 @@

@@ -19,5 +19,24 @@ /**

var ReactTransitionGroup = React.createFactory(require('./ReactTransitionGroup'));
var ReactCSSTransitionGroupChild = React.createFactory(require('./ReactCSSTransitionGroupChild'));
var ReactTransitionGroup = require('./ReactTransitionGroup');
var ReactCSSTransitionGroupChild = require('./ReactCSSTransitionGroupChild');
function createTransitionTimeoutPropValidator(transitionType) {
var timeoutPropName = 'transition' + transitionType + 'Timeout';
var enabledPropName = 'transition' + transitionType;
return function (props) {
// If the transition is enabled
if (props[enabledPropName]) {
// If no timeout duration is provided
if (!props[timeoutPropName]) {
return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
// If the duration isn't a number
} else if (typeof props[timeoutPropName] !== 'number') {
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
}
}
};
}
var ReactCSSTransitionGroup = React.createClass({

@@ -27,17 +46,10 @@ displayName: 'ReactCSSTransitionGroup',

propTypes: {
transitionName: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
enter: React.PropTypes.string,
leave: React.PropTypes.string,
active: React.PropTypes.string
}), React.PropTypes.shape({
enter: React.PropTypes.string,
enterActive: React.PropTypes.string,
leave: React.PropTypes.string,
leaveActive: React.PropTypes.string,
appear: React.PropTypes.string,
appearActive: React.PropTypes.string
})]).isRequired,
transitionName: ReactCSSTransitionGroupChild.propTypes.name,
transitionAppear: React.PropTypes.bool,
transitionEnter: React.PropTypes.bool,
transitionLeave: React.PropTypes.bool
transitionLeave: React.PropTypes.bool,
transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
},

@@ -57,7 +69,10 @@

// leave while it is leaving.
return ReactCSSTransitionGroupChild({
return React.createElement(ReactCSSTransitionGroupChild, {
name: this.props.transitionName,
appear: this.props.transitionAppear,
enter: this.props.transitionEnter,
leave: this.props.transitionLeave
leave: this.props.transitionLeave,
appearTimeout: this.props.transitionAppearTimeout,
enterTimeout: this.props.transitionEnterTimeout,
leaveTimeout: this.props.transitionLeaveTimeout
}, child);

@@ -67,3 +82,3 @@ },

render: function () {
return ReactTransitionGroup(assign({}, this.props, { childFactory: this._wrapChild }));
return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}

@@ -70,0 +85,0 @@ });

@@ -16,2 +16,3 @@ /**

var React = require('./React');
var ReactDOM = require('./ReactDOM');

@@ -22,3 +23,2 @@ var CSSCore = require('fbjs/lib/CSSCore');

var onlyChild = require('./onlyChild');
var warning = require('fbjs/lib/warning');

@@ -30,18 +30,34 @@ // We don't remove the element from the DOM until we receive an animationend or

var TICK = 17;
var NO_EVENT_TIMEOUT = 5000;
var noEventListener = null;
if (process.env.NODE_ENV !== 'production') {
noEventListener = function () {
process.env.NODE_ENV !== 'production' ? warning(false, 'transition(): tried to perform an animation without ' + 'an animationend or transitionend event after timeout (' + '%sms). You should either disable this ' + 'transition in JS or add a CSS animation/transition.', NO_EVENT_TIMEOUT) : undefined;
};
}
var ReactCSSTransitionGroupChild = React.createClass({
displayName: 'ReactCSSTransitionGroupChild',
transition: function (animationType, finishCallback) {
var node = React.findDOMNode(this);
propTypes: {
name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
enter: React.PropTypes.string,
leave: React.PropTypes.string,
active: React.PropTypes.string
}), React.PropTypes.shape({
enter: React.PropTypes.string,
enterActive: React.PropTypes.string,
leave: React.PropTypes.string,
leaveActive: React.PropTypes.string,
appear: React.PropTypes.string,
appearActive: React.PropTypes.string
})]).isRequired,
// Once we require timeouts to be specified, we can remove the
// boolean flags (appear etc.) and just accept a number
// or a bool for the timeout flags (appearTimeout etc.)
appear: React.PropTypes.bool,
enter: React.PropTypes.bool,
leave: React.PropTypes.bool,
appearTimeout: React.PropTypes.number,
enterTimeout: React.PropTypes.number,
leaveTimeout: React.PropTypes.number
},
transition: function (animationType, finishCallback, userSpecifiedDelay) {
var node = ReactDOM.findDOMNode(this);
if (!node) {

@@ -56,5 +72,4 @@ if (finishCallback) {

var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
var timeout = null;
var noEventTimeout = null;
var endListener = function (e) {

@@ -64,6 +79,5 @@ if (e && e.target !== node) {

}
if (process.env.NODE_ENV !== 'production') {
clearTimeout(noEventTimeout);
}
clearTimeout(timeout);
CSSCore.removeClass(node, className);

@@ -81,4 +95,2 @@ CSSCore.removeClass(node, activeClassName);

ReactTransitionEvents.addEndEventListener(node, endListener);
CSSCore.addClass(node, className);

@@ -89,4 +101,9 @@

if (process.env.NODE_ENV !== 'production') {
noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
// If the user specified a timeout delay.
if (userSpecifiedDelay) {
// Clean-up the animation after the specified delay
timeout = setTimeout(endListener, userSpecifiedDelay);
} else {
// DEPRECATED: this listener will be removed in a future version of react
ReactTransitionEvents.addEndEventListener(node, endListener);
}

@@ -105,3 +122,3 @@ },

if (this.isMounted()) {
this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, React.findDOMNode(this)));
this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
}

@@ -124,3 +141,3 @@ this.classNameQueue.length = 0;

if (this.props.appear) {
this.transition('appear', done);
this.transition('appear', done, this.props.appearTimeout);
} else {

@@ -133,3 +150,3 @@ done();

if (this.props.enter) {
this.transition('enter', done);
this.transition('enter', done, this.props.enterTimeout);
} else {

@@ -142,3 +159,3 @@ done();

if (this.props.leave) {
this.transition('leave', done);
this.transition('leave', done, this.props.leaveTimeout);
} else {

@@ -145,0 +162,0 @@ done();

@@ -25,3 +25,2 @@ /**

var ReactDOMComponent = require('./ReactDOMComponent');
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var ReactDOMTextComponent = require('./ReactDOMTextComponent');

@@ -87,3 +86,2 @@ var ReactEventListener = require('./ReactEventListener');

ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);

@@ -90,0 +88,0 @@ if (process.env.NODE_ENV !== 'production') {

@@ -26,4 +26,2 @@ /**

'updatePropertyByID': 'update attribute',
'deletePropertyByID': 'delete attribute',
'updateStylesByID': 'update styles',
'dangerouslyReplaceNodeWithMarkupByID': 'replace'

@@ -30,0 +28,0 @@ };

@@ -24,2 +24,3 @@ /**

var ReactUpdates = require('./ReactUpdates');
var ReactVersion = require('./ReactVersion');

@@ -38,2 +39,3 @@ var findDOMNode = require('./findDOMNode');

unmountComponentAtNode: ReactMount.unmountComponentAtNode,
version: ReactVersion,

@@ -62,6 +64,6 @@ /* eslint-disable camelcase */

// If we're in Chrome, look for the devtools marker and provide a download
// link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1) {
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// First check if devtools is not installed
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');

@@ -71,3 +73,3 @@ }

// If we're in IE8, check to see if we are in combatibility mode and provide
// If we're in IE8, check to see if we are in compatibility mode and provide
// information on preventing compatibility mode

@@ -74,0 +76,0 @@ var ieCompatibilityMode = document.documentMode && document.documentMode < 8;

@@ -39,2 +39,4 @@ /**

var keyOf = require('fbjs/lib/keyOf');
var setInnerHTML = require('./setInnerHTML');
var setTextContent = require('./setTextContent');
var shallowEqual = require('fbjs/lib/shallowEqual');

@@ -114,3 +116,3 @@ var validateDOMNesting = require('./validateDOMNesting');

if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}

@@ -129,3 +131,3 @@ if (!component) {

if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}

@@ -170,7 +172,2 @@ if (!component) {

/**
* Optionally injectable operations for mutating the DOM
*/
var BackendIDOperations = null;
/**
* @param {object} component

@@ -197,3 +194,3 @@ * @param {?object} props

}
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.') : invariant(false) : undefined;
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}

@@ -442,4 +439,21 @@

var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
var mountImage;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement(this._currentElement.type);
DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
// Populate node cache
ReactMount.getID(el);
this._updateDOMProperties({}, props, transaction, el);
this._createInitialChildren(transaction, props, context, el);
mountImage = el;
} else {
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
if (!tagContent && omittedCloseTags[this._tag]) {
mountImage = tagOpen + '/>';
} else {
mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
}
}

@@ -457,6 +471,3 @@ switch (this._tag) {

if (!tagContent && omittedCloseTags[this._tag]) {
return tagOpen + '/>';
}
return tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
return mountImage;
},

@@ -569,2 +580,24 @@

_createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
setInnerHTML(el, innerHTML.__html);
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, processChildContext(context, this));
for (var i = 0; i < mountImages.length; i++) {
el.appendChild(mountImages[i]);
}
}
}
},
/**

@@ -624,3 +657,3 @@ * Receives a next element and updates the component.

assertValidProps(this, nextProps);
this._updateDOMProperties(lastProps, nextProps, transaction);
this._updateDOMProperties(lastProps, nextProps, transaction, null);
this._updateDOMChildren(lastProps, nextProps, transaction, processChildContext(context, this));

@@ -654,4 +687,5 @@

* @param {ReactReconcileTransaction} transaction
* @param {?DOMElement} node
*/
_updateDOMProperties: function (lastProps, nextProps, transaction) {
_updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;

@@ -681,3 +715,6 @@ var styleName;

} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
BackendIDOperations.deletePropertyByID(this._rootNodeID, propKey);
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}

@@ -727,9 +764,25 @@ }

} else if (isCustomComponent(this._tag, nextProps)) {
BackendIDOperations.updateAttributeByID(this._rootNodeID, propKey, nextProp);
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
BackendIDOperations.updatePropertyByID(this._rootNodeID, propKey, nextProp);
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (nextProp != null) {
DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
} else {
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
}
if (styleUpdates) {
BackendIDOperations.updateStylesByID(this._rootNodeID, styleUpdates);
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}

@@ -868,8 +921,2 @@ },

ReactDOMComponent.injection = {
injectIDOperations: function (IDOperations) {
ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
}
};
module.exports = ReactDOMComponent;

@@ -15,3 +15,2 @@ /**

var CSSPropertyOperations = require('./CSSPropertyOperations');
var DOMChildrenOperations = require('./DOMChildrenOperations');

@@ -36,4 +35,3 @@ var DOMPropertyOperations = require('./DOMPropertyOperations');

/**
* Operations used to process updates to DOM nodes. This is made injectable via
* `ReactDOMComponent.BackendIDOperations`.
* Operations used to process updates to DOM nodes.
*/

@@ -66,55 +64,2 @@ var ReactDOMIDOperations = {

/**
* Updates a DOM node with new property values.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name.
* @param {*} value New value of the property.
* @internal
*/
updateAttributeByID: function (id, name, value) {
var node = ReactMount.getNode(id);
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
DOMPropertyOperations.setValueForAttribute(node, name, value);
},
/**
* Updates a DOM node to remove a property. This should only be used to remove
* DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A property name to remove, see `DOMProperty`.
* @internal
*/
deletePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
DOMPropertyOperations.deleteValueForProperty(node, name, value);
},
/**
* Updates a DOM node with new style values. If a value is specified as '',
* the corresponding style property will be unset.
*
* @param {string} id ID of the node to update.
* @param {object} styles Mapping from styles to values.
* @internal
*/
updateStylesByID: function (id, styles) {
var node = ReactMount.getNode(id);
CSSPropertyOperations.setValueForStyles(node, styles);
},
/**
* Updates a DOM node's text content set by `props.content`.
*
* @param {string} id ID of the node to update.
* @param {string} content Text content.
* @internal
*/
updateTextContentByID: function (id, content) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.updateTextContent(node, content);
},
/**
* Replaces a DOM node that exists in the document with markup.

@@ -149,5 +94,2 @@ *

updatePropertyByID: 'updatePropertyByID',
deletePropertyByID: 'deletePropertyByID',
updateStylesByID: 'updateStylesByID',
updateTextContentByID: 'updateTextContentByID',
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',

@@ -154,0 +96,0 @@ dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'

@@ -130,2 +130,6 @@ /**

}
// This will throw if radio buttons rendered by different copies of React
// and the same name are rendered into the same form (same as #1939).
// That's probably okay; we don't support it just as we don't support
// mixing React with non-React.
var otherID = ReactMount.getID(otherNode);

@@ -132,0 +136,0 @@ !otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;

@@ -24,3 +24,3 @@ /**

function updateOptionsIfPendingUpdateAndMounted() {
if (this._wrapperState.pendingUpdate && this._rootNodeID) {
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
this._wrapperState.pendingUpdate = false;

@@ -27,0 +27,0 @@

@@ -16,2 +16,3 @@ /**

var ReactServerRendering = require('./ReactServerRendering');
var ReactVersion = require('./ReactVersion');

@@ -22,5 +23,6 @@ ReactDefaultInjection.inject();

renderToString: ReactServerRendering.renderToString,
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
version: ReactVersion
};
module.exports = ReactDOMServer;

@@ -15,8 +15,10 @@ /**

var DOMChildrenOperations = require('./DOMChildrenOperations');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactDOMComponent = require('./ReactDOMComponent');
var ReactMount = require('./ReactMount');
var assign = require('./Object.assign');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var setTextContent = require('./setTextContent');
var validateDOMNesting = require('./validateDOMNesting');

@@ -76,12 +78,22 @@

this._rootNodeID = rootID;
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement('span');
DOMPropertyOperations.setAttributeForID(el, rootID);
// Populate node cache
ReactMount.getID(el);
setTextContent(el, this._stringText);
return el;
} else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
}
return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
}
return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
},

@@ -105,3 +117,4 @@

this._stringText = nextStringText;
ReactDOMComponent.BackendIDOperations.updateTextContentByID(this._rootNodeID, nextStringText);
var node = ReactMount.getNode(this._rootNodeID);
DOMChildrenOperations.updateTextContent(node, nextStringText);
}

@@ -108,0 +121,0 @@ }

@@ -18,7 +18,23 @@ /**

// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var TYPE_SYMBOL = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true
ref: true,
__self: true,
__source: true
};
var canDefineProperty = false;
if (process.env.NODE_ENV !== 'production') {
try {
Object.defineProperty({}, 'x', {});
canDefineProperty = true;
} catch (x) {
// IE will fail on defineProperty
}
}
/**

@@ -31,2 +47,9 @@ * Base constructor for all React elements. This is only used to make this

* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner

@@ -36,12 +59,16 @@ * @param {*} props

*/
var ReactElement = function (type, key, ref, owner, props) {
// Built-in properties that belong on the element
this.type = type;
this.key = key;
this.ref = ref;
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: TYPE_SYMBOL,
// Record the component responsible for creating this element.
this._owner = owner;
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
this.props = props;
// Record the component responsible for creating this element.
_owner: owner
};

@@ -53,3 +80,3 @@ if (process.env.NODE_ENV !== 'production') {

// commonly used development environments.
this._store = {};
element._store = {};

@@ -60,4 +87,4 @@ // To make comparing ReactElements easier for testing purposes, we make

// ignores it.
try {
Object.defineProperty(this._store, 'validated', {
if (canDefineProperty) {
Object.defineProperty(element._store, 'validated', {
configurable: false,

@@ -68,14 +95,27 @@ enumerable: false,

});
} catch (x) {
this._store.validated = false;
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
} else {
element._store.validated = false;
element._self = self;
element._source = source;
}
Object.freeze(this.props);
Object.freeze(this);
Object.freeze(element.props);
Object.freeze(element);
}
};
// We intentionally don't expose the function on the constructor property.
// ReactElement should be indistinguishable from a plain object.
ReactElement.prototype = {
_isReactElement: true
return element;
};

@@ -91,2 +131,4 @@

var ref = null;
var self = null;
var source = null;

@@ -96,2 +138,4 @@ if (config != null) {

key = config.key === undefined ? null : '' + config.key;
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object

@@ -128,3 +172,3 @@ for (propName in config) {

return new ReactElement(type, key, ref, ReactCurrentOwner.current, props);
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};

@@ -143,4 +187,10 @@

ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
};
ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
var newElement = new ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._owner, newProps);
var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);

@@ -164,2 +214,8 @@ if (process.env.NODE_ENV !== 'production') {

var ref = element.ref;
// Self is preserved since the owner is preserved.
var self = element._self;
// Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source;

@@ -199,3 +255,3 @@ // Owner will be preserved, unless ref is overridden

return new ReactElement(element.type, key, ref, owner, props);
return ReactElement(element.type, key, ref, self, source, owner, props);
};

@@ -209,15 +265,5 @@

ReactElement.isValidElement = function (object) {
// ReactTestUtils is often used outside of beforeEach where as React is
// within it. This leads to two different instances of React on the same
// page. To identify a element from a different React instance we use
// a flag instead of an instanceof check.
var isElement = !!(object && object._isReactElement);
// if (isElement && !(object instanceof ReactElement)) {
// This is an indicator that you're using multiple versions of React at the
// same time. This will screw with ownership and stuff. Fix it, please.
// TODO: We could possibly warn here.
// }
return isElement;
return typeof object === 'object' && object !== null && object.$$typeof === TYPE_SYMBOL;
};
module.exports = ReactElement;

@@ -22,3 +22,2 @@ /**

var ReactElement = require('./ReactElement');
var ReactFragment = require('./ReactFragment');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');

@@ -51,34 +50,3 @@ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');

var NUMERIC_PROPERTY_REGEX = /^\d+$/;
/**
* Gets the instance's name for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getName(instance) {
var publicInstance = instance && instance.getPublicInstance();
if (!publicInstance) {
return undefined;
}
var constructor = publicInstance.constructor;
if (!constructor) {
return undefined;
}
return constructor.displayName || constructor.name || undefined;
}
/**
* Gets the current owner's displayName for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getCurrentOwnerDisplayName() {
var current = ReactCurrentOwner.current;
return current && getName(current) || undefined;
}
/**
* Warn if the element doesn't have an explicit key assigned to it.

@@ -108,23 +76,2 @@ * This element is in an array. The array could grow and shrink or be

/**
* Warn if the key is being defined as an object property but has an incorrect
* value.
*
* @internal
* @param {string} name Property name of the key.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
*/
function validatePropertyKey(name, element, parentType) {
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
return;
}
var addenda = getAddendaForKeyUse('numericKeys', element, parentType);
if (addenda === null) {
// we already showed the warning
return;
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Child objects should have non-numeric keys so ordering is preserved.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.

@@ -140,14 +87,18 @@ *

function getAddendaForKeyUse(messageType, element, parentType) {
var ownerName = getCurrentOwnerDisplayName();
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
var addendum = getDeclarationErrorAddendum();
if (!addendum) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
addendum = ' Check the top-level render call using <' + parentName + '>.';
}
}
var useName = ownerName || parentName;
var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
if (memoizer[useName]) {
if (memoizer[addendum]) {
return null;
}
memoizer[useName] = true;
memoizer[addendum] = true;
var addenda = {
parentOrOwner: ownerName ? ' Check the render method of ' + ownerName + '.' : parentName ? ' Check the React.render call using <' + parentName + '>.' : null,
parentOrOwner: addendum,
url: ' See https://fb.me/react-warning-keys for more information.',

@@ -162,3 +113,3 @@ childOwner: null

// Give the component that originally created this child.
addenda.childOwner = ' It was passed a child from ' + getName(element._owner) + '.';
addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
}

@@ -179,2 +130,5 @@

function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {

@@ -189,3 +143,5 @@ for (var i = 0; i < node.length; i++) {

// This element was passed in a valid location.
node._store.validated = true;
if (node._store) {
node._store.validated = true;
}
} else if (node) {

@@ -204,9 +160,2 @@ var iteratorFn = getIteratorFn(node);

}
} else if (typeof node === 'object') {
var fragment = ReactFragment.extractIfFragment(node);
for (var key in fragment) {
if (fragment.hasOwnProperty(key)) {
validatePropertyKey(key, fragment[key], parentType);
}
}
}

@@ -213,0 +162,0 @@ }

@@ -15,74 +15,38 @@ /**

var ReactElement = require('./ReactElement');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
var ReactReconciler = require('./ReactReconciler');
var invariant = require('fbjs/lib/invariant');
var assign = require('./Object.assign');
var component;
// This registry keeps track of the React IDs of the components that rendered to
// `null` (in reality a placeholder such as `noscript`)
var nullComponentIDsRegistry = {};
var placeholderElement;
var ReactEmptyComponentInjection = {
injectEmptyComponent: function (emptyComponent) {
component = ReactElement.createFactory(emptyComponent);
injectEmptyComponent: function (component) {
placeholderElement = ReactElement.createElement(component);
}
};
var ReactEmptyComponentType = function () {};
ReactEmptyComponentType.prototype.componentDidMount = function () {
var internalInstance = ReactInstanceMap.get(this);
// TODO: Make sure we run these methods in the correct order, we shouldn't
// need this check. We're going to assume if we're here it means we ran
// componentWillUnmount already so there is no internal instance (it gets
// removed as part of the unmounting process).
if (!internalInstance) {
return;
}
registerNullComponentID(internalInstance._rootNodeID);
var ReactEmptyComponent = function (instantiate) {
this._currentElement = null;
this._rootNodeID = null;
this._renderedComponent = instantiate(placeholderElement);
};
ReactEmptyComponentType.prototype.componentWillUnmount = function () {
var internalInstance = ReactInstanceMap.get(this);
// TODO: Get rid of this check. See TODO in componentDidMount.
if (!internalInstance) {
return;
assign(ReactEmptyComponent.prototype, {
construct: function (element) {},
mountComponent: function (rootID, transaction, context) {
ReactEmptyComponentRegistry.registerNullComponentID(rootID);
this._rootNodeID = rootID;
return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
},
receiveComponent: function () {},
unmountComponent: function (rootID, transaction, context) {
ReactReconciler.unmountComponent(this._renderedComponent);
ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
this._rootNodeID = null;
this._renderedComponent = null;
}
deregisterNullComponentID(internalInstance._rootNodeID);
};
ReactEmptyComponentType.prototype.render = function () {
!component ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to return null from a render, but no null placeholder component ' + 'was injected.') : invariant(false) : undefined;
return component();
};
});
var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
/**
* Mark the component as having rendered to null.
* @param {string} id Component's `_rootNodeID`.
*/
function registerNullComponentID(id) {
nullComponentIDsRegistry[id] = true;
}
/**
* Unmark the component as having rendered to null: it renders to something now.
* @param {string} id Component's `_rootNodeID`.
*/
function deregisterNullComponentID(id) {
delete nullComponentIDsRegistry[id];
}
/**
* @param {string} id Component's `_rootNodeID`.
* @return {boolean} True if the component is rendered to null.
*/
function isNullComponentID(id) {
return !!nullComponentIDsRegistry[id];
}
var ReactEmptyComponent = {
emptyElement: emptyElement,
injection: ReactEmptyComponentInjection,
isNullComponentID: isNullComponentID
};
module.exports = ReactEmptyComponent;

@@ -15,17 +15,53 @@ /**

var caughtError = null;
var ReactErrorUtils = {
/**
* Creates a guarded version of a function. This is supposed to make debugging
* of event handlers easier. To aid debugging with the browser's debugger,
* this currently simply returns the original function.
* Call a function while guarding against errors that happens within it.
*
* @param {function} func Function to be executed
* @param {string} name The name of the guard
* @return {function}
* @param {?String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} a First argument
* @param {*} b Second argument
*/
guard: function (func, name) {
return func;
invokeGuardedCallback: function (name, func, a, b) {
try {
return func(a, b);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
return undefined;
}
},
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
rethrowCaughtError: function () {
if (caughtError) {
var error = caughtError;
caughtError = null;
throw error;
}
}
};
if (process.env.NODE_ENV !== 'production') {
/**
* To help development we can get better devtools integration by simulating a
* real browser event.
*/
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof Event === 'function') {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
var boundFunc = func.bind(null, a, b);
fakeNode.addEventListener(name, boundFunc, false);
fakeNode.dispatchEvent(new Event(name));
fakeNode.removeEventListener(name, boundFunc, false);
};
}
}
module.exports = ReactErrorUtils;

@@ -62,9 +62,14 @@ /**

function handleTopLevelImpl(bookKeeping) {
if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
// New browsers have a path attribute on native events
handleTopLevelWithPath(bookKeeping);
} else {
// Legacy browsers don't have a path attribute on native events
handleTopLevelWithoutPath(bookKeeping);
}
// TODO: Re-enable event.path handling
//
// if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
// // New browsers have a path attribute on native events
// handleTopLevelWithPath(bookKeeping);
// } else {
// // Legacy browsers don't have a path attribute on native events
// handleTopLevelWithoutPath(bookKeeping);
// }
void handleTopLevelWithPath; // temporarily unused
handleTopLevelWithoutPath(bookKeeping);
}

@@ -100,7 +105,9 @@

var currentPathElement = path[i];
var currentPathElementID = ReactMount.getID(currentPathElement);
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
currentNativeTarget = path[i + 1];
}
if (ReactMount.isRenderedByReact(currentPathElement)) {
// TODO: slow
var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
if (reactParent === currentPathElement) {
var currentPathElementID = ReactMount.getID(currentPathElement);
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);

@@ -107,0 +114,0 @@ bookKeeping.ancestors.push(currentPathElement);

@@ -14,4 +14,7 @@ /**

var ReactChildren = require('./ReactChildren');
var ReactElement = require('./ReactElement');
var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');

@@ -24,61 +27,9 @@

* The upgrade path is to call React.addons.createFragment({ key: value }) to
* create a keyed fragment. The resulting data structure is opaque, for now.
* create a keyed fragment. The resulting data structure is an array.
*/
var fragmentKey;
var didWarnKey;
var canWarnForReactFragment;
var numericPropertyRegex = /^\d+$/;
if (process.env.NODE_ENV !== 'production') {
fragmentKey = '_reactFragment';
didWarnKey = '_reactDidWarn';
var warnedAboutNumeric = false;
try {
// Feature test. Don't even try to issue this warning if we can't use
// enumerable: false.
var dummy = function () {
return 1;
};
Object.defineProperty({}, fragmentKey, { enumerable: false, value: true });
Object.defineProperty({}, 'key', { enumerable: true, get: dummy });
canWarnForReactFragment = true;
} catch (x) {
canWarnForReactFragment = false;
}
var proxyPropertyAccessWithWarning = function (obj, key) {
Object.defineProperty(obj, key, {
enumerable: true,
get: function () {
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.') : undefined;
this[didWarnKey] = true;
return this[fragmentKey][key];
},
set: function (value) {
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') : undefined;
this[didWarnKey] = true;
this[fragmentKey][key] = value;
}
});
};
var issuedWarnings = {};
var didWarnForFragment = function (fragment) {
// We use the keys and the type of the value as a heuristic to dedupe the
// warning to avoid spamming too much.
var fragmentCacheKey = '';
for (var key in fragment) {
fragmentCacheKey += key + ':' + typeof fragment[key] + ',';
}
var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
issuedWarnings[fragmentCacheKey] = true;
return alreadyWarnedOnce;
};
}
var ReactFragment = {

@@ -88,68 +39,26 @@ // Wrap a keyed object in an opaque proxy that warns you if you access any

create: function (object) {
if (process.env.NODE_ENV !== 'production') {
if (typeof object !== 'object' || !object || Array.isArray(object)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
return object;
}
if (ReactElement.isValidElement(object)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
return object;
}
if (canWarnForReactFragment) {
var proxy = {};
Object.defineProperty(proxy, fragmentKey, {
enumerable: false,
value: object
});
Object.defineProperty(proxy, didWarnKey, {
writable: true,
enumerable: false,
value: false
});
for (var key in object) {
proxyPropertyAccessWithWarning(proxy, key);
}
Object.preventExtensions(proxy);
return proxy;
}
if (typeof object !== 'object' || !object || Array.isArray(object)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
return object;
}
return object;
},
// Extract the original keyed object from the fragment opaque type. Warn if
// a plain object is passed here.
extract: function (fragment) {
if (process.env.NODE_ENV !== 'production') {
if (canWarnForReactFragment) {
if (!fragment[fragmentKey]) {
process.env.NODE_ENV !== 'production' ? warning(didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.') : undefined;
return fragment;
}
return fragment[fragmentKey];
}
if (ReactElement.isValidElement(object)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
return object;
}
return fragment;
},
// Check if this is a fragment and if so, extract the keyed object. If it
// is a fragment-like object, warn that it should be wrapped. Ignore if we
// can't determine what kind of object this is.
extractIfFragment: function (fragment) {
if (process.env.NODE_ENV !== 'production') {
if (canWarnForReactFragment) {
// If it is the opaque type, return the keyed object.
if (fragment[fragmentKey]) {
return fragment[fragmentKey];
!(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
var result = [];
for (var key in object) {
if (process.env.NODE_ENV !== 'production') {
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
warnedAboutNumeric = true;
}
// Otherwise, check each property if it has an element, if it does
// it is probably meant as a fragment, so we can warn early. Defer,
// the warning to extract.
for (var key in fragment) {
if (fragment.hasOwnProperty(key) && ReactElement.isValidElement(fragment[key])) {
// This looks like a fragment object, we should provide an
// early warning.
return ReactFragment.extract(fragment);
}
}
}
ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
}
return fragment;
return result;
}

@@ -156,0 +65,0 @@ };

@@ -21,3 +21,2 @@ /**

var ReactNativeComponent = require('./ReactNativeComponent');
var ReactDOMComponent = require('./ReactDOMComponent');
var ReactPerf = require('./ReactPerf');

@@ -30,3 +29,2 @@ var ReactRootIndex = require('./ReactRootIndex');

Class: ReactClass.injection,
DOMComponent: ReactDOMComponent.injection,
DOMProperty: DOMProperty.injection,

@@ -33,0 +31,0 @@ EmptyComponent: ReactEmptyComponent.injection,

@@ -21,2 +21,3 @@ /**

var ReactPropTypes = require('./ReactPropTypes');
var ReactVersion = require('./ReactVersion');

@@ -44,2 +45,3 @@ var assign = require('./Object.assign');

count: ReactChildren.count,
toArray: ReactChildren.toArray,
only: onlyChild

@@ -68,2 +70,4 @@ },

version: ReactVersion,
// Hook for JSX spread, don't use this for anything else.

@@ -70,0 +74,0 @@ __spread: assign

@@ -17,4 +17,5 @@ /**

var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactElement = require('./ReactElement');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
var ReactInstanceHandles = require('./ReactInstanceHandles');

@@ -28,2 +29,3 @@ var ReactInstanceMap = require('./ReactInstanceMap');

var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');

@@ -38,4 +40,2 @@ var containsNode = require('fbjs/lib/containsNode');

var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;

@@ -48,2 +48,4 @@ var nodeCache = {};

var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */

@@ -178,3 +180,3 @@ var instancesByReactRootID = {};

var id = ReactInstanceMap.get(instance)._rootNodeID;
if (ReactEmptyComponent.isNullComponentID(id)) {
if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;

@@ -254,2 +256,10 @@ }

function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
if (ReactDOMFeatureFlags.useCreateElement) {
context = assign({}, context);
if (container.nodeType === DOC_NODE_TYPE) {
context[ownerDocumentContextKey] = container;
} else {
context[ownerDocumentContextKey] = container.ownerDocument;
}
}
if (process.env.NODE_ENV !== 'production') {

@@ -264,3 +274,3 @@ if (context === emptyObject) {

componentInstance._renderedComponent._topLevelWrapper = componentInstance;
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}

@@ -277,3 +287,4 @@

function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* forceHTML */shouldReuseMarkup);
transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);

@@ -306,2 +317,54 @@ ReactUpdates.ReactReconcileTransaction.release(transaction);

/**
* True if the supplied DOM node has a direct React-rendered child that is
* not a React root element. Useful for warning in `render`,
* `unmountComponentAtNode`, etc.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM element contains a direct child that was
* rendered by React but is not a root element.
* @internal
*/
function hasNonRootReactChild(node) {
var reactRootID = getReactRootID(node);
return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
}
/**
* Returns the first (deepest) ancestor of a node which is rendered by this copy
* of React.
*/
function findFirstReactDOMImpl(node) {
// This node might be from another React instance, so we make sure not to
// examine the node cache here
for (; node && node.parentNode !== node; node = node.parentNode) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
continue;
}
var nodeID = internalGetID(node);
if (!nodeID) {
continue;
}
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
// If containersByReactRootID contains the container we find by crawling up
// the tree, we know that this instance of React rendered the node.
// nb. isValid's strategy (with containsNode) does not work because render
// trees may be nested and we don't want a false positive in that case.
var current = node;
var lastID;
do {
lastID = internalGetID(current);
current = current.parentNode;
!(current != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findFirstReactDOMImpl(...): Unexpected detached subtree found when ' + 'traversing DOM from node `%s`.', nodeID) : invariant(false) : undefined;
} while (lastID !== reactRootID);
if (current === containersByReactRootID[reactRootID]) {
return node;
}
}
return null;
}
/**
* Temporary (?) hack so that we can store all top-level pending updates on

@@ -312,2 +375,6 @@ * composites instead of having to worry about different types of components

var TopLevelWrapper = function () {};
TopLevelWrapper.isReactClass = {};
if (process.env.NODE_ENV !== 'production') {
TopLevelWrapper.displayName = 'TopLevelWrapper';
}
TopLevelWrapper.prototype.render = function () {

@@ -441,3 +508,3 @@ // this.props is actually a ReactElement

_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
!ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element

@@ -448,3 +515,3 @@ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;

var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, nextElement);
var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);

@@ -464,13 +531,15 @@ var prevComponent = instancesByReactRootID[getReactRootID(container)];

var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup = reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
var containerHasNonRootReactChild = hasNonRootReactChild(container);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (ReactMount.isRenderedByReact(rootElementSibling)) {
if (internalGetID(rootElementSibling)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
rootElementSibling = rootElementSibling.nextSibling;

@@ -481,3 +550,3 @@ }

var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();

@@ -547,2 +616,14 @@ if (callback) {

if (!component) {
// Check if the node being unmounted was rendered by React, but isn't a
// root node.
var containerHasNonRootReactChild = hasNonRootReactChild(container);
// Check if the container itself is a React root node.
var containerID = internalGetID(container);
var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
}
return false;

@@ -605,20 +686,4 @@ }

/**
* True if the supplied `node` is rendered by React.
*
* @param {*} node DOM Element to check.
* @return {boolean} True if the DOM Element appears to be rendered by React.
* @internal
*/
isRenderedByReact: function (node) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
return false;
}
var id = ReactMount.getID(node);
return id ? id.charAt(0) === SEPARATOR : false;
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component.
* DOM representation of a React component rendered by this copy of React.
*

@@ -630,10 +695,3 @@ * @param {*} node

getFirstReactDOM: function (node) {
var current = node;
while (current && current.parentNode !== current) {
if (ReactMount.isRenderedByReact(current)) {
return current;
}
current = current.parentNode;
}
return null;
return findFirstReactDOMImpl(node);
},

@@ -657,2 +715,7 @@

if (process.env.NODE_ENV !== 'production') {
// This will throw on the next line; give an early warning
process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
}
firstChildren[0] = deepestAncestor.firstChild;

@@ -710,3 +773,3 @@ firstChildren.length = 1;

_mountImageIntoNode: function (markup, container, shouldReuseMarkup) {
_mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;

@@ -756,7 +819,16 @@

!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See React.renderToString() for server rendering.') : invariant(false) : undefined;
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
setInnerHTML(container, markup);
if (transaction.useCreateElement) {
while (container.lastChild) {
container.removeChild(container.lastChild);
}
container.appendChild(markup);
} else {
setInnerHTML(container, markup);
}
},
ownerDocumentContextKey: ownerDocumentContextKey,
/**

@@ -776,2 +848,4 @@ * React ID utilities.

isValid: isValid,
purgeID: purgeID

@@ -778,0 +852,0 @@ };

@@ -18,5 +18,8 @@ /**

var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactReconciler = require('./ReactReconciler');
var ReactChildReconciler = require('./ReactChildReconciler');
var flattenChildren = require('./flattenChildren');
/**

@@ -190,2 +193,33 @@ * Updating children of a component may trigger recursive updates. The depth is

_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
} finally {
ReactCurrentOwner.current = null;
}
}
}
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
},
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
var nextChildren;
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
nextChildren = flattenChildren(nextNestedChildrenElements);
} finally {
ReactCurrentOwner.current = null;
}
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
}
}
nextChildren = flattenChildren(nextNestedChildrenElements);
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
},
/**

@@ -200,3 +234,3 @@ * Generates a "mount image" for each of the supplied children. In the case

mountChildren: function (nestedChildren, transaction, context) {
var children = ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;

@@ -211,5 +245,4 @@ var mountImages = [];

var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
child._mountIndex = index++;
mountImages.push(mountImage);
index++;
}

@@ -322,3 +355,3 @@ }

var prevChildren = this._renderedChildren;
var nextChildren = ReactChildReconciler.updateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;

@@ -325,0 +358,0 @@ if (!nextChildren && !prevChildren) {

@@ -67,3 +67,3 @@ /**

addComponentAsRefTo: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);

@@ -82,3 +82,3 @@ },

removeComponentAsRefFrom: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref from a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : invariant(false) : undefined;
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to

@@ -85,0 +85,0 @@ // detach the ref if another component stole it.

@@ -15,3 +15,2 @@ /**

var ReactElement = require('./ReactElement');
var ReactFragment = require('./ReactFragment');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');

@@ -168,3 +167,4 @@

var expectedClassName = expectedClass.name || ANONYMOUS;
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected instance of `' + expectedClassName + '`.'));
var actualClassName = getClassName(props[propName]);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}

@@ -312,8 +312,3 @@ return null;

} else {
propValue = ReactFragment.extractIfFragment(propValue);
for (var k in propValue) {
if (!isNode(propValue[k])) {
return false;
}
}
return false;
}

@@ -356,2 +351,10 @@

// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return '<<anonymous>>';
}
return propValue.constructor.name;
}
module.exports = ReactPropTypes;

@@ -38,3 +38,3 @@ /**

var markup = internalInstance.mountComponent(rootID, transaction, context);
if (internalInstance._currentElement.ref != null) {
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);

@@ -67,18 +67,17 @@ }

var prevElement = internalInstance._currentElement;
if (nextElement === prevElement && nextElement._owner != null
// TODO: Shouldn't we need to do this: `&& context === internalInstance._context`
) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
// TODO: Bailing out early is just a perf optimization right?
// TODO: Removing the return statement should affect correctness?
return;
}
if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
// TODO: Bailing out early is just a perf optimization right?
// TODO: Removing the return statement should affect correctness?
return;
}
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);

@@ -92,3 +91,3 @@

if (refsChanged) {
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);

@@ -95,0 +94,0 @@ }

@@ -18,2 +18,3 @@ /**

var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactInputSelection = require('./ReactInputSelection');

@@ -57,3 +58,3 @@ var Transaction = require('./Transaction');

* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occured. `close`
* `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.

@@ -107,3 +108,3 @@ */

*/
function ReactReconcileTransaction() {
function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();

@@ -117,2 +118,3 @@ // Only server-side rendering really needs this option (see

this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}

@@ -119,0 +121,0 @@

@@ -37,2 +37,5 @@ /**

ReactRef.attachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;

@@ -57,6 +60,16 @@ if (ref != null) {

return nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref;
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
return (
// This has a few false positives w/r/t empty components.
// This has a few false positives w/r/t empty components.
prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
ReactRef.detachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;

@@ -63,0 +76,0 @@ if (ref != null) {

@@ -52,2 +52,3 @@ /**

this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = false;
}

@@ -54,0 +55,0 @@

@@ -18,4 +18,4 @@ /**

var React = require('./React');
var ReactDOM = require('./ReactDOM');
var ReactElement = require('./ReactElement');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');

@@ -76,3 +76,3 @@ var ReactCompositeComponent = require('./ReactCompositeComponent');

// document.documentElement.appendChild(div);
return React.render(instance, div);
return ReactDOM.render(instance, div);
},

@@ -158,3 +158,3 @@

if (ReactTestUtils.isDOMComponent(inst)) {
var instClassName = React.findDOMNode(inst).className;
var instClassName = ReactDOM.findDOMNode(inst).className;
return instClassName && ('' + instClassName).split(/\s+/).indexOf(className) !== -1;

@@ -253,3 +253,3 @@ }

/**
* Simulates a top level event being dispatched from a raw event that occured
* Simulates a top level event being dispatched from a raw event that occurred
* on an `Element` node.

@@ -266,3 +266,3 @@ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`

/**
* Simulates a top level event being dispatched from a raw event that occured
* Simulates a top level event being dispatched from a raw event that occurred
* on the `ReactDOMComponent` `comp`.

@@ -304,3 +304,3 @@ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.

this._renderedOutput = element;
this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
this._currentElement = element;
};

@@ -314,3 +314,3 @@

this._renderedOutput = element;
this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
this._currentElement = element;
},

@@ -332,6 +332,9 @@

ReactShallowRenderer.prototype.render = function (element, context) {
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
!(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
if (!context) {
context = emptyObject;
}
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
this._render(element, transaction, context);

@@ -338,0 +341,0 @@ ReactUpdates.ReactReconcileTransaction.release(transaction);

@@ -15,4 +15,3 @@ /**

var ReactChildren = require('./ReactChildren');
var ReactFragment = require('./ReactFragment');
var flattenChildren = require('./flattenChildren');

@@ -22,3 +21,3 @@ var ReactTransitionChildMapping = {

* Given `this.props.children`, return an object mapping key to child. Just
* simple syntactic sugar around ReactChildren.map().
* simple syntactic sugar around flattenChildren().
*

@@ -32,5 +31,3 @@ * @param {*} children `this.props.children`

}
return ReactFragment.extract(ReactChildren.map(children, function (child) {
return child;
}));
return flattenChildren(children);
},

@@ -37,0 +34,0 @@

@@ -28,6 +28,2 @@ /**

function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
var internalInstance = ReactInstanceMap.get(publicInstance);

@@ -44,2 +40,6 @@ if (!internalInstance) {

if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;

@@ -46,0 +46,0 @@ }

@@ -67,3 +67,3 @@ /**

this.callbackQueue = CallbackQueue.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}

@@ -70,0 +70,0 @@

@@ -32,3 +32,6 @@ /**

var update = require('./update');
var warning = require('fbjs/lib/warning');
var warnedAboutBatchedUpdates = false;
React.addons = {

@@ -40,3 +43,9 @@ CSSTransitionGroup: ReactCSSTransitionGroup,

batchedUpdates: ReactUpdates.batchedUpdates,
batchedUpdates: function () {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
warnedAboutBatchedUpdates = true;
}
return ReactUpdates.batchedUpdates.apply(this, arguments);
},
cloneWithProps: cloneWithProps,

@@ -43,0 +52,0 @@ createFragment: ReactFragment.create,

@@ -72,3 +72,3 @@ /**

* is usually not needed, but should be used to retroactively infer that a
* `touchStart` had occured during momentum scroll. During a momentum scroll,
* `touchStart` had occurred during momentum scroll. During a momentum scroll,
* a touch start will be immediately followed by a scroll event if the view is

@@ -75,0 +75,0 @@ * currently scrolling.

@@ -16,2 +16,3 @@ /**

var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactInputSelection = require('./ReactInputSelection');

@@ -27,2 +28,4 @@ var SyntheticEvent = require('./SyntheticEvent');

var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
var eventTypes = {

@@ -172,3 +175,5 @@ select: {

// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't).
// sometimes when it hasn't). IE's event fires out of order with respect
// to key and input events on deletion, so we discard it.
//
// Firefox doesn't support selectionchange, so check selection status

@@ -178,3 +183,8 @@ // after each key entry. The selection changes after keydown and before

// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
if (skipSelectionChangeEvent) {
break;
}
// falls through
case topLevelTypes.topKeyDown:

@@ -181,0 +191,0 @@ case topLevelTypes.topKeyUp:

@@ -27,11 +27,15 @@ /**

function shouldUpdateReactComponent(prevElement, nextElement) {
if (prevElement != null && nextElement != null) {
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return nextType === 'string' || nextType === 'number';
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
if (prevEmpty || nextEmpty) {
return prevEmpty === nextEmpty;
}
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return nextType === 'string' || nextType === 'number';
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;

@@ -38,0 +42,0 @@ }

@@ -16,3 +16,2 @@ /**

var EventListener = require('fbjs/lib/EventListener');
var EventPluginUtils = require('./EventPluginUtils');
var EventPropagators = require('./EventPropagators');

@@ -34,3 +33,2 @@ var ReactMount = require('./ReactMount');

var keyOf = require('fbjs/lib/keyOf');
var warning = require('fbjs/lib/warning');

@@ -423,4 +421,4 @@ var topLevelTypes = EventConstants.topLevelTypes;

topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topPause: eventTypes.pause,
topPaste: eventTypes.paste,
topPlay: eventTypes.play,

@@ -431,5 +429,5 @@ topPlaying: eventTypes.playing,

topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
topSeeked: eventTypes.seeked,
topSeeking: eventTypes.seeking,
topScroll: eventTypes.scroll,
topStalled: eventTypes.stalled,

@@ -460,21 +458,2 @@ topSubmit: eventTypes.submit,

/**
* Same as the default implementation, except cancels the event when return
* value is false. This behavior will be disabled in a future release.
*
* @param {object} event Event to be dispatched.
* @param {function} listener Application-level callback.
* @param {string} domID DOM ID to pass to the callback.
*/
executeDispatch: function (event, listener, domID) {
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
process.env.NODE_ENV !== 'production' ? warning(typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.') : undefined;
if (returnValue === false) {
event.stopPropagation();
event.preventDefault();
}
},
/**
* @param {string} topLevelType Record from `EventConstants`.

@@ -481,0 +460,0 @@ * @param {DOMEventTarget} topLevelTarget The listening component root node.

@@ -14,6 +14,4 @@ /**

var ReactFragment = require('./ReactFragment');
var ReactChildren = require('./ReactChildren');
var flattenChildren = require('./flattenChildren');
/**

@@ -33,21 +31,6 @@ * Slice children that are typically specified as `props.children`. This version

var slicedChildren = {};
var flattenedMap = flattenChildren(children);
var ii = 0;
for (var key in flattenedMap) {
if (!flattenedMap.hasOwnProperty(key)) {
continue;
}
var child = flattenedMap[key];
if (ii >= start) {
slicedChildren[key] = child;
}
ii++;
if (end != null && ii >= end) {
break;
}
}
return ReactFragment.create(slicedChildren);
var array = ReactChildren.toArray(children);
return array.slice(start, end);
}
module.exports = sliceChildren;

@@ -19,2 +19,3 @@ /**

var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');

@@ -91,2 +92,9 @@ /**

var event = this.nativeEvent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.preventDefault) {

@@ -102,2 +110,9 @@ event.preventDefault();

var event = this.nativeEvent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.stopPropagation) {

@@ -104,0 +119,0 @@ event.stopPropagation();

@@ -225,3 +225,3 @@ /**

/**
* Token to look for to determine if an error occured.
* Token to look for to determine if an error occurred.
*/

@@ -228,0 +228,0 @@ OBSERVED_ERROR: {}

@@ -14,4 +14,4 @@ /**

var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactFragment = require('./ReactFragment');
var ReactInstanceHandles = require('./ReactInstanceHandles');

@@ -109,3 +109,3 @@

var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR;
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;

@@ -146,11 +146,12 @@ if (Array.isArray(children)) {

} else if (type === 'object') {
!(children.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseAllChildren(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
var fragment = ReactFragment.extract(children);
for (var key in fragment) {
if (fragment.hasOwnProperty(key)) {
child = fragment[key];
nextName = nextNamePrefix + wrapUserProvidedKey(key) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
var addendum = '';
if (process.env.NODE_ENV !== 'production') {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
addendum = ' Check the render method of `' + name + '`.';
}
}
}
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found object with keys ' + '{%s}). If you meant to render a collection of children, use an ' + 'array instead or wrap the object using ' + 'React.addons.createFragment(object).%s', Object.keys(children).join(', '), addendum) : invariant(false) : undefined;
}

@@ -157,0 +158,0 @@ }

{
"name": "react",
"description": "React is a JavaScript library for building user interfaces.",
"version": "0.14.0-beta3",
"version": "0.14.0-rc1",
"keywords": [

@@ -25,3 +25,3 @@ "react"

"envify": "^3.0.0",
"fbjs": "0.1.0-alpha.4"
"fbjs": "^0.2.0"
},

@@ -28,0 +28,0 @@ "browserify": {

'use strict';
var React = require('./lib/React');
var assign = require('./lib/Object.assign');
var deprecated = require('./lib/deprecated');
// We want to warn once when any of these methods are used.
if (process.env.NODE_ENV !== 'production') {
var deprecations = {
// ReactDOM
findDOMNode: deprecated(
'findDOMNode',
'react-dom',
React,
React.findDOMNode
),
render: deprecated(
'render',
'react-dom',
React,
React.render
),
unmountComponentAtNode: deprecated(
'unmountComponentAtNode',
'react-dom',
React,
React.unmountComponentAtNode
),
// ReactDOMServer
renderToString: deprecated(
'renderToString',
'react-dom/server',
React,
React.renderToString
),
renderToStaticMarkup: deprecated(
'renderToStaticMarkup',
'react-dom/server',
React,
React.renderToStaticMarkup
),
};
// Export a wrapped object. We'll use assign and take advantage of the fact
// that this will override the original methods in React.
module.exports = assign(
{},
React,
deprecations
);
} else {
module.exports = React;
}
module.exports = require('./lib/React');

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc