Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/addons/transitions/ReactCSSTransitionGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ var ReactCSSTransitionGroupChild = React.createFactory(
require('ReactCSSTransitionGroupChild')
);

var merge = require('merge');

var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',

Expand Down Expand Up @@ -63,7 +61,7 @@ var ReactCSSTransitionGroup = React.createClass({
render: function() {
return (
ReactTransitionGroup(
merge(this.props, {childFactory: this._wrapChild})
Object.assign({}, this.props, {childFactory: this._wrapChild})
)
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/addons/transitions/ReactTransitionGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var ReactTransitionChildMapping = require('ReactTransitionChildMapping');

var cloneWithProps = require('cloneWithProps');
var emptyFunction = require('emptyFunction');
var merge = require('merge');

var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
Expand Down Expand Up @@ -159,7 +158,7 @@ var ReactTransitionGroup = React.createClass({
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
var newChildren = merge(this.state.children);
var newChildren = Object.assign({}, this.state.children);
delete newChildren[key];
this.setState({children: newChildren});
}
Expand Down
5 changes: 2 additions & 3 deletions src/addons/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

"use strict";

var copyProperties = require('copyProperties');
var keyOf = require('keyOf');
var invariant = require('invariant');

function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
return copyProperties(new x.constructor(), x);
return Object.assign(new x.constructor(), x);
} else {
return x;
}
Expand Down Expand Up @@ -106,7 +105,7 @@ function update(value, spec) {
COMMAND_MERGE,
nextValue
);
copyProperties(nextValue, spec[COMMAND_MERGE]);
Object.assign(nextValue, spec[COMMAND_MERGE]);
}

if (spec.hasOwnProperty(COMMAND_PUSH)) {
Expand Down
3 changes: 1 addition & 2 deletions src/browser/ReactBrowserEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var ReactEventEmitterMixin = require('ReactEventEmitterMixin');
var ViewportMetrics = require('ViewportMetrics');

var isEventSupported = require('isEventSupported');
var merge = require('merge');

/**
* Summary of `ReactBrowserEventEmitter` event handling:
Expand Down Expand Up @@ -155,7 +154,7 @@ function getListeningForDocument(mountAt) {
*
* @internal
*/
var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, {
var ReactBrowserEventEmitter = Object.assign({}, ReactEventEmitterMixin, {

/**
* Injectable event backend
Expand Down
4 changes: 1 addition & 3 deletions src/browser/ReactPutListenerQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@
var PooledClass = require('PooledClass');
var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');

var mixInto = require('mixInto');

function ReactPutListenerQueue() {
this.listenersToPut = [];
}

mixInto(ReactPutListenerQueue, {
Object.assign(ReactPutListenerQueue.prototype, {
enqueuePutListener: function(rootNodeID, propKey, propValue) {
this.listenersToPut.push({
rootNodeID: rootNodeID,
Expand Down
5 changes: 1 addition & 4 deletions src/browser/ReactReconcileTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ var ReactInputSelection = require('ReactInputSelection');
var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');

var mixInto = require('mixInto');

/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
Expand Down Expand Up @@ -174,8 +172,7 @@ var Mixin = {
};


mixInto(ReactReconcileTransaction, Transaction.Mixin);
mixInto(ReactReconcileTransaction, Mixin);
Object.assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);

PooledClass.addPoolingTo(ReactReconcileTransaction);

Expand Down
4 changes: 1 addition & 3 deletions src/browser/ReactTextComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var ReactComponent = require('ReactComponent');
var ReactElement = require('ReactElement');

var escapeTextForBrowser = require('escapeTextForBrowser');
var mixInto = require('mixInto');

/**
* Text nodes violate a couple assumptions that React makes about components:
Expand All @@ -46,8 +45,7 @@ var ReactTextComponent = function(props) {
// This constructor and it's argument is currently used by mocks.
};

mixInto(ReactTextComponent, ReactComponent.Mixin);
mixInto(ReactTextComponent, {
Object.assign(ReactTextComponent.prototype, ReactComponent.Mixin, {

/**
* Creates the markup for this text node. This node is not intended to have
Expand Down
8 changes: 5 additions & 3 deletions src/browser/server/ReactServerRenderingTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');

var emptyFunction = require('emptyFunction');
var mixInto = require('mixInto');

/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
Expand Down Expand Up @@ -107,8 +106,11 @@ var Mixin = {
};


mixInto(ReactServerRenderingTransaction, Transaction.Mixin);
mixInto(ReactServerRenderingTransaction, Mixin);
Object.assign(
ReactServerRenderingTransaction.prototype,
Transaction.Mixin,
Mixin
);

PooledClass.addPoolingTo(ReactServerRenderingTransaction);

Expand Down
8 changes: 3 additions & 5 deletions src/browser/syntheticEvents/SyntheticEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ var PooledClass = require('PooledClass');

var emptyFunction = require('emptyFunction');
var getEventTarget = require('getEventTarget');
var merge = require('merge');
var mergeInto = require('mergeInto');

/**
* @interface Event
Expand Down Expand Up @@ -91,7 +89,7 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}

mergeInto(SyntheticEvent.prototype, {
Object.assign(SyntheticEvent.prototype, {

preventDefault: function() {
this.defaultPrevented = true;
Expand Down Expand Up @@ -149,11 +147,11 @@ SyntheticEvent.augmentClass = function(Class, Interface) {
var Super = this;

var prototype = Object.create(Super.prototype);
mergeInto(prototype, Class.prototype);
Object.assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = merge(Super.Interface, Interface);
Class.Interface = Object.assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
Expand Down
17 changes: 9 additions & 8 deletions src/browser/ui/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ var escapeTextForBrowser = require('escapeTextForBrowser');
var invariant = require('invariant');
var isEventSupported = require('isEventSupported');
var keyOf = require('keyOf');
var merge = require('merge');
var mixInto = require('mixInto');
var monitorCodeUse = require('monitorCodeUse');

var deleteListener = ReactBrowserEventEmitter.deleteListener;
Expand Down Expand Up @@ -207,7 +205,7 @@ ReactDOMComponent.Mixin = {
} else {
if (propKey === STYLE) {
if (propValue) {
propValue = props.style = merge(props.style);
propValue = props.style = Object.assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
Expand Down Expand Up @@ -356,7 +354,7 @@ ReactDOMComponent.Mixin = {
}
if (propKey === STYLE) {
if (nextProp) {
nextProp = nextProps.style = merge(nextProp);
nextProp = nextProps.style = Object.assign({}, nextProp);
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
Expand Down Expand Up @@ -465,9 +463,12 @@ ReactDOMComponent.Mixin = {

};

mixInto(ReactDOMComponent, ReactComponent.Mixin);
mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
mixInto(ReactDOMComponent, ReactMultiChild.Mixin);
mixInto(ReactDOMComponent, ReactBrowserComponentMixin);
Object.assign(
ReactDOMComponent.prototype,
ReactComponent.Mixin,
ReactDOMComponent.Mixin,
ReactMultiChild.Mixin,
ReactBrowserComponentMixin
);

module.exports = ReactDOMComponent;
3 changes: 1 addition & 2 deletions src/browser/ui/ReactEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var ReactUpdates = require('ReactUpdates');

var getEventTarget = require('getEventTarget');
var getUnboundedScrollPosition = require('getUnboundedScrollPosition');
var mixInto = require('mixInto');

/**
* Finds the parent React component of `node`.
Expand All @@ -54,7 +53,7 @@ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
mixInto(TopLevelCallbackBookKeeping, {
Object.assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function() {
this.topLevelType = null;
this.nativeEvent = null;
Expand Down
13 changes: 5 additions & 8 deletions src/browser/ui/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,14 @@ describe('ReactDOMComponent', function() {
var ReactDefaultInjection = require('ReactDefaultInjection');
ReactDefaultInjection.inject();

var mixInto = require('mixInto');
var ReactDOMComponent = require('ReactDOMComponent');
var ReactReconcileTransaction = require('ReactReconcileTransaction');

var NodeStub = function(initialProps) {
this.props = initialProps || {};
this._rootNodeID = 'test';
};
mixInto(NodeStub, ReactDOMComponent.Mixin);
Object.assign(NodeStub.prototype, ReactDOMComponent.Mixin);

genMarkup = function(props) {
var transaction = new ReactReconcileTransaction();
Expand Down Expand Up @@ -275,15 +274,14 @@ describe('ReactDOMComponent', function() {
beforeEach(function() {
require('mock-modules').dumpCache();

var mixInto = require('mixInto');
var ReactDOMComponent = require('ReactDOMComponent');
var ReactReconcileTransaction = require('ReactReconcileTransaction');

var NodeStub = function(initialProps) {
this.props = initialProps || {};
this._rootNodeID = 'test';
};
mixInto(NodeStub, ReactDOMComponent.Mixin);
Object.assign(NodeStub.prototype, ReactDOMComponent.Mixin);

genMarkup = function(props) {
var transaction = new ReactReconcileTransaction();
Expand Down Expand Up @@ -312,7 +310,6 @@ describe('ReactDOMComponent', function() {
beforeEach(function() {
require('mock-modules').dumpCache();

var mixInto = require('mixInto');
var ReactComponent = require('ReactComponent');
var ReactMultiChild = require('ReactMultiChild');
var ReactDOMComponent = require('ReactDOMComponent');
Expand All @@ -321,9 +318,9 @@ describe('ReactDOMComponent', function() {
var StubNativeComponent = function(element) {
ReactComponent.Mixin.construct.call(this, element);
};
mixInto(StubNativeComponent, ReactComponent.Mixin);
mixInto(StubNativeComponent, ReactDOMComponent.Mixin);
mixInto(StubNativeComponent, ReactMultiChild.Mixin);
Object.assign(StubNativeComponent.prototype, ReactComponent.Mixin);
Object.assign(StubNativeComponent.prototype, ReactDOMComponent.Mixin);
Object.assign(StubNativeComponent.prototype, ReactMultiChild.Mixin);

mountComponent = function(props) {
var transaction = new ReactReconcileTransaction();
Expand Down
3 changes: 1 addition & 2 deletions src/browser/ui/dom/components/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ var ReactMount = require('ReactMount');
var ReactUpdates = require('ReactUpdates');

var invariant = require('invariant');
var merge = require('merge');

// Store a reference to the <input> `ReactDOMComponent`. TODO: use string
var input = ReactElement.createFactory(ReactDOM.input.type);
Expand Down Expand Up @@ -74,7 +73,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({

render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
var props = Object.assign({}, this.props);

props.defaultChecked = null;
props.defaultValue = null;
Expand Down
4 changes: 1 addition & 3 deletions src/browser/ui/dom/components/ReactDOMSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ var ReactElement = require('ReactElement');
var ReactDOM = require('ReactDOM');
var ReactUpdates = require('ReactUpdates');

var merge = require('merge');

// Store a reference to the <select> `ReactDOMComponent`. TODO: use string
var select = ReactElement.createFactory(ReactDOM.select.type);

Expand Down Expand Up @@ -138,7 +136,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({

render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
var props = Object.assign({}, this.props);

props.onChange = this._handleChange;
props.value = null;
Expand Down
3 changes: 1 addition & 2 deletions src/browser/ui/dom/components/ReactDOMTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var ReactDOM = require('ReactDOM');
var ReactUpdates = require('ReactUpdates');

var invariant = require('invariant');
var merge = require('merge');

var warning = require('warning');

Expand Down Expand Up @@ -103,7 +102,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({

render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
var props = Object.assign({}, this.props);

invariant(
props.dangerouslySetInnerHTML == null,
Expand Down
5 changes: 2 additions & 3 deletions src/core/ReactComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var ReactUpdates = require('ReactUpdates');

var invariant = require('invariant');
var keyMirror = require('keyMirror');
var merge = require('merge');

/**
* Every React component is in one of these life cycles.
Expand Down Expand Up @@ -151,7 +150,7 @@ var ReactComponent = {
// element props.
var element = this._pendingElement || this._currentElement;
this.replaceProps(
merge(element.props, partialProps),
Object.assign({}, element.props, partialProps),
callback
);
},
Expand Down Expand Up @@ -200,7 +199,7 @@ var ReactComponent = {
var element = this._pendingElement || this._currentElement;
this._pendingElement = ReactElement.cloneAndReplaceProps(
element,
merge(element.props, partialProps)
Object.assign({}, element.props, partialProps)
);
ReactUpdates.enqueueUpdate(this, callback);
},
Expand Down
Loading