diff --git a/jest/environment.js b/jest/environment.js
index a24f9f9ac42f8..a5ca53b7a948f 100644
--- a/jest/environment.js
+++ b/jest/environment.js
@@ -1,3 +1 @@
__DEV__ = true;
-
-require.requireActual('../src/vendor/polyfill/Object.es6.js');
diff --git a/src/addons/transitions/ReactCSSTransitionGroup.js b/src/addons/transitions/ReactCSSTransitionGroup.js
index 6db897c88c0a3..2e4190c729fe2 100644
--- a/src/addons/transitions/ReactCSSTransitionGroup.js
+++ b/src/addons/transitions/ReactCSSTransitionGroup.js
@@ -14,6 +14,8 @@
var React = require('React');
+var assign = require('Object.assign');
+
var ReactTransitionGroup = React.createFactory(
require('ReactTransitionGroup')
);
@@ -54,7 +56,7 @@ var ReactCSSTransitionGroup = React.createClass({
render: function() {
return (
ReactTransitionGroup(
- Object.assign({}, this.props, {childFactory: this._wrapChild})
+ assign({}, this.props, {childFactory: this._wrapChild})
)
);
}
diff --git a/src/addons/transitions/ReactTransitionGroup.js b/src/addons/transitions/ReactTransitionGroup.js
index 3cfec96318f88..ce967cff4c2c1 100644
--- a/src/addons/transitions/ReactTransitionGroup.js
+++ b/src/addons/transitions/ReactTransitionGroup.js
@@ -14,6 +14,7 @@
var React = require('React');
var ReactTransitionChildMapping = require('ReactTransitionChildMapping');
+var assign = require('Object.assign');
var cloneWithProps = require('cloneWithProps');
var emptyFunction = require('emptyFunction');
@@ -151,7 +152,7 @@ var ReactTransitionGroup = React.createClass({
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
- var newChildren = Object.assign({}, this.state.children);
+ var newChildren = assign({}, this.state.children);
delete newChildren[key];
this.setState({children: newChildren});
}
diff --git a/src/addons/update.js b/src/addons/update.js
index dded114ea41fd..34e078b20eb8d 100644
--- a/src/addons/update.js
+++ b/src/addons/update.js
@@ -11,6 +11,7 @@
"use strict";
+var assign = require('Object.assign');
var keyOf = require('keyOf');
var invariant = require('invariant');
@@ -18,7 +19,7 @@ function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
- return Object.assign(new x.constructor(), x);
+ return assign(new x.constructor(), x);
} else {
return x;
}
@@ -98,7 +99,7 @@ function update(value, spec) {
COMMAND_MERGE,
nextValue
);
- Object.assign(nextValue, spec[COMMAND_MERGE]);
+ assign(nextValue, spec[COMMAND_MERGE]);
}
if (spec.hasOwnProperty(COMMAND_PUSH)) {
diff --git a/src/browser/ReactBrowserEventEmitter.js b/src/browser/ReactBrowserEventEmitter.js
index 7b957efca2f6d..f2c4a5dd783ea 100644
--- a/src/browser/ReactBrowserEventEmitter.js
+++ b/src/browser/ReactBrowserEventEmitter.js
@@ -18,6 +18,7 @@ var EventPluginRegistry = require('EventPluginRegistry');
var ReactEventEmitterMixin = require('ReactEventEmitterMixin');
var ViewportMetrics = require('ViewportMetrics');
+var assign = require('Object.assign');
var isEventSupported = require('isEventSupported');
/**
@@ -147,7 +148,7 @@ function getListeningForDocument(mountAt) {
*
* @internal
*/
-var ReactBrowserEventEmitter = Object.assign({}, ReactEventEmitterMixin, {
+var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
/**
* Injectable event backend
diff --git a/src/browser/ReactPutListenerQueue.js b/src/browser/ReactPutListenerQueue.js
index 2c8b2f6085d09..e47b6edcfe461 100644
--- a/src/browser/ReactPutListenerQueue.js
+++ b/src/browser/ReactPutListenerQueue.js
@@ -14,11 +14,13 @@
var PooledClass = require('PooledClass');
var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
+var assign = require('Object.assign');
+
function ReactPutListenerQueue() {
this.listenersToPut = [];
}
-Object.assign(ReactPutListenerQueue.prototype, {
+assign(ReactPutListenerQueue.prototype, {
enqueuePutListener: function(rootNodeID, propKey, propValue) {
this.listenersToPut.push({
rootNodeID: rootNodeID,
diff --git a/src/browser/ReactReconcileTransaction.js b/src/browser/ReactReconcileTransaction.js
index f777e4d12cec3..008890a256554 100644
--- a/src/browser/ReactReconcileTransaction.js
+++ b/src/browser/ReactReconcileTransaction.js
@@ -19,6 +19,8 @@ var ReactInputSelection = require('ReactInputSelection');
var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');
+var assign = require('Object.assign');
+
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
@@ -165,7 +167,7 @@ var Mixin = {
};
-Object.assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
+assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
diff --git a/src/browser/ReactTextComponent.js b/src/browser/ReactTextComponent.js
index 4f0f20ff47d12..f87930f3f7479 100644
--- a/src/browser/ReactTextComponent.js
+++ b/src/browser/ReactTextComponent.js
@@ -16,6 +16,7 @@ var DOMPropertyOperations = require('DOMPropertyOperations');
var ReactComponent = require('ReactComponent');
var ReactElement = require('ReactElement');
+var assign = require('Object.assign');
var escapeTextForBrowser = require('escapeTextForBrowser');
/**
@@ -37,7 +38,7 @@ var ReactTextComponent = function(props) {
// This constructor and it's argument is currently used by mocks.
};
-Object.assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
+assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
/**
* Creates the markup for this text node. This node is not intended to have
diff --git a/src/browser/server/ReactServerRenderingTransaction.js b/src/browser/server/ReactServerRenderingTransaction.js
index 529ebec5e613c..7833b58831c60 100644
--- a/src/browser/server/ReactServerRenderingTransaction.js
+++ b/src/browser/server/ReactServerRenderingTransaction.js
@@ -17,6 +17,7 @@ var CallbackQueue = require('CallbackQueue');
var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');
+var assign = require('Object.assign');
var emptyFunction = require('emptyFunction');
/**
@@ -99,7 +100,7 @@ var Mixin = {
};
-Object.assign(
+assign(
ReactServerRenderingTransaction.prototype,
Transaction.Mixin,
Mixin
diff --git a/src/browser/syntheticEvents/SyntheticEvent.js b/src/browser/syntheticEvents/SyntheticEvent.js
index d603427743417..2d17e6cf9d51b 100644
--- a/src/browser/syntheticEvents/SyntheticEvent.js
+++ b/src/browser/syntheticEvents/SyntheticEvent.js
@@ -14,6 +14,7 @@
var PooledClass = require('PooledClass');
+var assign = require('Object.assign');
var emptyFunction = require('emptyFunction');
var getEventTarget = require('getEventTarget');
@@ -82,7 +83,7 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}
-Object.assign(SyntheticEvent.prototype, {
+assign(SyntheticEvent.prototype, {
preventDefault: function() {
this.defaultPrevented = true;
@@ -140,11 +141,11 @@ SyntheticEvent.augmentClass = function(Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
- Object.assign(prototype, Class.prototype);
+ assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
- Class.Interface = Object.assign({}, Super.Interface, Interface);
+ Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
diff --git a/src/browser/ui/React.js b/src/browser/ui/React.js
index 382cc89f1d5e0..7031035d81160 100644
--- a/src/browser/ui/React.js
+++ b/src/browser/ui/React.js
@@ -11,10 +11,6 @@
"use strict";
-// TODO: Move this elsewhere - it only exists in open source until a better
-// solution is found.
-require('Object.es6');
-
var DOMPropertyOperations = require('DOMPropertyOperations');
var EventPluginUtils = require('EventPluginUtils');
var ReactChildren = require('ReactChildren');
@@ -36,6 +32,7 @@ var ReactPropTypes = require('ReactPropTypes');
var ReactServerRendering = require('ReactServerRendering');
var ReactTextComponent = require('ReactTextComponent');
+var assign = require('Object.assign');
var deprecated = require('deprecated');
var onlyChild = require('onlyChild');
@@ -84,6 +81,9 @@ var React = {
isValidElement: ReactElement.isValidElement,
withContext: ReactContext.withContext,
+ // Hook for JSX spread, don't use this for anything else.
+ __spread: assign,
+
// Deprecations (remove for 0.13)
renderComponent: deprecated(
'React',
diff --git a/src/browser/ui/ReactDOMComponent.js b/src/browser/ui/ReactDOMComponent.js
index ba47058f3a39a..62fe8f0be97c9 100644
--- a/src/browser/ui/ReactDOMComponent.js
+++ b/src/browser/ui/ReactDOMComponent.js
@@ -22,6 +22,7 @@ var ReactMount = require('ReactMount');
var ReactMultiChild = require('ReactMultiChild');
var ReactPerf = require('ReactPerf');
+var assign = require('Object.assign');
var escapeTextForBrowser = require('escapeTextForBrowser');
var invariant = require('invariant');
var isEventSupported = require('isEventSupported');
@@ -213,7 +214,7 @@ ReactDOMComponent.Mixin = {
} else {
if (propKey === STYLE) {
if (propValue) {
- propValue = props.style = Object.assign({}, props.style);
+ propValue = props.style = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
@@ -362,7 +363,7 @@ ReactDOMComponent.Mixin = {
}
if (propKey === STYLE) {
if (nextProp) {
- nextProp = nextProps.style = Object.assign({}, nextProp);
+ nextProp = nextProps.style = assign({}, nextProp);
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
@@ -471,7 +472,7 @@ ReactDOMComponent.Mixin = {
};
-Object.assign(
+assign(
ReactDOMComponent.prototype,
ReactComponent.Mixin,
ReactDOMComponent.Mixin,
diff --git a/src/browser/ui/ReactEventListener.js b/src/browser/ui/ReactEventListener.js
index 9ea621d7d2623..e51fcd9c62f14 100644
--- a/src/browser/ui/ReactEventListener.js
+++ b/src/browser/ui/ReactEventListener.js
@@ -19,6 +19,7 @@ var ReactInstanceHandles = require('ReactInstanceHandles');
var ReactMount = require('ReactMount');
var ReactUpdates = require('ReactUpdates');
+var assign = require('Object.assign');
var getEventTarget = require('getEventTarget');
var getUnboundedScrollPosition = require('getUnboundedScrollPosition');
@@ -46,7 +47,7 @@ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
-Object.assign(TopLevelCallbackBookKeeping.prototype, {
+assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function() {
this.topLevelType = null;
this.nativeEvent = null;
diff --git a/src/browser/ui/__tests__/ReactDOMComponent-test.js b/src/browser/ui/__tests__/ReactDOMComponent-test.js
index 92c4b1f3732f3..2d54865dc3b78 100644
--- a/src/browser/ui/__tests__/ReactDOMComponent-test.js
+++ b/src/browser/ui/__tests__/ReactDOMComponent-test.js
@@ -13,6 +13,7 @@
"use strict";
+var assign = require('Object.assign');
var mocks = require('mocks');
describe('ReactDOMComponent', function() {
@@ -223,7 +224,7 @@ describe('ReactDOMComponent', function() {
this.props = initialProps || {};
this._rootNodeID = 'test';
};
- Object.assign(NodeStub.prototype, ReactDOMComponent.Mixin);
+ assign(NodeStub.prototype, ReactDOMComponent.Mixin);
genMarkup = function(props) {
var transaction = new ReactReconcileTransaction();
@@ -273,7 +274,7 @@ describe('ReactDOMComponent', function() {
this.props = initialProps || {};
this._rootNodeID = 'test';
};
- Object.assign(NodeStub.prototype, ReactDOMComponent.Mixin);
+ assign(NodeStub.prototype, ReactDOMComponent.Mixin);
genMarkup = function(props) {
var transaction = new ReactReconcileTransaction();
@@ -310,9 +311,9 @@ describe('ReactDOMComponent', function() {
var StubNativeComponent = function(element) {
ReactComponent.Mixin.construct.call(this, element);
};
- Object.assign(StubNativeComponent.prototype, ReactComponent.Mixin);
- Object.assign(StubNativeComponent.prototype, ReactDOMComponent.Mixin);
- Object.assign(StubNativeComponent.prototype, ReactMultiChild.Mixin);
+ assign(StubNativeComponent.prototype, ReactComponent.Mixin);
+ assign(StubNativeComponent.prototype, ReactDOMComponent.Mixin);
+ assign(StubNativeComponent.prototype, ReactMultiChild.Mixin);
mountComponent = function(props) {
var transaction = new ReactReconcileTransaction();
diff --git a/src/browser/ui/dom/components/ReactDOMInput.js b/src/browser/ui/dom/components/ReactDOMInput.js
index 670e5de8af318..54ad741d98ebd 100644
--- a/src/browser/ui/dom/components/ReactDOMInput.js
+++ b/src/browser/ui/dom/components/ReactDOMInput.js
@@ -21,6 +21,7 @@ var ReactDOM = require('ReactDOM');
var ReactMount = require('ReactMount');
var ReactUpdates = require('ReactUpdates');
+var assign = require('Object.assign');
var invariant = require('invariant');
// Store a reference to the `ReactDOMComponent`. TODO: use string
@@ -66,7 +67,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
render: function() {
// Clone `this.props` so we don't mutate the input.
- var props = Object.assign({}, this.props);
+ var props = assign({}, this.props);
props.defaultChecked = null;
props.defaultValue = null;
diff --git a/src/browser/ui/dom/components/ReactDOMSelect.js b/src/browser/ui/dom/components/ReactDOMSelect.js
index 1b663b82841d2..5aba6d6f473e6 100644
--- a/src/browser/ui/dom/components/ReactDOMSelect.js
+++ b/src/browser/ui/dom/components/ReactDOMSelect.js
@@ -19,6 +19,8 @@ var ReactElement = require('ReactElement');
var ReactDOM = require('ReactDOM');
var ReactUpdates = require('ReactUpdates');
+var assign = require('Object.assign');
+
// Store a reference to the