@@ -1,5 +1,5 @@
-/**
- * React (with addons) v0.13.3
+ /**
+ * React (with addons) v0.14.9
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
@@ -22,18 +22,20 @@
'use strict';
-var LinkedStateMixin = _dereq_(25);
-var React = _dereq_(31);
-var ReactComponentWithPureRenderMixin =
- _dereq_(42);
-var ReactCSSTransitionGroup = _dereq_(34);
-var ReactFragment = _dereq_(69);
-var ReactTransitionGroup = _dereq_(98);
-var ReactUpdates = _dereq_(100);
-
-var cx = _dereq_(127);
-var cloneWithProps = _dereq_(122);
-var update = _dereq_(170);
+var LinkedStateMixin = _dereq_(22);
+var React = _dereq_(26);
+var ReactComponentWithPureRenderMixin = _dereq_(37);
+var ReactCSSTransitionGroup = _dereq_(29);
+var ReactFragment = _dereq_(64);
+var ReactTransitionGroup = _dereq_(94);
+var ReactUpdates = _dereq_(96);
+
+var cloneWithProps = _dereq_(118);
+var shallowCompare = _dereq_(140);
+var update = _dereq_(143);
+var warning = _dereq_(173);
+
+var warnedAboutBatchedUpdates = false;
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
@@ -41,21 +43,26 @@
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
- batchedUpdates: ReactUpdates.batchedUpdates,
- classSet: cx,
+ batchedUpdates: function () {
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
+ warnedAboutBatchedUpdates = true;
+ }
+ return ReactUpdates.batchedUpdates.apply(this, arguments);
+ },
cloneWithProps: cloneWithProps,
createFragment: ReactFragment.create,
+ shallowCompare: shallowCompare,
update: update
};
-if ("production" !== "development") {
- React.addons.Perf = _dereq_(61);
- React.addons.TestUtils = _dereq_(95);
+if ("development" !== 'production') {
+ React.addons.Perf = _dereq_(55);
+ React.addons.TestUtils = _dereq_(91);
}
module.exports = React;
-
-},{"100":100,"122":122,"127":127,"170":170,"25":25,"31":31,"34":34,"42":42,"61":61,"69":69,"95":95,"98":98}],2:[function(_dereq_,module,exports){
+},{"118":118,"140":140,"143":143,"173":173,"22":22,"26":26,"29":29,"37":37,"55":55,"64":64,"91":91,"94":94,"96":96}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -64,25 +71,35 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule AutoFocusMixin
+ * @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
-var focusNode = _dereq_(134);
+var ReactMount = _dereq_(72);
-var AutoFocusMixin = {
- componentDidMount: function() {
+var findDOMNode = _dereq_(122);
+var focusNode = _dereq_(155);
+
+var Mixin = {
+ componentDidMount: function () {
if (this.props.autoFocus) {
- focusNode(this.getDOMNode());
+ focusNode(findDOMNode(this));
}
}
};
-module.exports = AutoFocusMixin;
+var AutoFocusUtils = {
+ Mixin: Mixin,
-},{"134":134}],3:[function(_dereq_,module,exports){
+ focusDOMComponent: function () {
+ focusNode(ReactMount.getNode(this._rootNodeID));
+ }
+};
+
+module.exports = AutoFocusUtils;
+},{"122":122,"155":155,"72":72}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
@@ -97,22 +114,19 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var ExecutionEnvironment = _dereq_(22);
-var FallbackCompositionState = _dereq_(23);
-var SyntheticCompositionEvent = _dereq_(106);
-var SyntheticInputEvent = _dereq_(110);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var FallbackCompositionState = _dereq_(20);
+var SyntheticCompositionEvent = _dereq_(103);
+var SyntheticInputEvent = _dereq_(107);
-var keyOf = _dereq_(157);
+var keyOf = _dereq_(166);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
-var canUseCompositionEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'CompositionEvent' in window
-);
+var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
@@ -122,22 +136,12 @@
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
-var canUseTextInputEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'TextEvent' in window &&
- !documentMode &&
- !isPresto()
-);
+var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
-var useFallbackCompositionData = (
- ExecutionEnvironment.canUseDOM &&
- (
- (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
- )
-);
+var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
@@ -145,11 +149,7 @@
*/
function isPresto() {
var opera = window.opera;
- return (
- typeof opera === 'object' &&
- typeof opera.version === 'function' &&
- parseInt(opera.version(), 10) <= 12
- );
+ return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
@@ -161,57 +161,31 @@
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
- bubbled: keyOf({onBeforeInput: null}),
- captured: keyOf({onBeforeInputCapture: null})
+ bubbled: keyOf({ onBeforeInput: null }),
+ captured: keyOf({ onBeforeInputCapture: null })
},
- dependencies: [
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyPress,
- topLevelTypes.topTextInput,
- topLevelTypes.topPaste
- ]
+ dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionEnd: null}),
- captured: keyOf({onCompositionEndCapture: null})
+ bubbled: keyOf({ onCompositionEnd: null }),
+ captured: keyOf({ onCompositionEndCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionStart: null}),
- captured: keyOf({onCompositionStartCapture: null})
+ bubbled: keyOf({ onCompositionStart: null }),
+ captured: keyOf({ onCompositionStartCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionStart,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionUpdate: null}),
- captured: keyOf({onCompositionUpdateCapture: null})
+ bubbled: keyOf({ onCompositionUpdate: null }),
+ captured: keyOf({ onCompositionUpdateCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionUpdate,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
@@ -224,14 +198,11 @@
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
- return (
- (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
+ return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey)
- );
+ !(nativeEvent.ctrlKey && nativeEvent.altKey);
}
-
/**
* Translate native top level events into event types.
*
@@ -258,10 +229,7 @@
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return (
- topLevelType === topLevelTypes.topKeyDown &&
- nativeEvent.keyCode === START_KEYCODE
- );
+ return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
@@ -275,11 +243,11 @@
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
- return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
+ return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
- return (nativeEvent.keyCode !== START_KEYCODE);
+ return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
@@ -317,12 +285,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
-function extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
@@ -352,11 +315,7 @@
}
}
- var event = SyntheticCompositionEvent.getPooled(
- eventType,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
@@ -436,10 +395,7 @@
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
- if (
- topLevelType === topLevelTypes.topCompositionEnd ||
- isFallbackCompositionEnd(topLevelType, nativeEvent)
- ) {
+ if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
@@ -491,12 +447,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
-function extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
@@ -511,11 +462,7 @@
return null;
}
- var event = SyntheticInputEvent.getPooled(
- eventTypes.beforeInput,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -552,142 +499,13 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ) {
- return [
- extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ),
- extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- )
- ];
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
-
-},{"106":106,"110":110,"157":157,"16":16,"21":21,"22":22,"23":23}],4:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSCore
- * @typechecks
- */
-
-var invariant = _dereq_(150);
-
-/**
- * The CSSCore module specifies the API (and implements most of the methods)
- * that should be used when dealing with the display of elements (via their
- * CSS classes and visibility on screen. It is an API focused on mutating the
- * display and not reading it as no logical state should be encoded in the
- * display of elements.
- */
-
-var CSSCore = {
-
- /**
- * Adds the class passed in to the element if it doesn't already have it.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- addClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSSCore.addClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.add(className);
- } else if (!CSSCore.hasClass(element, className)) {
- element.className = element.className + ' ' + className;
- }
- }
- return element;
- },
-
- /**
- * Removes the class passed in from the element
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- removeClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSSCore.removeClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.remove(className);
- } else if (CSSCore.hasClass(element, className)) {
- element.className = element.className
- .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
- .replace(/\s+/g, ' ') // multiple spaces to one
- .replace(/^\s*|\s*$/g, ''); // trim the ends
- }
- }
- return element;
- },
-
- /**
- * Helper to add or remove a class from an element based on a condition.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @param {*} bool condition to whether to add or remove the class
- * @return {DOMElement} the element passed in
- */
- conditionClass: function(element, className, bool) {
- return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
- },
-
- /**
- * Tests whether the element has the class specified.
- *
- * @param {DOMNode|DOMWindow} element the element to set the class on
- * @param {string} className the CSS className
- * @return {boolean} true if the element has the class, false if not
- */
- hasClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSS.hasClass takes only a single class name.'
- ) : invariant(!/\s/.test(className)));
- if (element.classList) {
- return !!className && element.classList.contains(className);
- }
- return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
- }
-
-};
-
-module.exports = CSSCore;
-
-},{"150":150}],5:[function(_dereq_,module,exports){
+},{"103":103,"107":107,"147":147,"15":15,"166":166,"19":19,"20":20}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -705,26 +523,31 @@
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
+ animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
+ boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
+ flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
+ tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
+ stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
@@ -748,8 +571,8 @@
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function(prop) {
- prefixes.forEach(function(prefix) {
+Object.keys(isUnitlessNumber).forEach(function (prop) {
+ prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
@@ -765,10 +588,16 @@
*/
var shorthandPropertyExpansions = {
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: {
borderWidth: true,
@@ -802,6 +631,11 @@
fontSize: true,
lineHeight: true,
fontFamily: true
+ },
+ outline: {
+ outlineWidth: true,
+ outlineStyle: true,
+ outlineColor: true
}
};
@@ -811,8 +645,7 @@
};
module.exports = CSSProperty;
-
-},{}],6:[function(_dereq_,module,exports){
+},{}],5:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -827,28 +660,37 @@
'use strict';
-var CSSProperty = _dereq_(5);
-var ExecutionEnvironment = _dereq_(22);
+var CSSProperty = _dereq_(4);
+var ExecutionEnvironment = _dereq_(147);
+var ReactPerf = _dereq_(78);
+
+var camelizeStyleName = _dereq_(149);
+var dangerousStyleValue = _dereq_(119);
+var hyphenateStyleName = _dereq_(160);
+var memoizeStringOnly = _dereq_(168);
+var warning = _dereq_(173);
-var camelizeStyleName = _dereq_(121);
-var dangerousStyleValue = _dereq_(128);
-var hyphenateStyleName = _dereq_(148);
-var memoizeStringOnly = _dereq_(159);
-var warning = _dereq_(171);
-
-var processStyleName = memoizeStringOnly(function(styleName) {
+var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
+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
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
@@ -858,54 +700,38 @@
var warnedStyleNames = {};
var warnedStyleValues = {};
- var warnHyphenatedStyleName = function(name) {
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported style property %s. Did you mean %s?',
- name,
- camelizeStyleName(name)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
- var warnBadVendoredStyleName = function(name) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
- name,
- name.charAt(0).toUpperCase() + name.slice(1)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
- var warnStyleValueWithSemicolon = function(name, value) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- ("production" !== "development" ? warning(
- false,
- 'Style property values shouldn\'t contain a semicolon. ' +
- 'Try "%s: %s" instead.',
- name,
- value.replace(badStyleValueWithSemicolonPattern, '')
- ) : null);
+ "development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
- var warnValidStyle = function(name, value) {
+ var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
@@ -933,14 +759,14 @@
* @param {object} styles
* @return {?string}
*/
- createMarkupForStyles: function(styles) {
+ createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
@@ -958,13 +784,13 @@
* @param {DOMElement} node
* @param {object} styles
*/
- setValueForStyles: function(node, styles) {
+ setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
@@ -974,7 +800,7 @@
if (styleValue) {
style[styleName] = styleValue;
} else {
- var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
+ var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
@@ -990,9 +816,12 @@
};
-module.exports = CSSPropertyOperations;
+ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
+ setValueForStyles: 'setValueForStyles'
+});
-},{"121":121,"128":128,"148":148,"159":159,"171":171,"22":22,"5":5}],7:[function(_dereq_,module,exports){
+module.exports = CSSPropertyOperations;
+},{"119":119,"147":147,"149":149,"160":160,"168":168,"173":173,"4":4,"78":78}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1006,10 +835,10 @@
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
/**
* A specialized pseudo-event module to help keep track of components waiting to
@@ -1036,7 +865,7 @@
* @param {?object} context Context to call `callback` with.
* @internal
*/
- enqueue: function(callback, context) {
+ enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
@@ -1049,17 +878,14 @@
*
* @internal
*/
- notifyAll: function() {
+ notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
- ("production" !== "development" ? invariant(
- callbacks.length === contexts.length,
- 'Mismatched list of contexts in callback queue'
- ) : invariant(callbacks.length === contexts.length));
+ !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
- for (var i = 0, l = callbacks.length; i < l; i++) {
+ for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
@@ -1072,7 +898,7 @@
*
* @internal
*/
- reset: function() {
+ reset: function () {
this._callbacks = null;
this._contexts = null;
},
@@ -1080,7 +906,7 @@
/**
* `PooledClass` looks for this.
*/
- destructor: function() {
+ destructor: function () {
this.reset();
}
@@ -1089,8 +915,7 @@
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
-
-},{"150":150,"29":29,"30":30}],8:[function(_dereq_,module,exports){
+},{"161":161,"24":24,"25":25}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1104,35 +929,27 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPropagators = _dereq_(21);
-var ExecutionEnvironment = _dereq_(22);
-var ReactUpdates = _dereq_(100);
-var SyntheticEvent = _dereq_(108);
-
-var isEventSupported = _dereq_(151);
-var isTextInputElement = _dereq_(153);
-var keyOf = _dereq_(157);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var ReactUpdates = _dereq_(96);
+var SyntheticEvent = _dereq_(105);
+
+var getEventTarget = _dereq_(128);
+var isEventSupported = _dereq_(133);
+var isTextInputElement = _dereq_(134);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
- bubbled: keyOf({onChange: null}),
- captured: keyOf({onChangeCapture: null})
+ bubbled: keyOf({ onChange: null }),
+ captured: keyOf({ onChangeCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topChange,
- topLevelTypes.topClick,
- topLevelTypes.topFocus,
- topLevelTypes.topInput,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
@@ -1148,26 +965,18 @@
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
- return (
- elem.nodeName === 'SELECT' ||
- (elem.nodeName === 'INPUT' && elem.type === 'file')
- );
+ var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (
- (!('documentMode' in document) || document.documentMode > 8)
- );
+ doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- activeElementID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
@@ -1186,7 +995,7 @@
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
@@ -1204,18 +1013,12 @@
activeElementID = null;
}
-function getTargetIDForChangeEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
-function handleEventsForChangeEventIE8(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
@@ -1234,9 +1036,7 @@
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (
- (!('documentMode' in document) || document.documentMode > 9)
- );
+ isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
@@ -1244,10 +1044,10 @@
* set on the active element.
*/
var newValueProp = {
- get: function() {
+ get: function () {
return activeElementValueProp.get.call(this);
},
- set: function(val) {
+ set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
@@ -1263,11 +1063,10 @@
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(
- target.constructor.prototype,
- 'value'
- );
+ activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
+ // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
+ // on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
@@ -1311,10 +1110,7 @@
/**
* If a `change` event should be fired, returns the target's ID.
*/
-function getTargetIDForInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
@@ -1323,10 +1119,7 @@
}
// For IE8 and IE9.
-function handleEventsForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
@@ -1349,13 +1142,8 @@
}
// For IE8 and IE9.
-function getTargetIDForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange ||
- topLevelType === topLevelTypes.topKeyUp ||
- topLevelType === topLevelTypes.topKeyDown) {
+function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+ if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
@@ -1381,16 +1168,10 @@
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
- return (
- elem.nodeName === 'INPUT' &&
- (elem.type === 'checkbox' || elem.type === 'radio')
- );
+ return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
-function getTargetIDForClickEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
@@ -1418,11 +1199,7 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
@@ -1443,36 +1220,24 @@
}
if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- targetID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
+ event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
- handleEventFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
-
-},{"100":100,"108":108,"151":151,"153":153,"157":157,"16":16,"18":18,"21":21,"22":22}],9:[function(_dereq_,module,exports){
+},{"105":105,"128":128,"133":133,"134":134,"147":147,"15":15,"16":16,"166":166,"19":19,"96":96}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1490,14 +1255,13 @@
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
-
-},{}],10:[function(_dereq_,module,exports){
+},{}],9:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1512,11 +1276,13 @@
'use strict';
-var Danger = _dereq_(13);
-var ReactMultiChildUpdateTypes = _dereq_(79);
-
-var setTextContent = _dereq_(165);
-var invariant = _dereq_(150);
+var Danger = _dereq_(12);
+var ReactMultiChildUpdateTypes = _dereq_(74);
+var ReactPerf = _dereq_(78);
+
+var setInnerHTML = _dereq_(138);
+var setTextContent = _dereq_(139);
+var invariant = _dereq_(161);
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -1531,10 +1297,12 @@
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
- parentNode.insertBefore(
- childNode,
- parentNode.childNodes[index] || null
- );
+
+ // fix render order error in safari
+ // IE8 will throw error when index out of list size.
+ var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+
+ parentNode.insertBefore(childNode, beforeChild);
}
/**
@@ -1554,7 +1322,7 @@
* @param {array<string>} markupList List of markup strings.
* @internal
*/
- processUpdates: function(updates, markupList) {
+ processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
@@ -1563,23 +1331,12 @@
for (var i = 0; i < updates.length; i++) {
update = updates[i];
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
- update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
+ if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
- ("production" !== "development" ? invariant(
- updatedChild,
- 'processUpdates(): Unable to find child %s of element. This ' +
- 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
- 'browser), usually due to forgetting a <tbody> when using tables, ' +
- 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
- 'in an <svg> parent. Try inspecting the child nodes of the element ' +
- 'with React ID `%s`.',
- updatedIndex,
- parentID
- ) : invariant(updatedChild));
+ !updatedChild ? "development" !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
@@ -1590,7 +1347,13 @@
}
}
- 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;
+ }
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
@@ -1603,24 +1366,16 @@
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
- insertChildAt(
- update.parentNode,
- renderedMarkup[update.markupIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
- insertChildAt(
- update.parentNode,
- initialChildren[update.parentID][update.fromIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
+ break;
+ case ReactMultiChildUpdateTypes.SET_MARKUP:
+ setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
- setTextContent(
- update.parentNode,
- update.textContent
- );
+ setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
@@ -1631,9 +1386,12 @@
};
-module.exports = DOMChildrenOperations;
+ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
+ updateTextContent: 'updateTextContent'
+});
-},{"13":13,"150":150,"165":165,"79":79}],11:[function(_dereq_,module,exports){
+module.exports = DOMChildrenOperations;
+},{"12":12,"138":138,"139":139,"161":161,"74":74,"78":78}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1646,11 +1404,9 @@
* @typechecks static-only
*/
-/*jslint bitwise: true */
-
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
@@ -1686,6 +1442,9 @@
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
+ * DOMAttributeNamespaces: object mapping React attribute name to the DOM
+ * attribute namespace URL. (Attribute names not specified use no namespace.)
+ *
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
@@ -1694,92 +1453,68 @@
*
* @param {object} domPropertyConfig the config as described above.
*/
- injectDOMPropertyConfig: function(domPropertyConfig) {
+ injectDOMPropertyConfig: function (domPropertyConfig) {
+ var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
+ var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
- DOMProperty._isCustomAttributeFunctions.push(
- domPropertyConfig.isCustomAttribute
- );
+ DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
- ("production" !== "development" ? invariant(
- !DOMProperty.isStandardName.hasOwnProperty(propName),
- 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
- '\'%s\' which has already been injected. You may be accidentally ' +
- 'injecting the same DOM property config twice, or you may be ' +
- 'injecting two configs that have conflicting property names.',
- propName
- ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
-
- DOMProperty.isStandardName[propName] = true;
+ !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
+ var propConfig = Properties[propName];
+
+ var propertyInfo = {
+ attributeName: lowerCased,
+ attributeNamespace: null,
+ propertyName: propName,
+ mutationMethod: null,
+
+ mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
+ mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
+ hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
+ hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
+ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
+ hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
+ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
+ };
+
+ !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
+ }
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
+ propertyInfo.attributeName = attributeName;
+ if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
- DOMProperty.getAttributeName[propName] = attributeName;
- } else {
- DOMProperty.getAttributeName[propName] = lowerCased;
+ }
}
- DOMProperty.getPropertyName[propName] =
- DOMPropertyNames.hasOwnProperty(propName) ?
- DOMPropertyNames[propName] :
- propName;
+ if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
+ propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+ }
+
+ if (DOMPropertyNames.hasOwnProperty(propName)) {
+ propertyInfo.propertyName = DOMPropertyNames[propName];
+ }
if (DOMMutationMethods.hasOwnProperty(propName)) {
- DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
- } else {
- DOMProperty.getMutationMethod[propName] = null;
+ propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
- var propConfig = Properties[propName];
- DOMProperty.mustUseAttribute[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
- DOMProperty.mustUseProperty[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
- DOMProperty.hasSideEffects[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
- DOMProperty.hasBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
- DOMProperty.hasNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
- DOMProperty.hasPositiveNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
- DOMProperty.hasOverloadedBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
-
- ("production" !== "development" ? invariant(
- !DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName],
- 'DOMProperty: Cannot require using both attribute and property: %s',
- propName
- ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName]));
- ("production" !== "development" ? invariant(
- DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName],
- 'DOMProperty: Properties that have side effects must use property: %s',
- propName
- ) : invariant(DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName]));
- ("production" !== "development" ? invariant(
- !!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
- 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
- 'numeric value, but not a combination: %s',
- propName
- ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
+ DOMProperty.properties[propName] = propertyInfo;
}
}
};
@@ -1803,87 +1538,49 @@
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
- * Checks whether a property name is a standard property.
- * @type {Object}
- */
- isStandardName: {},
-
- /**
- * Mapping from lowercase property names to the properly cased version, used
- * to warn in the case of missing properties.
- * @type {Object}
- */
- getPossibleStandardName: {},
-
- /**
- * Mapping from normalized names to attribute names that differ. Attribute
- * names are used when rendering markup or with `*Attribute()`.
- * @type {Object}
- */
- getAttributeName: {},
-
- /**
- * Mapping from normalized names to properties on DOM node instances.
- * (This includes properties that mutate due to external factors.)
- * @type {Object}
- */
- getPropertyName: {},
-
- /**
- * Mapping from normalized names to mutation methods. This will only exist if
- * mutation cannot be set simply by the property or `setAttribute()`.
- * @type {Object}
- */
- getMutationMethod: {},
-
- /**
- * Whether the property must be accessed and mutated as an object property.
- * @type {Object}
- */
- mustUseAttribute: {},
-
- /**
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
- * @type {Object}
- */
- mustUseProperty: {},
-
- /**
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
- * resources to be loaded or text selection changes. We must ensure that
- * the value is only set if it has changed.
- * @type {Object}
- */
- hasSideEffects: {},
-
- /**
+ * resources to be loaded or text selection changes. If true, we read from
+ * the DOM before updating to ensure that the value is only set if it has
+ * changed.
+ * hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
- * @type {Object}
- */
- hasBooleanValue: {},
-
- /**
- * Whether the property must be numeric or parse as a
- * numeric and should be removed when set to a falsey value.
- * @type {Object}
- */
- hasNumericValue: {},
-
- /**
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
- * @type {Object}
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
*/
- hasPositiveNumericValue: {},
+ properties: {},
/**
- * Whether the property can be used as a flag as well as with a value. Removed
- * when strictly equal to false; present without a value when strictly equal
- * to true; present with a value otherwise.
+ * Mapping from lowercase property names to the properly cased version, used
+ * to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
- hasOverloadedBooleanValue: {},
+ getPossibleStandardName: "development" !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
@@ -1894,7 +1591,7 @@
* Checks whether a property name is a custom attribute.
* @method
*/
- isCustomAttribute: function(attributeName) {
+ isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
@@ -1912,7 +1609,7 @@
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
- getDefaultValueForProperty: function(nodeName, prop) {
+ getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
@@ -1929,8 +1626,7 @@
};
module.exports = DOMProperty;
-
-},{"150":150}],12:[function(_dereq_,module,exports){
+},{"161":161}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1945,20 +1641,38 @@
'use strict';
-var DOMProperty = _dereq_(11);
+var DOMProperty = _dereq_(10);
+var ReactPerf = _dereq_(78);
+
+var quoteAttributeValueForBrowser = _dereq_(136);
+var warning = _dereq_(173);
-var quoteAttributeValueForBrowser = _dereq_(163);
-var warning = _dereq_(171);
+// Simplified subset
+var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+
+function isAttributeNameSafe(attributeName) {
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
+ return true;
+ }
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
+ return false;
+}
-function shouldIgnoreValue(name, value) {
- return value == null ||
- (DOMProperty.hasBooleanValue[name] && !value) ||
- (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
- (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
+function shouldIgnoreValue(propertyInfo, value) {
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
@@ -1967,9 +1681,8 @@
};
var warnedProperties = {};
- var warnUnknownProperty = function(name) {
- if (reactProps.hasOwnProperty(name) && reactProps[name] ||
- warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
+ var warnUnknownProperty = function (name) {
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
@@ -1977,23 +1690,11 @@
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
- var standardName = (
- DOMProperty.isCustomAttribute(lowerCasedName) ?
- lowerCasedName :
- DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
- DOMProperty.getPossibleStandardName[lowerCasedName] :
- null
- );
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
- ("production" !== "development" ? warning(
- standardName == null,
- 'Unknown DOM property %s. Did you mean %s?',
- name,
- standardName
- ) : null);
-
+ "development" !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
@@ -2008,9 +1709,12 @@
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
- createMarkupForID: function(id) {
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
- quoteAttributeValueForBrowser(id);
+ createMarkupForID: function (id) {
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
+ },
+
+ setAttributeForID: function (node, id) {
+ node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
@@ -2020,16 +1724,15 @@
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
- createMarkupForProperty: function(name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- if (shouldIgnoreValue(name, value)) {
+ createMarkupForProperty: function (name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
- var attributeName = DOMProperty.getAttributeName[name];
- if (DOMProperty.hasBooleanValue[name] ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
- return attributeName;
+ var attributeName = propertyInfo.attributeName;
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
@@ -2037,51 +1740,79 @@
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
+ * Creates markup for a custom property.
+ *
+ * @param {string} name
+ * @param {*} value
+ * @return {string} Markup string, or empty string if the property was invalid.
+ */
+ createMarkupForCustomAttribute: function (name, value) {
+ if (!isAttributeNameSafe(name) || value == null) {
+ return '';
+ }
+ return name + '=' + quoteAttributeValueForBrowser(value);
+ },
+
+ /**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
- setValueForProperty: function(node, name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ setValueForProperty: function (node, name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
- } else if (shouldIgnoreValue(name, value)) {
+ } else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
- } else if (DOMProperty.mustUseAttribute[name]) {
+ } else if (propertyInfo.mustUseAttribute) {
+ var attributeName = propertyInfo.attributeName;
+ var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
- node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
+ if (namespace) {
+ node.setAttributeNS(namespace, attributeName, '' + value);
+ } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ node.setAttribute(attributeName, '');
} else {
- var propName = DOMProperty.getPropertyName[name];
+ node.setAttribute(attributeName, '' + value);
+ }
+ } else {
+ var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== ('' + value)) {
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
+ DOMPropertyOperations.setValueForAttribute(node, name, value);
+ } else if ("development" !== 'production') {
+ warnUnknownProperty(name);
+ }
+ },
+
+ setValueForAttribute: function (node, name, value) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
- } else if ("production" !== "development") {
- warnUnknownProperty(name);
- }
},
/**
@@ -2090,37 +1821,38 @@
* @param {DOMElement} node
* @param {string} name
*/
- deleteValueForProperty: function(node, name) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ deleteValueForProperty: function (node, name) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
- } else if (DOMProperty.mustUseAttribute[name]) {
- node.removeAttribute(DOMProperty.getAttributeName[name]);
+ } else if (propertyInfo.mustUseAttribute) {
+ node.removeAttribute(propertyInfo.attributeName);
} else {
- var propName = DOMProperty.getPropertyName[name];
- var defaultValue = DOMProperty.getDefaultValueForProperty(
- node.nodeName,
- propName
- );
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== defaultValue) {
+ var propName = propertyInfo.propertyName;
+ var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
}
};
-module.exports = DOMPropertyOperations;
+ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
+ setValueForProperty: 'setValueForProperty',
+ setValueForAttribute: 'setValueForAttribute',
+ deleteValueForProperty: 'deleteValueForProperty'
+});
-},{"11":11,"163":163,"171":171}],13:[function(_dereq_,module,exports){
+module.exports = DOMPropertyOperations;
+},{"10":10,"136":136,"173":173,"78":78}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2133,16 +1865,14 @@
* @typechecks static-only
*/
-/*jslint evil: true, sub: true */
-
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
-var createNodesFromMarkup = _dereq_(126);
-var emptyFunction = _dereq_(129);
-var getMarkupWrap = _dereq_(142);
-var invariant = _dereq_(150);
+var createNodesFromMarkup = _dereq_(152);
+var emptyFunction = _dereq_(153);
+var getMarkupWrap = _dereq_(157);
+var invariant = _dereq_(161);
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -2173,22 +1903,13 @@
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
- dangerouslyRenderMarkup: function(markupList) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- '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(ExecutionEnvironment.canUseDOM));
+ dangerouslyRenderMarkup: function (markupList) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== '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;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
- ("production" !== "development" ? invariant(
- markupList[i],
- 'dangerouslyRenderMarkup(...): Missing markup.'
- ) : invariant(markupList[i]));
+ !markupList[i] ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -2213,61 +1934,41 @@
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
- markupListByNodeName[resultIndex] = markup.replace(
- OPEN_TAG_NAME_EXP,
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
- );
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
- var renderNodes = createNodesFromMarkup(
- markupListByNodeName.join(''),
- emptyFunction // Do nothing special with <script> tags.
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
- if (renderNode.hasAttribute &&
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
- ("production" !== "development" ? invariant(
- !resultList.hasOwnProperty(resultIndex),
- 'Danger: Assigning to an already-occupied result index.'
- ) : invariant(!resultList.hasOwnProperty(resultIndex)));
+ !!resultList.hasOwnProperty(resultIndex) ? "development" !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
-
- } else if ("production" !== "development") {
- console.error(
- 'Danger: Discarding unexpected node:',
- renderNode
- );
+ } else if ("development" !== 'production') {
+ console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
- ("production" !== "development" ? invariant(
- resultListAssignmentCount === resultList.length,
- 'Danger: Did not assign to every index of resultList.'
- ) : invariant(resultListAssignmentCount === resultList.length));
-
- ("production" !== "development" ? invariant(
- resultList.length === markupList.length,
- 'Danger: Expected markup to render %s nodes, but rendered %s.',
- markupList.length,
- resultList.length
- ) : invariant(resultList.length === markupList.length));
+ !(resultListAssignmentCount === resultList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
+
+ !(resultList.length === markupList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
@@ -2280,32 +1981,24 @@
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
- dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- '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(ExecutionEnvironment.canUseDOM));
- ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
- ("production" !== "development" ? invariant(
- oldChild.tagName.toLowerCase() !== 'html',
- '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(oldChild.tagName.toLowerCase() !== 'html'));
-
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== '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 ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
+ !(oldChild.tagName.toLowerCase() !== 'html') ? "development" !== '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;
+ if (typeof markup === 'string') {
+ newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ } else {
+ newChild = markup;
+ }
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
-
-},{"126":126,"129":129,"142":142,"150":150,"22":22}],14:[function(_dereq_,module,exports){
+},{"147":147,"152":152,"153":153,"157":157,"161":161}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2319,7 +2012,7 @@
'use strict';
-var keyOf = _dereq_(157);
+var keyOf = _dereq_(166);
/**
* Module that is injectable into `EventPluginHub`, that specifies a
@@ -2330,21 +2023,10 @@
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
-var DefaultEventPluginOrder = [
- keyOf({ResponderEventPlugin: null}),
- keyOf({SimpleEventPlugin: null}),
- keyOf({TapEventPlugin: null}),
- keyOf({EnterLeaveEventPlugin: null}),
- keyOf({ChangeEventPlugin: null}),
- keyOf({SelectEventPlugin: null}),
- keyOf({BeforeInputEventPlugin: null}),
- keyOf({AnalyticsEventPlugin: null}),
- keyOf({MobileSafariClickEventPlugin: null})
-];
+var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
-
-},{"157":157}],15:[function(_dereq_,module,exports){
+},{"166":166}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2359,30 +2041,24 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var SyntheticMouseEvent = _dereq_(112);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var SyntheticMouseEvent = _dereq_(109);
-var ReactMount = _dereq_(77);
-var keyOf = _dereq_(157);
+var ReactMount = _dereq_(72);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
- registrationName: keyOf({onMouseEnter: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseEnter: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
- registrationName: keyOf({onMouseLeave: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseLeave: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
@@ -2406,17 +2082,11 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topMouseOver &&
- (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
- if (topLevelType !== topLevelTypes.topMouseOut &&
- topLevelType !== topLevelTypes.topMouseOver) {
+ if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
@@ -2435,15 +2105,24 @@
}
}
- 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;
}
if (from === to) {
@@ -2451,23 +2130,12 @@
return null;
}
- var fromID = from ? ReactMount.getID(from) : '';
- var toID = to ? ReactMount.getID(to) : '';
-
- var leave = SyntheticMouseEvent.getPooled(
- eventTypes.mouseLeave,
- fromID,
- nativeEvent
- );
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
- var enter = SyntheticMouseEvent.getPooled(
- eventTypes.mouseEnter,
- toID,
- nativeEvent
- );
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
@@ -2483,8 +2151,7 @@
};
module.exports = EnterLeaveEventPlugin;
-
-},{"112":112,"157":157,"16":16,"21":21,"77":77}],16:[function(_dereq_,module,exports){
+},{"109":109,"15":15,"166":166,"19":19,"72":72}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2498,15 +2165,18 @@
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
-var PropagationPhases = keyMirror({bubbled: null, captured: null});
+var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
+ topAbort: null,
topBlur: null,
+ topCanPlay: null,
+ topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
@@ -2524,6 +2194,10 @@
topDragOver: null,
topDragStart: null,
topDrop: null,
+ topDurationChange: null,
+ topEmptied: null,
+ topEncrypted: null,
+ topEnded: null,
topError: null,
topFocus: null,
topInput: null,
@@ -2531,21 +2205,36 @@
topKeyPress: null,
topKeyUp: null,
topLoad: null,
+ topLoadedData: null,
+ topLoadedMetadata: null,
+ topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
+ topPause: null,
+ topPlay: null,
+ topPlaying: null,
+ topProgress: null,
+ topRateChange: null,
topReset: null,
topScroll: null,
+ topSeeked: null,
+ topSeeking: null,
topSelectionChange: null,
+ topStalled: null,
topSubmit: null,
+ topSuspend: null,
topTextInput: null,
+ topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
+ topVolumeChange: null,
+ topWaiting: null,
topWheel: null
});
@@ -2555,96 +2244,7 @@
};
module.exports = EventConstants;
-
-},{"156":156}],17:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @providesModule EventListener
- * @typechecks
- */
-
-var emptyFunction = _dereq_(129);
-
-/**
- * Upstream version of event listener. Does not take into account specific
- * nature of platform.
- */
-var EventListener = {
- /**
- * Listen to DOM events during the bubble phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- listen: function(target, eventType, callback) {
- if (target.addEventListener) {
- target.addEventListener(eventType, callback, false);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, false);
- }
- };
- } else if (target.attachEvent) {
- target.attachEvent('on' + eventType, callback);
- return {
- remove: function() {
- target.detachEvent('on' + eventType, callback);
- }
- };
- }
- },
-
- /**
- * Listen to DOM events during the capture phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- capture: function(target, eventType, callback) {
- if (!target.addEventListener) {
- if ("production" !== "development") {
- console.error(
- 'Attempted to listen to events during the capture phase on a ' +
- 'browser that does not support the capture phase. Your application ' +
- 'will not receive some events.'
- );
- }
- return {
- remove: emptyFunction
- };
- } else {
- target.addEventListener(eventType, callback, true);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, true);
- }
- };
- }
- },
-
- registerDefault: function() {}
-};
-
-module.exports = EventListener;
-
-},{"129":129}],18:[function(_dereq_,module,exports){
+},{"165":165}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2658,12 +2258,14 @@
'use strict';
-var EventPluginRegistry = _dereq_(19);
-var EventPluginUtils = _dereq_(20);
-
-var accumulateInto = _dereq_(118);
-var forEachAccumulated = _dereq_(135);
-var invariant = _dereq_(150);
+var EventPluginRegistry = _dereq_(17);
+var EventPluginUtils = _dereq_(18);
+var ReactErrorUtils = _dereq_(61);
+
+var accumulateInto = _dereq_(115);
+var forEachAccumulated = _dereq_(124);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Internal store for event listeners
@@ -2680,23 +2282,24 @@
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
-var executeDispatchesAndRelease = function(event) {
+var executeDispatchesAndRelease = function (event, simulated) {
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, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
+var executeDispatchesAndReleaseSimulated = function (e) {
+ return executeDispatchesAndRelease(e, true);
+};
+var executeDispatchesAndReleaseTopLevel = function (e) {
+ return executeDispatchesAndRelease(e, false);
+};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
@@ -2705,14 +2308,8 @@
var InstanceHandle = null;
function validateInstanceHandle() {
- var valid =
- InstanceHandle &&
- InstanceHandle.traverseTwoPhase &&
- InstanceHandle.traverseEnterLeave;
- ("production" !== "development" ? invariant(
- valid,
- 'InstanceHandle not injected before use!'
- ) : invariant(valid));
+ var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
+ "development" !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
@@ -2754,15 +2351,15 @@
* @param {object} InjectedInstanceHandle
* @public
*/
- injectInstanceHandle: function(InjectedInstanceHandle) {
+ injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateInstanceHandle();
}
},
- getInstanceHandle: function() {
- if ("production" !== "development") {
+ getInstanceHandle: function () {
+ if ("development" !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
@@ -2792,16 +2389,16 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
- putListener: function(id, registrationName, listener) {
- ("production" !== "development" ? invariant(
- !listener || typeof listener === 'function',
- 'Expected %s listener to be a function, instead got type %s',
- registrationName, typeof listener
- ) : invariant(!listener || typeof listener === 'function'));
+ putListener: function (id, registrationName, listener) {
+ !(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
- var bankForRegistrationName =
- listenerBank[registrationName] || (listenerBank[registrationName] = {});
+ var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.didPutListener) {
+ PluginModule.didPutListener(id, registrationName, listener);
+ }
},
/**
@@ -2809,7 +2406,7 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
- getListener: function(id, registrationName) {
+ getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
@@ -2820,8 +2417,14 @@
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
- deleteListener: function(id, registrationName) {
+ deleteListener: function (id, registrationName) {
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
var bankForRegistrationName = listenerBank[registrationName];
+ // TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
@@ -2832,8 +2435,17 @@
*
* @param {string} id ID of the DOM element.
*/
- deleteAllListeners: function(id) {
+ deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
+ if (!listenerBank[registrationName][id]) {
+ continue;
+ }
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
delete listenerBank[registrationName][id];
}
},
@@ -2849,23 +2461,14 @@
* @return {*} An accumulation of synthetic events.
* @internal
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
- for (var i = 0, l = plugins.length; i < l; i++) {
+ for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
- var extractedEvents = possiblePlugin.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
@@ -2881,7 +2484,7 @@
* @param {*} events An accumulation of synthetic events.
* @internal
*/
- enqueueEvents: function(events) {
+ enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
@@ -2892,35 +2495,36 @@
*
* @internal
*/
- processEventQueue: function() {
+ processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
- forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
- ("production" !== "development" ? invariant(
- !eventQueue,
- 'processEventQueue(): Additional events were enqueued while processing ' +
- 'an event queue. Support for this has not yet been implemented.'
- ) : invariant(!eventQueue));
+ if (simulated) {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
+ } else {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ }
+ !!eventQueue ? "development" !== '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();
},
/**
* These are needed for tests only. Do not use!
*/
- __purge: function() {
+ __purge: function () {
listenerBank = {};
},
- __getListenerBank: function() {
+ __getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
-
-},{"118":118,"135":135,"150":150,"19":19,"20":20}],19:[function(_dereq_,module,exports){
+},{"115":115,"124":124,"161":161,"17":17,"173":173,"18":18,"61":61}],17:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2935,7 +2539,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* Injectable ordering of event plugins.
@@ -2960,38 +2564,15 @@
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
- ("production" !== "development" ? invariant(
- pluginIndex > -1,
- 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
- 'the plugin ordering, `%s`.',
- pluginName
- ) : invariant(pluginIndex > -1));
+ !(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
- ("production" !== "development" ? invariant(
- PluginModule.extractEvents,
- 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
- 'method, but `%s` does not.',
- pluginName
- ) : invariant(PluginModule.extractEvents));
+ !PluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
- ("production" !== "development" ? invariant(
- publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- ),
- 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
- eventName,
- pluginName
- ) : invariant(publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- )));
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
@@ -3005,12 +2586,7 @@
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
- ("production" !== "development" ? invariant(
- !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'event name, `%s`.',
- eventName
- ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -3018,20 +2594,12 @@
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
- publishRegistrationName(
- phasedRegistrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
- publishRegistrationName(
- dispatchConfig.registrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
@@ -3046,15 +2614,9 @@
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
- ("production" !== "development" ? invariant(
- !EventPluginRegistry.registrationNameModules[registrationName],
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'registration name, `%s`.',
- registrationName
- ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
- EventPluginRegistry.registrationNameDependencies[registrationName] =
- PluginModule.eventTypes[eventName].dependencies;
+ EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
@@ -3093,12 +2655,8 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
- injectEventPluginOrder: function(InjectedEventPluginOrder) {
- ("production" !== "development" ? invariant(
- !EventPluginOrder,
- 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
- 'once. You are likely trying to load more than one copy of React.'
- ) : invariant(!EventPluginOrder));
+ injectEventPluginOrder: function (InjectedEventPluginOrder) {
+ !!EventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
@@ -3114,21 +2672,15 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
- injectEventPluginsByName: function(injectedNamesToPlugins) {
+ injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
- if (!namesToPlugins.hasOwnProperty(pluginName) ||
- namesToPlugins[pluginName] !== PluginModule) {
- ("production" !== "development" ? invariant(
- !namesToPlugins[pluginName],
- 'EventPluginRegistry: Cannot inject two different event plugins ' +
- 'using the same name, `%s`.',
- pluginName
- ) : invariant(!namesToPlugins[pluginName]));
+ if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
+ !!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
@@ -3145,20 +2697,16 @@
* @return {?object} The plugin that created the supplied event.
* @internal
*/
- getPluginModuleForEvent: function(event) {
+ getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
- return EventPluginRegistry.registrationNameModules[
- dispatchConfig.registrationName
- ] || null;
+ return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
- var PluginModule = EventPluginRegistry.registrationNameModules[
- dispatchConfig.phasedRegistrationNames[phase]
- ];
+ var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
@@ -3170,7 +2718,7 @@
* Exposed for unit testing.
* @private
*/
- _resetEventPlugins: function() {
+ _resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
@@ -3197,8 +2745,7 @@
};
module.exports = EventPluginRegistry;
-
-},{"150":150}],20:[function(_dereq_,module,exports){
+},{"161":161}],18:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3212,9 +2759,11 @@
'use strict';
-var EventConstants = _dereq_(16);
+var EventConstants = _dereq_(15);
+var ReactErrorUtils = _dereq_(61);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Injected dependencies:
@@ -3226,14 +2775,10 @@
*/
var injection = {
Mount: null,
- injectMount: function(InjectedMount) {
+ injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
- if ("production" !== "development") {
- ("production" !== "development" ? invariant(
- InjectedMount && InjectedMount.getNode,
- 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
- 'is missing getNode.'
- ) : invariant(InjectedMount && InjectedMount.getNode));
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
@@ -3241,50 +2786,56 @@
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseUp ||
- topLevelType === topLevelTypes.topTouchEnd ||
- topLevelType === topLevelTypes.topTouchCancel;
+ return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseMove ||
- topLevelType === topLevelTypes.topTouchMove;
+ return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseDown ||
- topLevelType === topLevelTypes.topTouchStart;
+ return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
-
var validateEventDispatches;
-if ("production" !== "development") {
- validateEventDispatches = function(event) {
+if ("development" !== 'production') {
+ validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
- var listenersLen = listenersIsArr ?
- dispatchListeners.length :
- dispatchListeners ? 1 : 0;
-
- ("production" !== "development" ? invariant(
- idsIsArr === listenersIsArr && IDsLen === listenersLen,
- 'EventPluginUtils: Invalid `event`.'
- ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
+ var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
+
+ "development" !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
- * 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 {boolean} simulated If the event is simulated (changes exn behavior)
+ * @param {function} listener Application-level callback
+ * @param {string} domID DOM id to pass to the callback.
*/
-function forEachEventDispatch(event, cb) {
+function executeDispatch(event, simulated, listener, domID) {
+ var type = event.type || 'unknown-event';
+ event.currentTarget = injection.Mount.getNode(domID);
+ if (simulated) {
+ ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
+ } else {
+ ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
+ }
+ event.currentTarget = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches.
+ */
+function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -3293,31 +2844,11 @@
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
- cb(event, dispatchListeners[i], dispatchIDs[i]);
+ executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
- cb(event, dispatchListeners, dispatchIDs);
+ executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
-}
-
-/**
- * Default implementation of PluginModule.executeDispatch().
- * @param {SyntheticEvent} SyntheticEvent to handle
- * @param {function} 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;
event._dispatchIDs = null;
}
@@ -3326,13 +2857,13 @@
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
- * @return id of the first dispatch execution who's listener returns true, or
- * null if no listener returned true.
+ * @return {?string} id of the first dispatch execution who's listener returns
+ * true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -3370,21 +2901,16 @@
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
- * @return The return value of executing the single dispatch.
+ * @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
- ("production" !== "development" ? invariant(
- !Array.isArray(dispatchListener),
- 'executeDirectDispatch(...): Invalid `event`.'
- ) : invariant(!Array.isArray(dispatchListener)));
- var res = dispatchListener ?
- dispatchListener(event, dispatchID) :
- null;
+ !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
+ var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
@@ -3392,7 +2918,7 @@
/**
* @param {SyntheticEvent} event
- * @return {bool} True iff number of dispatches accumulated is greater than 0.
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
@@ -3407,17 +2933,22 @@
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
- executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
- injection: injection,
- useTouchEvents: false
+
+ getNode: function (id) {
+ return injection.Mount.getNode(id);
+ },
+ getID: function (node) {
+ return injection.Mount.getID(node);
+ },
+
+ injection: injection
};
module.exports = EventPluginUtils;
-
-},{"150":150,"16":16}],21:[function(_dereq_,module,exports){
+},{"15":15,"161":161,"173":173,"61":61}],19:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3431,11 +2962,13 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
-var accumulateInto = _dereq_(118);
-var forEachAccumulated = _dereq_(135);
+var warning = _dereq_(173);
+
+var accumulateInto = _dereq_(115);
+var forEachAccumulated = _dereq_(124);
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
@@ -3445,8 +2978,7 @@
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
- var registrationName =
- event.dispatchConfig.phasedRegistrationNames[propagationPhase];
+ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
@@ -3457,16 +2989,13 @@
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
- if ("production" !== "development") {
- if (!domID) {
- throw new Error('Dispatching id must not be null');
- }
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
@@ -3474,20 +3003,24 @@
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* 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
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
- event.dispatchMarker,
- accumulateDirectionalDispatches,
- event
- );
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
+/**
+ * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
+ */
+function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
+ }
+}
/**
* Accumulates without regard to direction, does not look for phased
@@ -3499,8 +3032,7 @@
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
@@ -3521,16 +3053,13 @@
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
-function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
- EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
- fromID,
- toID,
- accumulateDispatches,
- leave,
- enter
- );
+function accumulateTwoPhaseDispatchesSkipTarget(events) {
+ forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
+function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
+ EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
+}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
@@ -3551,57 +3078,13 @@
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
+ accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
-
-},{"118":118,"135":135,"16":16,"18":18}],22:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ExecutionEnvironment
- */
-
-/*jslint evil: true */
-
-"use strict";
-
-var canUseDOM = !!(
- (typeof window !== 'undefined' &&
- window.document && window.document.createElement)
-);
-
-/**
- * Simple, lightweight module assisting with the detection and context of
- * Worker. Helps avoid circular dependencies and allows code to reason about
- * whether or not they are in a Worker, even if they never include the main
- * `ReactWorker` dependency.
- */
-var ExecutionEnvironment = {
-
- canUseDOM: canUseDOM,
-
- canUseWorkers: typeof Worker !== 'undefined',
-
- canUseEventListeners:
- canUseDOM && !!(window.addEventListener || window.attachEvent),
-
- canUseViewport: canUseDOM && !!window.screen,
-
- isInWorker: !canUseDOM // For now, this is true - might change in the future.
-
-};
-
-module.exports = ExecutionEnvironment;
-
-},{}],23:[function(_dereq_,module,exports){
+},{"115":115,"124":124,"15":15,"16":16,"173":173}],20:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3616,10 +3099,10 @@
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var getTextContentAccessor = _dereq_(145);
+var assign = _dereq_(24);
+var getTextContentAccessor = _dereq_(131);
/**
* This helper class stores information about text content of a target node,
@@ -3639,12 +3122,18 @@
}
assign(FallbackCompositionState.prototype, {
+ destructor: function () {
+ this._root = null;
+ this._startText = null;
+ this._fallbackText = null;
+ },
+
/**
* Get current text of input.
*
* @return {string}
*/
- getText: function() {
+ getText: function () {
if ('value' in this._root) {
return this._root.value;
}
@@ -3657,7 +3146,7 @@
*
* @return {string}
*/
- getData: function() {
+ getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
@@ -3691,8 +3180,7 @@
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
-
-},{"145":145,"29":29,"30":30}],24:[function(_dereq_,module,exports){
+},{"131":131,"24":24,"25":25}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3704,41 +3192,27 @@
* @providesModule HTMLDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
-var DOMProperty = _dereq_(11);
-var ExecutionEnvironment = _dereq_(22);
+var DOMProperty = _dereq_(10);
+var ExecutionEnvironment = _dereq_(147);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE =
- DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE =
- DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
+var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
+var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
- hasSVG = (
- implementation &&
- implementation.hasFeature &&
- implementation.hasFeature(
- 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
- '1.1'
- )
- );
+ hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
-
var HTMLDOMPropertyConfig = {
- isCustomAttribute: RegExp.prototype.test.bind(
- /^(data|aria)-[a-z_][a-z\d_.\-]*$/
- ),
+ isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
@@ -3752,12 +3226,14 @@
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
- // autoFocus is polyfilled/normalized by AutoFocusMixin
+ // autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
+ capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
+ challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
@@ -3776,6 +3252,7 @@
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
+ 'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
@@ -3799,6 +3276,12 @@
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
+ inputMode: MUST_USE_ATTRIBUTE,
+ integrity: null,
+ is: MUST_USE_ATTRIBUTE,
+ keyParams: MUST_USE_ATTRIBUTE,
+ keyType: MUST_USE_ATTRIBUTE,
+ kind: null,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
@@ -3813,9 +3296,11 @@
mediaGroup: null,
method: null,
min: null,
+ minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
+ nonce: MUST_USE_ATTRIBUTE,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
@@ -3827,6 +3312,7 @@
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
+ reversed: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
@@ -3843,10 +3329,12 @@
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
+ srcLang: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
+ summary: null,
tabIndex: null,
target: null,
title: null,
@@ -3855,14 +3343,32 @@
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
+ wrap: null,
+
+ /**
+ * RDFa Properties
+ */
+ about: MUST_USE_ATTRIBUTE,
+ datatype: MUST_USE_ATTRIBUTE,
+ inlist: MUST_USE_ATTRIBUTE,
+ prefix: MUST_USE_ATTRIBUTE,
+ // property is also supported for OpenGraph in meta tags.
+ property: MUST_USE_ATTRIBUTE,
+ resource: MUST_USE_ATTRIBUTE,
+ 'typeof': MUST_USE_ATTRIBUTE,
+ vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
- autoCapitalize: null,
- autoCorrect: null,
+ autoCapitalize: MUST_USE_ATTRIBUTE,
+ autoCorrect: MUST_USE_ATTRIBUTE,
+ // autoSave allows WebKit/Blink to persist values of input fields on page reloads
+ autoSave: null,
+ // color is for Safari mask-icon link
+ color: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
@@ -3873,8 +3379,12 @@
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
- // property is supported for OpenGraph in meta tags.
- 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
+ // as an alternative to the sandbox attribute on IE<10
+ security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
@@ -3885,11 +3395,10 @@
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
- autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
- autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
+ autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
@@ -3902,8 +3411,7 @@
};
module.exports = HTMLDOMPropertyConfig;
-
-},{"11":11,"22":22}],25:[function(_dereq_,module,exports){
+},{"10":10,"147":147}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3918,8 +3426,8 @@
'use strict';
-var ReactLink = _dereq_(75);
-var ReactStateSetters = _dereq_(94);
+var ReactLink = _dereq_(70);
+var ReactStateSetters = _dereq_(90);
/**
* A simple mixin around ReactLink.forState().
@@ -3934,17 +3442,13 @@
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
- linkState: function(key) {
- return new ReactLink(
- this.state[key],
- ReactStateSetters.createStateKeySetter(this, key)
- );
+ linkState: function (key) {
+ return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
}
};
module.exports = LinkedStateMixin;
-
-},{"75":75,"94":94}],26:[function(_dereq_,module,exports){
+},{"70":70,"90":90}],23:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3959,9 +3463,11 @@
'use strict';
-var ReactPropTypes = _dereq_(86);
+var ReactPropTypes = _dereq_(82);
+var ReactPropTypeLocations = _dereq_(81);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
var hasReadOnlyValue = {
'button': true,
@@ -3973,46 +3479,44 @@
'submit': true
};
-function _assertSingleLink(input) {
- ("production" !== "development" ? invariant(
- input.props.checkedLink == null || input.props.valueLink == null,
- 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
- 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
- ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
+function _assertSingleLink(inputProps) {
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
-function _assertValueLink(input) {
- _assertSingleLink(input);
- ("production" !== "development" ? invariant(
- input.props.value == null && input.props.onChange == null,
- 'Cannot provide a valueLink and a value or onChange event. If you want ' +
- 'to use value or onChange, you probably don\'t want to use valueLink.'
- ) : invariant(input.props.value == null && input.props.onChange == null));
+function _assertValueLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.value == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
-function _assertCheckedLink(input) {
- _assertSingleLink(input);
- ("production" !== "development" ? invariant(
- input.props.checked == null && input.props.onChange == null,
- 'Cannot provide a checkedLink and a checked property or onChange event. ' +
- 'If you want to use checked or onChange, you probably don\'t want to ' +
- 'use checkedLink'
- ) : invariant(input.props.checked == null && input.props.onChange == null));
+function _assertCheckedLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.checked == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedValueChange(e) {
- /*jshint validthis:true */
- this.props.valueLink.requestChange(e.target.value);
-}
+var propTypes = {
+ value: function (props, propName, componentName) {
+ if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ checked: function (props, propName, componentName) {
+ if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ onChange: ReactPropTypes.func
+};
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedCheckChange(e) {
- /*jshint validthis:true */
- this.props.checkedLink.requestChange(e.target.checked);
+var loggedTypeFailures = {};
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
}
/**
@@ -4020,198 +3524,66 @@
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
- Mixin: {
- propTypes: {
- value: function(props, propName, componentName) {
- if (!props[propName] ||
- hasReadOnlyValue[props.type] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ checkPropTypes: function (tagName, props, owner) {
+ for (var propName in propTypes) {
+ if (propTypes.hasOwnProperty(propName)) {
+ var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
}
- return new Error(
- 'You provided a `value` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultValue`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- checked: function(props, propName, componentName) {
- if (!props[propName] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
+ // Only monitor this failure once because there tends to be a lot of the
+ // same error.
+ loggedTypeFailures[error.message] = true;
+
+ var addendum = getDeclarationErrorAddendum(owner);
+ "development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
- return new Error(
- 'You provided a `checked` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultChecked`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- onChange: ReactPropTypes.func
}
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
- getValue: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return input.props.valueLink.value;
+ getValue: function (inputProps) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.value;
}
- return input.props.value;
+ return inputProps.value;
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
- getChecked: function(input) {
- if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return input.props.checkedLink.value;
- }
- return input.props.checked;
+ getChecked: function (inputProps) {
+ if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.value;
+ }
+ return inputProps.checked;
},
/**
- * @param {ReactComponent} input Form component
- * @return {function} change callback either from onChange prop or link.
- */
- getOnChange: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return _handleLinkedValueChange;
- } else if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return _handleLinkedCheckChange;
+ * @param {object} inputProps Props for form component
+ * @param {SyntheticEvent} event change event to handle
+ */
+ executeOnChange: function (inputProps, event) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.requestChange(event.target.value);
+ } else if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.requestChange(event.target.checked);
+ } else if (inputProps.onChange) {
+ return inputProps.onChange.call(undefined, event);
}
- return input.props.onChange;
}
};
module.exports = LinkedValueUtils;
-
-},{"150":150,"86":86}],27:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule LocalEventTrapMixin
- */
-
-'use strict';
-
-var ReactBrowserEventEmitter = _dereq_(33);
-
-var accumulateInto = _dereq_(118);
-var forEachAccumulated = _dereq_(135);
-var invariant = _dereq_(150);
-
-function remove(event) {
- event.remove();
-}
-
-var LocalEventTrapMixin = {
- trapBubbledEvent:function(topLevelType, handlerBaseName) {
- ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
- // If a component renders to null or if another component fatals and causes
- // the state of the tree to be corrupted, `node` here can be null.
- var node = this.getDOMNode();
- ("production" !== "development" ? invariant(
- node,
- 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
- ) : invariant(node));
- var listener = ReactBrowserEventEmitter.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- node
- );
- this._localEventListeners =
- accumulateInto(this._localEventListeners, listener);
- },
-
- // trapCapturedEvent would look nearly identical. We don't implement that
- // method because it isn't currently needed.
-
- componentWillUnmount:function() {
- if (this._localEventListeners) {
- forEachAccumulated(this._localEventListeners, remove);
- }
- }
-};
-
-module.exports = LocalEventTrapMixin;
-
-},{"118":118,"135":135,"150":150,"33":33}],28:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule MobileSafariClickEventPlugin
- * @typechecks static-only
- */
-
-'use strict';
-
-var EventConstants = _dereq_(16);
-
-var emptyFunction = _dereq_(129);
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-/**
- * Mobile Safari does not fire properly bubble click events on non-interactive
- * elements, which means delegated click listeners do not fire. The workaround
- * for this bug involves attaching an empty click listener on the target node.
- *
- * This particular plugin works around the bug by attaching an empty click
- * listener on `touchstart` (which does fire on every element).
- */
-var MobileSafariClickEventPlugin = {
-
- eventTypes: null,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topTouchStart) {
- var target = nativeEvent.target;
- if (target && !target.onclick) {
- target.onclick = emptyFunction;
- }
- }
- }
-
-};
-
-module.exports = MobileSafariClickEventPlugin;
-
-},{"129":129,"16":16}],29:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"81":81,"82":82}],24:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -4259,8 +3631,7 @@
}
module.exports = assign;
-
-},{}],30:[function(_dereq_,module,exports){
+},{}],25:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4274,7 +3645,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* Static poolers. Several custom versions for each potential number of
@@ -4283,7 +3654,7 @@
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
-var oneArgumentPooler = function(copyFieldsFrom) {
+var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4294,7 +3665,7 @@
}
};
-var twoArgumentPooler = function(a1, a2) {
+var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4305,7 +3676,7 @@
}
};
-var threeArgumentPooler = function(a1, a2, a3) {
+var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4316,7 +3687,18 @@
}
};
-var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
+var fourArgumentPooler = function (a1, a2, a3, a4) {
+ var Klass = this;
+ if (Klass.instancePool.length) {
+ var instance = Klass.instancePool.pop();
+ Klass.call(instance, a1, a2, a3, a4);
+ return instance;
+ } else {
+ return new Klass(a1, a2, a3, a4);
+ }
+};
+
+var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4327,15 +3709,10 @@
}
};
-var standardReleaser = function(instance) {
+var standardReleaser = function (instance) {
var Klass = this;
- ("production" !== "development" ? invariant(
- instance instanceof Klass,
- 'Trying to release an instance into a pool of a different type.'
- ) : invariant(instance instanceof Klass));
- if (instance.destructor) {
+ !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
- }
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
@@ -4353,7 +3730,7 @@
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
-var addPoolingTo = function(CopyConstructor, pooler) {
+var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
@@ -4369,12 +3746,12 @@
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
+ fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
-
-},{"150":150}],31:[function(_dereq_,module,exports){
+},{"161":161}],26:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4386,145 +3763,36 @@
* @providesModule React
*/
-/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
-
'use strict';
-var EventPluginUtils = _dereq_(20);
-var ReactChildren = _dereq_(37);
-var ReactComponent = _dereq_(39);
-var ReactClass = _dereq_(38);
-var ReactContext = _dereq_(44);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
-var ReactDOM = _dereq_(46);
-var ReactDOMTextComponent = _dereq_(57);
-var ReactDefaultInjection = _dereq_(60);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMount = _dereq_(77);
-var ReactPerf = _dereq_(82);
-var ReactPropTypes = _dereq_(86);
-var ReactReconciler = _dereq_(89);
-var ReactServerRendering = _dereq_(92);
-
-var assign = _dereq_(29);
-var findDOMNode = _dereq_(132);
-var onlyChild = _dereq_(160);
-
-ReactDefaultInjection.inject();
-
-var createElement = ReactElement.createElement;
-var createFactory = ReactElement.createFactory;
-var cloneElement = ReactElement.cloneElement;
-
-if ("production" !== "development") {
- createElement = ReactElementValidator.createElement;
- createFactory = ReactElementValidator.createFactory;
- cloneElement = ReactElementValidator.cloneElement;
-}
-
-var render = ReactPerf.measure('React', 'render', ReactMount.render);
-
-var React = {
- Children: {
- map: ReactChildren.map,
- forEach: ReactChildren.forEach,
- count: ReactChildren.count,
- only: onlyChild
- },
- Component: ReactComponent,
- DOM: ReactDOM,
- PropTypes: ReactPropTypes,
- initializeTouchEvents: function(shouldUseTouch) {
- EventPluginUtils.useTouchEvents = shouldUseTouch;
- },
- createClass: ReactClass.createClass,
- createElement: createElement,
- cloneElement: cloneElement,
- createFactory: createFactory,
- createMixin: function(mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
- constructAndRenderComponent: ReactMount.constructAndRenderComponent,
- constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
- findDOMNode: findDOMNode,
- render: render,
- renderToString: ReactServerRendering.renderToString,
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
- unmountComponentAtNode: ReactMount.unmountComponentAtNode,
- isValidElement: ReactElement.isValidElement,
- withContext: ReactContext.withContext,
-
- // Hook for JSX spread, don't use this for anything else.
- __spread: assign
-};
-
-// Inject the runtime into a devtools global hook regardless of browser.
-// Allows for debugging when the hook is injected on the page.
-if (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
- __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
- CurrentOwner: ReactCurrentOwner,
- InstanceHandles: ReactInstanceHandles,
- Mount: ReactMount,
- Reconciler: ReactReconciler,
- TextComponent: ReactDOMTextComponent
- });
-}
-
-if ("production" !== "development") {
- var ExecutionEnvironment = _dereq_(22);
- if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
-
- // 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') {
- console.debug(
- 'Download the React DevTools for a better development experience: ' +
- 'https://fb.me/react-devtools'
- );
- }
- }
-
- var expectedFeatures = [
- // shims
- Array.isArray,
- Array.prototype.every,
- Array.prototype.forEach,
- Array.prototype.indexOf,
- Array.prototype.map,
- Date.now,
- Function.prototype.bind,
- Object.keys,
- String.prototype.split,
- String.prototype.trim,
-
- // shams
- Object.create,
- Object.freeze
- ];
-
- for (var i = 0; i < expectedFeatures.length; i++) {
- if (!expectedFeatures[i]) {
- console.error(
- 'One or more ES5 shim/shams expected by React are not available: ' +
- 'https://fb.me/react-warning-polyfills'
- );
- break;
- }
- }
- }
-}
+var ReactDOM = _dereq_(40);
+var ReactDOMServer = _dereq_(50);
+var ReactIsomorphic = _dereq_(69);
+
+var assign = _dereq_(24);
+var deprecated = _dereq_(120);
+
+// `version` will be added here by ReactIsomorphic.
+var React = {};
+
+assign(React, ReactIsomorphic);
+
+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.version = '0.13.3';
+React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
+React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
module.exports = React;
-
-},{"132":132,"160":160,"20":20,"22":22,"29":29,"37":37,"38":38,"39":39,"44":44,"45":45,"46":46,"57":57,"60":60,"63":63,"64":64,"72":72,"77":77,"82":82,"86":86,"89":89,"92":92}],32:[function(_dereq_,module,exports){
+},{"120":120,"24":24,"40":40,"50":50,"69":69}],27:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4538,7 +3806,12 @@
'use strict';
-var findDOMNode = _dereq_(132);
+var ReactInstanceMap = _dereq_(68);
+
+var findDOMNode = _dereq_(122);
+var warning = _dereq_(173);
+
+var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
@@ -4548,14 +3821,15 @@
* @final
* @protected
*/
- getDOMNode: function() {
+ getDOMNode: function () {
+ "development" !== '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;
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
-
-},{"132":132}],33:[function(_dereq_,module,exports){
+},{"122":122,"173":173,"68":68}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4570,14 +3844,15 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPluginRegistry = _dereq_(19);
-var ReactEventEmitterMixin = _dereq_(67);
-var ViewportMetrics = _dereq_(117);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPluginRegistry = _dereq_(17);
+var ReactEventEmitterMixin = _dereq_(62);
+var ReactPerf = _dereq_(78);
+var ViewportMetrics = _dereq_(114);
-var assign = _dereq_(29);
-var isEventSupported = _dereq_(151);
+var assign = _dereq_(24);
+var isEventSupported = _dereq_(133);
/**
* Summary of `ReactBrowserEventEmitter` event handling:
@@ -4642,7 +3917,10 @@
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
+ topAbort: 'abort',
topBlur: 'blur',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
@@ -4660,24 +3938,44 @@
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
topScroll: 'scroll',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
topTextInput: 'textInput',
+ topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting',
topWheel: 'wheel'
};
@@ -4717,10 +4015,8 @@
/**
* @param {object} ReactEventListener
*/
- injectReactEventListener: function(ReactEventListener) {
- ReactEventListener.setHandleTopLevel(
- ReactBrowserEventEmitter.handleTopLevel
- );
+ injectReactEventListener: function (ReactEventListener) {
+ ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
@@ -4730,7 +4026,7 @@
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
@@ -4739,10 +4035,8 @@
/**
* @return {boolean} True if callbacks are enabled.
*/
- isEnabled: function() {
- return !!(
- (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
- );
+ isEnabled: function () {
+ return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
@@ -4766,93 +4060,49 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
- listenTo: function(registrationName, contentDocumentHandle) {
+ listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
- var dependencies = EventPluginRegistry.
- registrationNameDependencies[registrationName];
+ var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
- for (var i = 0, l = dependencies.length; i < l; i++) {
+ for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
- if (!(
- (isListening.hasOwnProperty(dependency) && isListening[dependency])
- )) {
+ if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'wheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'mousewheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'DOMMouseScroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topScroll,
- 'scroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topScroll,
- 'scroll',
- ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
- } else if (dependency === topLevelTypes.topFocus ||
- dependency === topLevelTypes.topBlur) {
+ } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topFocus,
- 'focus',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topBlur,
- 'blur',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topFocus,
- 'focusin',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topBlur,
- 'focusout',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- dependency,
- topEventMapping[dependency],
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
@@ -4860,20 +4110,12 @@
}
},
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
@@ -4884,7 +4126,7 @@
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
- ensureScrollValueMonitoring: function() {
+ ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
@@ -4906,9 +4148,13 @@
});
-module.exports = ReactBrowserEventEmitter;
+ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
+ putListener: 'putListener',
+ deleteListener: 'deleteListener'
+});
-},{"117":117,"151":151,"16":16,"18":18,"19":19,"29":29,"67":67}],34:[function(_dereq_,module,exports){
+module.exports = ReactBrowserEventEmitter;
+},{"114":114,"133":133,"15":15,"16":16,"17":17,"24":24,"62":62,"78":78}],29:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4923,28 +4169,47 @@
'use strict';
-var React = _dereq_(31);
+var React = _dereq_(26);
-var assign = _dereq_(29);
+var assign = _dereq_(24);
-var ReactTransitionGroup = React.createFactory(
- _dereq_(98)
-);
-var ReactCSSTransitionGroupChild = React.createFactory(
- _dereq_(35)
-);
+var ReactTransitionGroup = _dereq_(94);
+var ReactCSSTransitionGroupChild = _dereq_(30);
+
+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] == null) {
+ 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({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
- transitionName: 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')
},
- getDefaultProps: function() {
+ getDefaultProps: function () {
return {
transitionAppear: false,
transitionEnter: true,
@@ -4952,33 +4217,28 @@
};
},
- _wrapChild: function(child) {
+ _wrapChild: function (child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// 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
- },
- child
- );
+ leave: this.props.transitionLeave,
+ appearTimeout: this.props.transitionAppearTimeout,
+ enterTimeout: this.props.transitionEnterTimeout,
+ leaveTimeout: this.props.transitionLeaveTimeout
+ }, child);
},
- render: function() {
- return (
- ReactTransitionGroup(
- assign({}, this.props, {childFactory: this._wrapChild})
- )
- );
+ render: function () {
+ return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}
});
module.exports = ReactCSSTransitionGroup;
-
-},{"29":29,"31":31,"35":35,"98":98}],35:[function(_dereq_,module,exports){
+},{"24":24,"26":26,"30":30,"94":94}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4993,53 +4253,68 @@
'use strict';
-var React = _dereq_(31);
+var React = _dereq_(26);
+var ReactDOM = _dereq_(40);
-var CSSCore = _dereq_(4);
-var ReactTransitionEvents = _dereq_(97);
+var CSSCore = _dereq_(145);
+var ReactTransitionEvents = _dereq_(93);
-var onlyChild = _dereq_(160);
-var warning = _dereq_(171);
+var onlyChild = _dereq_(135);
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
-var NO_EVENT_TIMEOUT = 5000;
-var noEventListener = null;
+var ReactCSSTransitionGroupChild = React.createClass({
+ displayName: 'ReactCSSTransitionGroupChild',
+ 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
+ },
-if ("production" !== "development") {
- noEventListener = function() {
- ("production" !== "development" ? 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
- ) : null);
- };
-}
+ transition: function (animationType, finishCallback, userSpecifiedDelay) {
+ var node = ReactDOM.findDOMNode(this);
-var ReactCSSTransitionGroupChild = React.createClass({
- displayName: 'ReactCSSTransitionGroupChild',
+ if (!node) {
+ if (finishCallback) {
+ finishCallback();
+ }
+ return;
+ }
- transition: function(animationType, finishCallback) {
- var node = this.getDOMNode();
- var className = this.props.name + '-' + animationType;
- var activeClassName = className + '-active';
- var noEventTimeout = null;
+ var className = this.props.name[animationType] || this.props.name + '-' + animationType;
+ var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
+ var timeout = null;
- var endListener = function(e) {
+ var endListener = function (e) {
if (e && e.target !== node) {
return;
}
- if ("production" !== "development") {
- clearTimeout(noEventTimeout);
- }
+
+ clearTimeout(timeout);
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
@@ -5053,19 +4328,23 @@
}
};
- ReactTransitionEvents.addEndEventListener(node, endListener);
-
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
- if ("production" !== "development") {
- 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);
+ this.transitionTimeouts.push(timeout);
+ } else {
+ // DEPRECATED: this listener will be removed in a future version of react
+ ReactTransitionEvents.addEndEventListener(node, endListener);
}
},
- queueClass: function(className) {
+ queueClass: function (className) {
this.classNameQueue.push(className);
if (!this.timeout) {
@@ -5073,58 +4352,59 @@
}
},
- flushClassNameQueue: function() {
+ flushClassNameQueue: function () {
if (this.isMounted()) {
- this.classNameQueue.forEach(
- CSSCore.addClass.bind(CSSCore, this.getDOMNode())
- );
+ this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
}
this.classNameQueue.length = 0;
this.timeout = null;
},
- componentWillMount: function() {
+ componentWillMount: function () {
this.classNameQueue = [];
+ this.transitionTimeouts = [];
},
- componentWillUnmount: function() {
+ componentWillUnmount: function () {
if (this.timeout) {
clearTimeout(this.timeout);
}
+ this.transitionTimeouts.forEach(function (timeout) {
+ clearTimeout(timeout);
+ });
},
- componentWillAppear: function(done) {
+ componentWillAppear: function (done) {
if (this.props.appear) {
- this.transition('appear', done);
+ this.transition('appear', done, this.props.appearTimeout);
} else {
done();
}
},
- componentWillEnter: function(done) {
+ componentWillEnter: function (done) {
if (this.props.enter) {
- this.transition('enter', done);
+ this.transition('enter', done, this.props.enterTimeout);
} else {
done();
}
},
- componentWillLeave: function(done) {
+ componentWillLeave: function (done) {
if (this.props.leave) {
- this.transition('leave', done);
+ this.transition('leave', done, this.props.leaveTimeout);
} else {
done();
}
},
- render: function() {
+ render: function () {
return onlyChild(this.props.children);
}
});
module.exports = ReactCSSTransitionGroupChild;
-
-},{"160":160,"171":171,"31":31,"4":4,"97":97}],36:[function(_dereq_,module,exports){
+},{"135":135,"145":145,"26":26,"40":40,"93":93}],31:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -5139,11 +4419,23 @@
'use strict';
-var ReactReconciler = _dereq_(89);
+var ReactReconciler = _dereq_(84);
-var flattenChildren = _dereq_(133);
-var instantiateReactComponent = _dereq_(149);
-var shouldUpdateReactComponent = _dereq_(167);
+var instantiateReactComponent = _dereq_(132);
+var shouldUpdateReactComponent = _dereq_(141);
+var traverseAllChildren = _dereq_(142);
+var warning = _dereq_(173);
+
+function instantiateChild(childInstances, child, name) {
+ // We found a component instance.
+ var keyUnique = childInstances[name] === undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): 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;
+ }
+ if (child != null && keyUnique) {
+ childInstances[name] = instantiateReactComponent(child, null);
+ }
+}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
@@ -5160,41 +4451,31 @@
* @return {?object} A set of child instances.
* @internal
*/
- instantiateChildren: function(nestedChildNodes, transaction, context) {
- var children = flattenChildren(nestedChildNodes);
- for (var name in children) {
- if (children.hasOwnProperty(name)) {
- var child = children[name];
- // The rendered children must be turned into instances as they're
- // mounted.
- var childInstance = instantiateReactComponent(child, null);
- children[name] = childInstance;
- }
+ instantiateChildren: function (nestedChildNodes, transaction, context) {
+ if (nestedChildNodes == null) {
+ return null;
}
- return children;
+ var childInstances = {};
+ traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
+ return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
- * @param {?object} nextNestedChildNodes Nested child maps.
+ * @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
- updateChildren: function(
- prevChildren,
- nextNestedChildNodes,
- transaction,
- context) {
+ updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
- var nextChildren = flattenChildren(nextNestedChildNodes);
if (!nextChildren && !prevChildren) {
return null;
}
@@ -5206,27 +4487,21 @@
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
- ReactReconciler.receiveComponent(
- prevChild, nextElement, transaction, context
- );
+ if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
+ ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
- var nextChildInstance = instantiateReactComponent(
- nextElement,
- null
- );
+ var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
@@ -5240,18 +4515,19 @@
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
- unmountChildren: function(renderedChildren) {
+ unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
+ if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
+ }
};
module.exports = ReactChildReconciler;
-
-},{"133":133,"149":149,"167":167,"89":89}],37:[function(_dereq_,module,exports){
+},{"132":132,"141":141,"142":142,"173":173,"84":84}],32:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -5265,14 +4541,19 @@
'use strict';
-var PooledClass = _dereq_(30);
-var ReactFragment = _dereq_(69);
+var PooledClass = _dereq_(25);
+var ReactElement = _dereq_(57);
-var traverseAllChildren = _dereq_(169);
-var warning = _dereq_(171);
+var emptyFunction = _dereq_(153);
+var traverseAllChildren = _dereq_(142);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
-var threeArgumentPooler = PooledClass.threeArgumentPooler;
+var fourArgumentPooler = PooledClass.fourArgumentPooler;
+
+var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
+function escapeUserProvidedKey(text) {
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
+}
/**
* PooledClass representing the bookkeeping associated with performing a child
@@ -5283,15 +4564,22 @@
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
- this.forEachFunction = forEachFunction;
- this.forEachContext = forEachContext;
-}
+ this.func = forEachFunction;
+ this.context = forEachContext;
+ this.count = 0;
+}
+ForEachBookKeeping.prototype.destructor = function () {
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
-function forEachSingleChild(traverseContext, child, name, i) {
- var forEachBookKeeping = traverseContext;
- forEachBookKeeping.forEachFunction.call(
- forEachBookKeeping.forEachContext, child, i);
+function forEachSingleChild(bookKeeping, child, name) {
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ func.call(context, child, bookKeeping.count++);
}
/**
@@ -5301,16 +4589,14 @@
* leaf child.
*
* @param {?*} children Children tree container.
- * @param {function(*, int)} forEachFunc.
+ * @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
-
- var traverseContext =
- ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
+ var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
@@ -5324,62 +4610,73 @@
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
-function MapBookKeeping(mapResult, mapFunction, mapContext) {
- this.mapResult = mapResult;
- this.mapFunction = mapFunction;
- this.mapContext = mapContext;
-}
-PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
-
-function mapSingleChildIntoContext(traverseContext, child, name, i) {
- var mapBookKeeping = traverseContext;
- var mapResult = mapBookKeeping.mapResult;
-
- var keyUnique = !mapResult.hasOwnProperty(name);
- if ("production" !== "development") {
- ("production" !== "development" ? 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
- ) : null);
- }
-
- if (keyUnique) {
- var mappedChild =
- mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
- mapResult[name] = mappedChild;
+function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
+ this.result = mapResult;
+ this.keyPrefix = keyPrefix;
+ this.func = mapFunction;
+ this.context = mapContext;
+ this.count = 0;
+}
+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(bookKeeping, child, childKey) {
+ var result = bookKeeping.result;
+ var keyPrefix = bookKeeping.keyPrefix;
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ 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);
}
}
+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);
+}
+
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
- * 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.
- * @param {function(*, int)} mapFunction.
- * @param {*} mapContext Context for mapFunction.
+ * @param {function(*, int)} func The map function.
+ * @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
-
- 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;
}
-function forEachSingleChildDummy(traverseContext, child, name, i) {
+function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
@@ -5394,15 +4691,26 @@
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
+/**
+ * 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;
-
-},{"169":169,"171":171,"30":30,"69":69}],38:[function(_dereq_,module,exports){
+},{"142":142,"153":153,"25":25,"57":57}],33:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -5416,23 +4724,20 @@
'use strict';
-var ReactComponent = _dereq_(39);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactErrorUtils = _dereq_(66);
-var ReactInstanceMap = _dereq_(73);
-var ReactLifeCycle = _dereq_(74);
-var ReactPropTypeLocations = _dereq_(85);
-var ReactPropTypeLocationNames = _dereq_(84);
-var ReactUpdateQueue = _dereq_(99);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var keyMirror = _dereq_(156);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var ReactComponent = _dereq_(34);
+var ReactElement = _dereq_(57);
+var ReactPropTypeLocations = _dereq_(81);
+var ReactPropTypeLocationNames = _dereq_(80);
+var ReactNoopUpdateQueue = _dereq_(76);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var invariant = _dereq_(161);
+var keyMirror = _dereq_(165);
+var keyOf = _dereq_(166);
+var warning = _dereq_(173);
-var MIXINS_KEY = keyOf({mixins: null});
+var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
@@ -5459,9 +4764,16 @@
DEFINE_MANY_MERGED: null
});
-
var injectedMixins = [];
+var warnedSetProps = false;
+function warnSetProps() {
+ if (!warnedSetProps) {
+ warnedSetProps = true;
+ "development" !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
+ }
+}
+
/**
* Composite components are higher-level components that compose other composite
* or native components.
@@ -5479,7 +4791,7 @@
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
- * class specification will available on the prototype.
+ * class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
@@ -5721,121 +5029,72 @@
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
- displayName: function(Constructor, displayName) {
+ displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
- mixins: function(Constructor, mixins) {
+ mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
- childContextTypes: function(Constructor, childContextTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- childContextTypes,
- ReactPropTypeLocations.childContext
- );
+ childContextTypes: function (Constructor, childContextTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
- Constructor.childContextTypes = assign(
- {},
- Constructor.childContextTypes,
- childContextTypes
- );
+ Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
},
- contextTypes: function(Constructor, contextTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- contextTypes,
- ReactPropTypeLocations.context
- );
+ contextTypes: function (Constructor, contextTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
- Constructor.contextTypes = assign(
- {},
- Constructor.contextTypes,
- contextTypes
- );
+ Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
- getDefaultProps: function(Constructor, getDefaultProps) {
+ getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
- Constructor.getDefaultProps = createMergedResultFunction(
- Constructor.getDefaultProps,
- getDefaultProps
- );
+ Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
- propTypes: function(Constructor, propTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- propTypes,
- ReactPropTypeLocations.prop
- );
+ propTypes: function (Constructor, propTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
- Constructor.propTypes = assign(
- {},
- Constructor.propTypes,
- propTypes
- );
+ Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
- statics: function(Constructor, statics) {
+ statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
- }
-};
+ },
+ autobind: function () {} };
+// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
- ("production" !== "development" ? warning(
- typeof typeDef[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- Constructor.displayName || 'ReactClass',
- ReactPropTypeLocationNames[location],
- propName
- ) : null);
+ "development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
- var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
- ReactClassInterface[name] :
- null;
+ var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
- ("production" !== "development" ? invariant(
- specPolicy === SpecPolicy.OVERRIDE_BASE,
- 'ReactClassInterface: You are attempting to override ' +
- '`%s` from your class specification. Ensure that your method names ' +
- 'do not overlap with React methods.',
- name
- ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
- ("production" !== "development" ? invariant(
- specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
- 'ReactClassInterface: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be due ' +
- 'to a mixin.',
- name
- ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
@@ -5848,16 +5107,8 @@
return;
}
- ("production" !== "development" ? invariant(
- typeof spec !== 'function',
- 'ReactClass: You\'re attempting to ' +
- 'use a component class as a mixin. Instead, just use a regular object.'
- ) : invariant(typeof spec !== 'function'));
- ("production" !== "development" ? invariant(
- !ReactElement.isValidElement(spec),
- 'ReactClass: You\'re attempting to ' +
- 'use a component as a mixin. Instead, just use a regular object.'
- ) : invariant(!ReactElement.isValidElement(spec)));
+ !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
+ !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
@@ -5874,7 +5125,7 @@
}
if (name === MIXINS_KEY) {
- // We have already handled mixins in a special case above
+ // We have already handled mixins in a special case above.
continue;
}
@@ -5888,16 +5139,10 @@
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
- var isReactClassMethod =
- ReactClassInterface.hasOwnProperty(name);
+ var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
- var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
- var shouldAutoBind =
- isFunction &&
- !isReactClassMethod &&
- !isAlreadyDefined &&
- !markedDontBind;
+ var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
@@ -5909,18 +5154,8 @@
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
- // These cases should already be caught by validateMethodOverride
- ("production" !== "development" ? invariant(
- isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- ),
- 'ReactClass: Unexpected spec policy %s for key %s ' +
- 'when mixing in component specs.',
- specPolicy,
- name
- ) : invariant(isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- )));
+ // These cases should already be caught by validateMethodOverride.
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
@@ -5931,7 +5166,7 @@
}
} else {
proto[name] = property;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
@@ -5954,24 +5189,11 @@
continue;
}
- var isReserved = name in RESERVED_SPEC_KEYS;
- ("production" !== "development" ? invariant(
- !isReserved,
- 'ReactClass: You are attempting to define a reserved ' +
- 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
- 'as an instance property instead; it will still be accessible on the ' +
- 'constructor.',
- name
- ) : invariant(!isReserved));
-
- var isInherited = name in Constructor;
- ("production" !== "development" ? invariant(
- !isInherited,
- 'ReactClass: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be ' +
- 'due to a mixin.',
- name
- ) : invariant(!isInherited));
+ var isReserved = (name in RESERVED_SPEC_KEYS);
+ !!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
+
+ var isInherited = (name in Constructor);
+ !!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
@@ -5984,22 +5206,11 @@
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
- ("production" !== "development" ? invariant(
- one && two && typeof one === 'object' && typeof two === 'object',
- 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
- ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
- ("production" !== "development" ? invariant(
- one[key] === undefined,
- 'mergeIntoWithNoDuplicateKeys(): ' +
- 'Tried to merge two objects with the same key: `%s`. This conflict ' +
- 'may be due to a mixin; in particular, this may be caused by two ' +
- 'getInitialState() or getDefaultProps() methods returning objects ' +
- 'with clashing keys.',
- key
- ) : invariant(one[key] === undefined));
+ !(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
@@ -6054,32 +5265,25 @@
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
- boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ boundMethod.bind = function (newThis) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
- ("production" !== "development" ? warning(
- false,
- 'bind(): React component methods may only be bound to the ' +
- 'component instance. See %s',
- componentName
- ) : null);
+ "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
- ("production" !== "development" ? warning(
- false,
- 'bind(): You are binding a component method to the component. ' +
- 'React does this for you automatically in a high-performance ' +
- 'way, so you can safely remove this call. See %s',
- componentName
- ) : null);
+ "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -6102,34 +5306,11 @@
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
- component[autoBindKey] = bindAutoBindMethod(
- component,
- ReactErrorUtils.guard(
- method,
- component.constructor.displayName + '.' + autoBindKey
- )
- );
+ component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
-var typeDeprecationDescriptor = {
- enumerable: false,
- get: function() {
- var displayName = this.displayName || this.name || 'Component';
- ("production" !== "development" ? warning(
- false,
- '%s.type is deprecated. Use %s directly to access the class.',
- displayName,
- displayName
- ) : null);
- Object.defineProperty(this, 'type', {
- value: this
- });
- return this;
- }
-};
-
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
@@ -6140,10 +5321,10 @@
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
- replaceState: function(newState, callback) {
- ReactUpdateQueue.enqueueReplaceState(this, newState);
+ replaceState: function (newState, callback) {
+ this.updater.enqueueReplaceState(this, newState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -6153,27 +5334,8 @@
* @protected
* @final
*/
- isMounted: function() {
- if ("production" !== "development") {
- var owner = ReactCurrentOwner.current;
- if (owner !== null) {
- ("production" !== "development" ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing isMounted inside its render() function. ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
- owner._warnedAboutRefsInRender = true;
- }
- }
- var internalInstance = ReactInstanceMap.get(this);
- return (
- internalInstance &&
- internalInstance !== ReactLifeCycle.currentlyMountingInstance
- );
+ isMounted: function () {
+ return this.updater.isMounted(this);
},
/**
@@ -6185,10 +5347,13 @@
* @public
* @deprecated
*/
- setProps: function(partialProps, callback) {
- ReactUpdateQueue.enqueueSetProps(this, partialProps);
+ setProps: function (partialProps, callback) {
+ if ("development" !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueSetProps(this, partialProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -6201,20 +5366,19 @@
* @public
* @deprecated
*/
- replaceProps: function(newProps, callback) {
- ReactUpdateQueue.enqueueReplaceProps(this, newProps);
+ replaceProps: function (newProps, callback) {
+ if ("development" !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
}
};
-var ReactClassComponent = function() {};
-assign(
- ReactClassComponent.prototype,
- ReactComponent.prototype,
- ReactClassMixin
-);
+var ReactClassComponent = function () {};
+assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
@@ -6230,17 +5394,13 @@
* @return {function} Component constructor function.
* @public
*/
- createClass: function(spec) {
- var Constructor = function(props, context) {
+ createClass: function (spec) {
+ var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- this instanceof Constructor,
- 'Something is calling a React component directly. Use a factory or ' +
- 'JSX instead. See: https://fb.me/react-legacyfactory'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
@@ -6250,44 +5410,40 @@
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ this.updater = updater || ReactNoopUpdateQueue;
+
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof initialState === 'undefined' &&
- this.getInitialState._isMockFunction) {
+ if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
- ("production" !== "development" ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.getInitialState(): must return an object or null',
- Constructor.displayName || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
- injectedMixins.forEach(
- mixSpecIntoComponent.bind(null, Constructor)
- );
+ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
- // Initialize the defaultProps property after all mixins have been merged
+ // Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
@@ -6300,20 +5456,11 @@
}
}
- ("production" !== "development" ? invariant(
- Constructor.prototype.render,
- 'createClass(...): Class specification must implement a `render` method.'
- ) : invariant(Constructor.prototype.render));
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- !Constructor.prototype.componentShouldUpdate,
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- spec.displayName || 'A component'
- ) : null);
+ !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
+ "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
@@ -6323,21 +5470,11 @@
}
}
- // Legacy hook
- Constructor.type = Constructor;
- if ("production" !== "development") {
- try {
- Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
- }
- }
-
return Constructor;
},
injection: {
- injectMixin: function(mixin) {
+ injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
@@ -6345,8 +5482,7 @@
};
module.exports = ReactClass;
-
-},{"150":150,"156":156,"157":157,"171":171,"29":29,"39":39,"45":45,"63":63,"66":66,"73":73,"74":74,"84":84,"85":85,"99":99}],39:[function(_dereq_,module,exports){
+},{"154":154,"161":161,"165":165,"166":166,"173":173,"24":24,"34":34,"57":57,"76":76,"80":80,"81":81}],34:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6360,19 +5496,27 @@
'use strict';
-var ReactUpdateQueue = _dereq_(99);
+var ReactNoopUpdateQueue = _dereq_(76);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var canDefineProperty = _dereq_(117);
+var emptyObject = _dereq_(154);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Base class helpers for the updating state of a component.
*/
-function ReactComponent(props, context) {
+function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ // We initialize the default updater but the real one gets injected by the
+ // renderer.
+ this.updater = updater || ReactNoopUpdateQueue;
}
+ReactComponent.prototype.isReactComponent = {};
+
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
@@ -6398,26 +5542,14 @@
* @final
* @protected
*/
-ReactComponent.prototype.setState = function(partialState, callback) {
- ("production" !== "development" ? invariant(
- typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null,
- 'setState(...): takes an object of state variables to update or a ' +
- 'function which returns an object of state variables.'
- ) : invariant(typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null));
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- partialState != null,
- 'setState(...): You passed an undefined or null state object; ' +
- 'instead, use forceUpdate().'
- ) : null);
+ReactComponent.prototype.setState = function (partialState, callback) {
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
- ReactUpdateQueue.enqueueSetState(this, partialState);
+ this.updater.enqueueSetState(this, partialState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -6435,10 +5567,10 @@
* @final
* @protected
*/
-ReactComponent.prototype.forceUpdate = function(callback) {
- ReactUpdateQueue.enqueueForceUpdate(this);
+ReactComponent.prototype.forceUpdate = function (callback) {
+ this.updater.enqueueForceUpdate(this);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -6447,46 +5579,22 @@
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
-if ("production" !== "development") {
+if ("development" !== 'production') {
var deprecatedAPIs = {
- getDOMNode: [
- 'getDOMNode',
- 'Use React.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.'
- ],
- 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.'
- ]
+ 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 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 render again at the top level.']
};
- var defineDeprecationWarning = function(methodName, info) {
- try {
+ var defineDeprecationWarning = function (methodName, info) {
+ if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
- get: function() {
- ("production" !== "development" ? warning(
- false,
- '%s(...) is deprecated in plain JavaScript React classes. %s',
- info[0],
- info[1]
- ) : null);
+ get: function () {
+ "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
}
};
for (var fnName in deprecatedAPIs) {
@@ -6497,8 +5605,7 @@
}
module.exports = ReactComponent;
-
-},{"150":150,"171":171,"99":99}],40:[function(_dereq_,module,exports){
+},{"117":117,"154":154,"161":161,"173":173,"76":76}],35:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6510,12 +5617,10 @@
* @providesModule ReactComponentBrowserEnvironment
*/
-/*jslint evil: true */
-
'use strict';
-var ReactDOMIDOperations = _dereq_(50);
-var ReactMount = _dereq_(77);
+var ReactDOMIDOperations = _dereq_(45);
+var ReactMount = _dereq_(72);
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
@@ -6524,11 +5629,9 @@
*/
var ReactComponentBrowserEnvironment = {
- processChildrenUpdates:
- ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
+ processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
- replaceNodeWithMarkupByID:
- ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
+ replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
@@ -6537,15 +5640,14 @@
*
* @private
*/
- unmountIDFromEnvironment: function(rootNodeID) {
+ unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
-
-},{"50":50,"77":77}],41:[function(_dereq_,module,exports){
+},{"45":45,"72":72}],36:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -6559,7 +5661,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
var injected = false;
@@ -6585,17 +5687,11 @@
processChildrenUpdates: null,
injection: {
- injectEnvironment: function(environment) {
- ("production" !== "development" ? invariant(
- !injected,
- 'ReactCompositeComponent: injectEnvironment() can only be called once.'
- ) : invariant(!injected));
- ReactComponentEnvironment.unmountIDFromEnvironment =
- environment.unmountIDFromEnvironment;
- ReactComponentEnvironment.replaceNodeWithMarkupByID =
- environment.replaceNodeWithMarkupByID;
- ReactComponentEnvironment.processChildrenUpdates =
- environment.processChildrenUpdates;
+ injectEnvironment: function (environment) {
+ !!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
+ ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
+ ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
+ ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
@@ -6603,8 +5699,7 @@
};
module.exports = ReactComponentEnvironment;
-
-},{"150":150}],42:[function(_dereq_,module,exports){
+},{"161":161}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6613,12 +5708,12 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
-* @providesModule ReactComponentWithPureRenderMixin
-*/
+ * @providesModule ReactComponentWithPureRenderMixin
+ */
'use strict';
-var shallowEqual = _dereq_(166);
+var shallowCompare = _dereq_(140);
/**
* If your React component's render function is "pure", e.g. it will render the
@@ -6645,15 +5740,13 @@
* use `forceUpdate()` when you know deep data structures have changed.
*/
var ReactComponentWithPureRenderMixin = {
- shouldComponentUpdate: function(nextProps, nextState) {
- return !shallowEqual(this.props, nextProps) ||
- !shallowEqual(this.state, nextState);
+ shouldComponentUpdate: function (nextProps, nextState) {
+ return shallowCompare(this, nextProps, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
-
-},{"166":166}],43:[function(_dereq_,module,exports){
+},{"140":140}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6667,25 +5760,21 @@
'use strict';
-var ReactComponentEnvironment = _dereq_(41);
-var ReactContext = _dereq_(44);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
-var ReactInstanceMap = _dereq_(73);
-var ReactLifeCycle = _dereq_(74);
-var ReactNativeComponent = _dereq_(80);
-var ReactPerf = _dereq_(82);
-var ReactPropTypeLocations = _dereq_(85);
-var ReactPropTypeLocationNames = _dereq_(84);
-var ReactReconciler = _dereq_(89);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var emptyObject = _dereq_(130);
-var invariant = _dereq_(150);
-var shouldUpdateReactComponent = _dereq_(167);
-var warning = _dereq_(171);
+var ReactComponentEnvironment = _dereq_(36);
+var ReactCurrentOwner = _dereq_(39);
+var ReactElement = _dereq_(57);
+var ReactInstanceMap = _dereq_(68);
+var ReactPerf = _dereq_(78);
+var ReactPropTypeLocations = _dereq_(81);
+var ReactPropTypeLocationNames = _dereq_(80);
+var ReactReconciler = _dereq_(84);
+var ReactUpdateQueue = _dereq_(95);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var invariant = _dereq_(161);
+var shouldUpdateReactComponent = _dereq_(141);
+var warning = _dereq_(173);
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
@@ -6698,6 +5787,12 @@
return '';
}
+function StatelessComponent(Component) {}
+StatelessComponent.prototype.render = function () {
+ var Component = ReactInstanceMap.get(this)._currentElement.type;
+ return Component(this.props, this.context, this.updater);
+};
+
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
@@ -6745,7 +5840,7 @@
* @final
* @internal
*/
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
@@ -6760,7 +5855,7 @@
this._context = null;
this._mountOrder = 0;
- this._isTopLevel = false;
+ this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
@@ -6775,32 +5870,54 @@
* @final
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
- var publicContext = this._processContext(this._currentElement._context);
+ var publicContext = this._processContext(context);
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ var Component = this._currentElement.type;
// Initialize the public class
- var inst = new Component(publicProps, publicContext);
+ var inst;
+ var renderedElement;
+
+ // This is a way to detect if Component is a stateless arrow function
+ // component, which is not newable. It might not be 100% reliable but is
+ // something we can do until we start detecting that Component extends
+ // React.Component. We already assume that typeof Component === 'function'.
+ var canInstantiate = ('prototype' in Component);
- if ("production" !== "development") {
+ if (canInstantiate) {
+ if ("development" !== 'production') {
+ ReactCurrentOwner.current = this;
+ try {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ } else {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ }
+ }
+
+ if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
+ renderedElement = inst;
+ inst = new StatelessComponent(Component);
+ }
+
+ if ("development" !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
- ("production" !== "development" ? 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'
- ) : null);
+ if (inst.render == null) {
+ "development" !== '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
+ "development" !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
+ }
}
// These should be set up in the constructor, but as a convenience for
@@ -6808,78 +5925,36 @@
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
+ inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
- if ("production" !== "development") {
- this._warnIfContextsDiffer(this._currentElement._context, context);
- }
-
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
- ("production" !== "development" ? warning(
- !inst.getInitialState ||
- inst.getInitialState.isReactClassApproved,
- 'getInitialState was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Did you mean to define a state property instead?',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.getDefaultProps ||
- inst.getDefaultProps.isReactClassApproved,
- 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Use a static property to define defaultProps instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.propTypes,
- 'propTypes was defined as an instance property on %s. Use a static ' +
- 'property to define propTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.contextTypes,
- 'contextTypes was defined as an instance property on %s. Use a ' +
- 'static property to define contextTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- typeof inst.componentShouldUpdate !== 'function',
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- (this.getName() || 'A component')
- ) : null);
+ "development" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
- ("production" !== "development" ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.state: must be set to an object or null',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
- var childContext;
- var renderedElement;
-
- var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
- ReactLifeCycle.currentlyMountingInstance = this;
- try {
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
@@ -6889,23 +5964,14 @@
}
}
- childContext = this._getValidatedChildContext(context);
- renderedElement = this._renderValidatedComponent(childContext);
- } finally {
- ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
+ // If not a stateless component, we now render
+ if (renderedElement === undefined) {
+ renderedElement = this._renderValidatedComponent();
}
- this._renderedComponent = this._instantiateReactComponent(
- renderedElement,
- this._currentElement.type // The wrapping type
- );
+ this._renderedComponent = this._instantiateReactComponent(renderedElement);
- var markup = ReactReconciler.mountComponent(
- this._renderedComponent,
- rootID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
@@ -6919,23 +5985,20 @@
* @final
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
- var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
- ReactLifeCycle.currentlyUnmountingInstance = this;
- try {
inst.componentWillUnmount();
- } finally {
- ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
- }
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
+ this._instance = null;
// Reset pending fields
+ // Even if this component is scheduled for another update in ReactUpdates,
+ // it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
@@ -6946,6 +6009,7 @@
// longer accessible.
this._context = null;
this._rootNodeID = null;
+ this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
@@ -6960,25 +6024,6 @@
},
/**
- * Schedule a partial update to the props. Only used for internal testing.
- *
- * @param {object} partialProps Subset of the next props.
- * @param {?function} callback Called after props are updated.
- * @final
- * @internal
- */
- _setPropsInternal: function(partialProps, callback) {
- // This is a deoptimized path. We optimize for always having an element.
- // This creates an extra internal element.
- var element = this._pendingElement || this._currentElement;
- this._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- assign({}, element.props, partialProps)
- );
- ReactUpdates.enqueueUpdate(this, callback);
- },
-
- /**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
@@ -6986,14 +6031,10 @@
* @return {?object}
* @private
*/
- _maskContext: function(context) {
+ _maskContext: function (context) {
var maskedContext = null;
- // This really should be getting the component class for the element,
- // but we know that we're not going to need it for built-ins.
- if (typeof this._currentElement.type === 'string') {
- return emptyObject;
- }
- var contextTypes = this._currentElement.type.contextTypes;
+ var Component = this._currentElement.type;
+ var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
@@ -7012,18 +6053,12 @@
* @return {?object}
* @private
*/
- _processContext: function(context) {
+ _processContext: function (context) {
var maskedContext = this._maskContext(context);
- if ("production" !== "development") {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ if ("development" !== 'production') {
+ var Component = this._currentElement.type;
if (Component.contextTypes) {
- this._checkPropTypes(
- Component.contextTypes,
- maskedContext,
- ReactPropTypeLocations.context
- );
+ this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
@@ -7034,38 +6069,18 @@
* @return {object}
* @private
*/
- _getValidatedChildContext: function(currentContext) {
+ _processChildContext: function (currentContext) {
+ var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
- ("production" !== "development" ? invariant(
- typeof inst.constructor.childContextTypes === 'object',
- '%s.getChildContext(): childContextTypes must be defined in order to ' +
- 'use getChildContext().',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
- if ("production" !== "development") {
- this._checkPropTypes(
- inst.constructor.childContextTypes,
- childContext,
- ReactPropTypeLocations.childContext
- );
+ !(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ if ("development" !== 'production') {
+ this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
- ("production" !== "development" ? invariant(
- name in inst.constructor.childContextTypes,
- '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
- this.getName() || 'ReactCompositeComponent',
- name
- ) : invariant(name in inst.constructor.childContextTypes));
- }
- return childContext;
+ !(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
- return null;
- },
-
- _mergeChildContext: function(currentContext, childContext) {
- if (childContext) {
return assign({}, currentContext, childContext);
}
return currentContext;
@@ -7080,17 +6095,11 @@
* @return {object}
* @private
*/
- _processProps: function(newProps) {
- if ("production" !== "development") {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ _processProps: function (newProps) {
+ if ("development" !== 'production') {
+ var Component = this._currentElement.type;
if (Component.propTypes) {
- this._checkPropTypes(
- Component.propTypes,
- newProps,
- ReactPropTypeLocations.prop
- );
+ this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
@@ -7104,7 +6113,7 @@
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
- _checkPropTypes: function(propTypes, props, location) {
+ _checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
@@ -7114,58 +6123,35 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== "development" ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually ' +
- 'from React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// 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
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
- ("production" !== "development" ? warning(
- false,
- 'Failed Composite propType: %s%s',
- error.message,
- addendum
- ) : null);
+ "development" !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
- ("production" !== "development" ? warning(
- false,
- 'Failed Context Types: %s%s',
- error.message,
- addendum
- ) : null);
+ "development" !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
- receiveComponent: function(nextElement, transaction, nextContext) {
+ receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
- this.updateComponent(
- transaction,
- prevElement,
- nextElement,
- prevContext,
- nextContext
- );
+ this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
@@ -7175,54 +6161,13 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(transaction) {
+ performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
- ReactReconciler.receiveComponent(
- this,
- this._pendingElement || this._currentElement,
- transaction,
- this._context
- );
+ ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(
- this._currentElement
- );
- }
-
- this.updateComponent(
- transaction,
- this._currentElement,
- this._currentElement,
- this._context,
- this._context
- );
- }
- },
-
- /**
- * Compare two contexts, warning if they are different
- * TODO: Remove this check when owner-context is removed
- */
- _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
- ownerBasedContext = this._maskContext(ownerBasedContext);
- parentBasedContext = this._maskContext(parentBasedContext);
- var parentKeys = Object.keys(parentBasedContext).sort();
- var displayName = this.getName() || 'ReactCompositeComponent';
- for (var i = 0; i < parentKeys.length; i++) {
- var key = parentKeys[i];
- ("production" !== "development" ? warning(
- ownerBasedContext[key] === parentBasedContext[key],
- 'owner-based and parent-based contexts differ ' +
- '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
- '(see: http://fb.me/react-context-by-parent)',
- ownerBasedContext[key],
- parentBasedContext[key],
- key,
- displayName
- ) : null);
+ this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
@@ -7241,32 +6186,19 @@
* @internal
* @overridable
*/
- updateComponent: function(
- transaction,
- prevParentElement,
- nextParentElement,
- prevUnmaskedContext,
- nextUnmaskedContext
- ) {
+ updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
- var nextContext = inst.context;
- var nextProps = inst.props;
+ var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
+ var nextProps;
// Distinguish between a props update versus a simple state update
- if (prevParentElement !== nextParentElement) {
- nextContext = this._processContext(nextParentElement._context);
+ if (prevParentElement === nextParentElement) {
+ // Skip checking prop types again -- we don't read inst.props to avoid
+ // warning for DOM component props in this upgrade
+ nextProps = nextParentElement.props;
+ } else {
nextProps = this._processProps(nextParentElement.props);
-
- if ("production" !== "development") {
- if (nextUnmaskedContext != null) {
- this._warnIfContextsDiffer(
- nextParentElement._context,
- nextUnmaskedContext
- );
- }
- }
-
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
@@ -7278,31 +6210,16 @@
var nextState = this._processPendingState(nextProps, nextContext);
- var shouldUpdate =
- this._pendingForceUpdate ||
- !inst.shouldComponentUpdate ||
- inst.shouldComponentUpdate(nextProps, nextState, nextContext);
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- typeof shouldUpdate !== 'undefined',
- '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
- 'boolean value. Make sure to return true or false.',
- this.getName() || 'ReactCompositeComponent'
- ) : null);
+ var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
- this._performComponentUpdate(
- nextParentElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- nextUnmaskedContext
- );
+ this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
@@ -7314,7 +6231,7 @@
}
},
- _processPendingState: function(props, context) {
+ _processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
@@ -7332,12 +6249,7 @@
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
- assign(
- nextState,
- typeof partial === 'function' ?
- partial.call(inst, nextState, props, context) :
- partial
- );
+ assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
@@ -7355,19 +6267,18 @@
* @param {?object} unmaskedContext
* @private
*/
- _performComponentUpdate: function(
- nextElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- unmaskedContext
- ) {
+ _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
- var prevProps = inst.props;
- var prevState = inst.state;
- var prevContext = inst.context;
+ var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
+ var prevProps;
+ var prevState;
+ var prevContext;
+ if (hasComponentDidUpdate) {
+ prevProps = inst.props;
+ prevState = inst.state;
+ prevContext = inst.context;
+ }
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
@@ -7381,11 +6292,8 @@
this._updateRenderedComponent(transaction, unmaskedContext);
- if (inst.componentDidUpdate) {
- transaction.getReactMountReady().enqueue(
- inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
- inst
- );
+ if (hasComponentDidUpdate) {
+ transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
@@ -7395,34 +6303,20 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- _updateRenderedComponent: function(transaction, context) {
+ _updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
- var childContext = this._getValidatedChildContext();
- var nextRenderedElement = this._renderValidatedComponent(childContext);
+ var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
- ReactReconciler.receiveComponent(
- prevComponentInstance,
- nextRenderedElement,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
- this._renderedComponent = this._instantiateReactComponent(
- nextRenderedElement,
- this._currentElement.type
- );
- var nextMarkup = ReactReconciler.mountComponent(
- this._renderedComponent,
- thisID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
@@ -7430,23 +6324,19 @@
/**
* @protected
*/
- _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
- ReactComponentEnvironment.replaceNodeWithMarkupByID(
- prevComponentID,
- nextMarkup
- );
+ _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
+ ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
- _renderValidatedComponentWithoutOwnerOrContext: function() {
+ _renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof renderedComponent === 'undefined' &&
- inst.render._isMockFunction) {
+ if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
@@ -7459,31 +6349,17 @@
/**
* @private
*/
- _renderValidatedComponent: function(childContext) {
+ _renderValidatedComponent: function () {
var renderedComponent;
- var previousContext = ReactContext.current;
- ReactContext.current = this._mergeChildContext(
- this._currentElement._context,
- childContext
- );
ReactCurrentOwner.current = this;
try {
- renderedComponent =
- this._renderValidatedComponentWithoutOwnerOrContext();
+ renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
- ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
- ("production" !== "development" ? invariant(
+ !(
// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent),
- '%s.render(): A valid ReactComponent must be returned. You may have ' +
- 'returned undefined, an array or some other invalid object.',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent)));
+ renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? "development" !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
@@ -7495,10 +6371,16 @@
* @final
* @private
*/
- attachRef: function(ref, component) {
+ attachRef: function (ref, component) {
var inst = this.getPublicInstance();
- var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
- refs[ref] = component.getPublicInstance();
+ !(inst != null) ? "development" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
+ var publicComponentInstance = component.getPublicInstance();
+ if ("development" !== 'production') {
+ var componentName = component && component.getName ? component.getName() : 'a component';
+ "development" !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
+ }
+ var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
+ refs[ref] = publicComponentInstance;
},
/**
@@ -7508,7 +6390,7 @@
* @final
* @private
*/
- detachRef: function(ref) {
+ detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
@@ -7519,26 +6401,26 @@
* @return {string} The name or null.
* @internal
*/
- getName: function() {
+ getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
- return (
- type.displayName || (constructor && constructor.displayName) ||
- type.name || (constructor && constructor.name) ||
- null
- );
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* 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.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
- getPublicInstance: function() {
- return this._instance;
+ getPublicInstance: function () {
+ var inst = this._instance;
+ if (inst instanceof StatelessComponent) {
+ return null;
+ }
+ return inst;
},
// Stub
@@ -7546,15 +6428,11 @@
};
-ReactPerf.measureMethods(
- ReactCompositeComponentMixin,
- 'ReactCompositeComponent',
- {
+ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
- }
-);
+});
var ReactCompositeComponent = {
@@ -7563,84 +6441,7 @@
};
module.exports = ReactCompositeComponent;
-
-},{"100":100,"130":130,"150":150,"167":167,"171":171,"29":29,"41":41,"44":44,"45":45,"63":63,"64":64,"73":73,"74":74,"80":80,"82":82,"84":84,"85":85,"89":89}],44:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactContext
- */
-
-'use strict';
-
-var assign = _dereq_(29);
-var emptyObject = _dereq_(130);
-var warning = _dereq_(171);
-
-var didWarn = false;
-
-/**
- * Keeps track of the current context.
- *
- * The context is automatically passed down the component ownership hierarchy
- * and is accessible via `this.context` on ReactCompositeComponents.
- */
-var ReactContext = {
-
- /**
- * @internal
- * @type {object}
- */
- current: emptyObject,
-
- /**
- * Temporarily extends the current context while executing scopedCallback.
- *
- * A typical use case might look like
- *
- * render: function() {
- * var children = ReactContext.withContext({foo: 'foo'}, () => (
- *
- * ));
- * return <div>{children}</div>;
- * }
- *
- * @param {object} newContext New context to merge into the existing context
- * @param {function} scopedCallback Callback to run with the new context
- * @return {ReactComponent|array<ReactComponent>}
- */
- withContext: function(newContext, scopedCallback) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- didWarn,
- 'withContext is deprecated and will be removed in a future version. ' +
- 'Use a wrapper component with getChildContext instead.'
- ) : null);
-
- didWarn = true;
- }
-
- var result;
- var previousContext = ReactContext.current;
- ReactContext.current = assign({}, previousContext, newContext);
- try {
- result = scopedCallback();
- } finally {
- ReactContext.current = previousContext;
- }
- return result;
- }
-
-};
-
-module.exports = ReactContext;
-
-},{"130":130,"171":171,"29":29}],45:[function(_dereq_,module,exports){
+},{"141":141,"154":154,"161":161,"173":173,"24":24,"36":36,"39":39,"57":57,"68":68,"78":78,"80":80,"81":81,"84":84,"95":95}],39:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7659,8 +6460,6 @@
*
* The current owner is the component who should own any components that are
* currently being constructed.
- *
- * The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {
@@ -7673,8 +6472,7 @@
};
module.exports = ReactCurrentOwner;
-
-},{}],46:[function(_dereq_,module,exports){
+},{}],40:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7684,174 +6482,90 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
- * @typechecks static-only
*/
+/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
+
'use strict';
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
+var ReactCurrentOwner = _dereq_(39);
+var ReactDOMTextComponent = _dereq_(51);
+var ReactDefaultInjection = _dereq_(54);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMount = _dereq_(72);
+var ReactPerf = _dereq_(78);
+var ReactReconciler = _dereq_(84);
+var ReactUpdates = _dereq_(96);
+var ReactVersion = _dereq_(97);
+
+var findDOMNode = _dereq_(122);
+var renderSubtreeIntoContainer = _dereq_(137);
+var warning = _dereq_(173);
-var mapObject = _dereq_(158);
+ReactDefaultInjection.inject();
-/**
- * Create a factory that creates HTML tag elements.
- *
- * @param {string} tag Tag name (e.g. `div`).
- * @private
- */
-function createDOMFactory(tag) {
- if ("production" !== "development") {
- return ReactElementValidator.createFactory(tag);
- }
- return ReactElement.createFactory(tag);
+var render = ReactPerf.measure('React', 'render', ReactMount.render);
+
+var React = {
+ findDOMNode: findDOMNode,
+ render: render,
+ unmountComponentAtNode: ReactMount.unmountComponentAtNode,
+ version: ReactVersion,
+
+ /* eslint-disable camelcase */
+ unstable_batchedUpdates: ReactUpdates.batchedUpdates,
+ unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
+};
+
+// Inject the runtime into a devtools global hook regardless of browser.
+// Allows for debugging when the hook is injected on the page.
+/* eslint-enable camelcase */
+if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
+ CurrentOwner: ReactCurrentOwner,
+ InstanceHandles: ReactInstanceHandles,
+ Mount: ReactMount,
+ Reconciler: ReactReconciler,
+ TextComponent: ReactDOMTextComponent
+ });
}
-/**
- * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
- * This is also accessible via `React.DOM`.
- *
- * @public
- */
-var ReactDOM = mapObject({
- a: 'a',
- abbr: 'abbr',
- address: 'address',
- area: 'area',
- article: 'article',
- aside: 'aside',
- audio: 'audio',
- b: 'b',
- base: 'base',
- bdi: 'bdi',
- bdo: 'bdo',
- big: 'big',
- blockquote: 'blockquote',
- body: 'body',
- br: 'br',
- button: 'button',
- canvas: 'canvas',
- caption: 'caption',
- cite: 'cite',
- code: 'code',
- col: 'col',
- colgroup: 'colgroup',
- data: 'data',
- datalist: 'datalist',
- dd: 'dd',
- del: 'del',
- details: 'details',
- dfn: 'dfn',
- dialog: 'dialog',
- div: 'div',
- dl: 'dl',
- dt: 'dt',
- em: 'em',
- embed: 'embed',
- fieldset: 'fieldset',
- figcaption: 'figcaption',
- figure: 'figure',
- footer: 'footer',
- form: 'form',
- h1: 'h1',
- h2: 'h2',
- h3: 'h3',
- h4: 'h4',
- h5: 'h5',
- h6: 'h6',
- head: 'head',
- header: 'header',
- hr: 'hr',
- html: 'html',
- i: 'i',
- iframe: 'iframe',
- img: 'img',
- input: 'input',
- ins: 'ins',
- kbd: 'kbd',
- keygen: 'keygen',
- label: 'label',
- legend: 'legend',
- li: 'li',
- link: 'link',
- main: 'main',
- map: 'map',
- mark: 'mark',
- menu: 'menu',
- menuitem: 'menuitem',
- meta: 'meta',
- meter: 'meter',
- nav: 'nav',
- noscript: 'noscript',
- object: 'object',
- ol: 'ol',
- optgroup: 'optgroup',
- option: 'option',
- output: 'output',
- p: 'p',
- param: 'param',
- picture: 'picture',
- pre: 'pre',
- progress: 'progress',
- q: 'q',
- rp: 'rp',
- rt: 'rt',
- ruby: 'ruby',
- s: 's',
- samp: 'samp',
- script: 'script',
- section: 'section',
- select: 'select',
- small: 'small',
- source: 'source',
- span: 'span',
- strong: 'strong',
- style: 'style',
- sub: 'sub',
- summary: 'summary',
- sup: 'sup',
- table: 'table',
- tbody: 'tbody',
- td: 'td',
- textarea: 'textarea',
- tfoot: 'tfoot',
- th: 'th',
- thead: 'thead',
- time: 'time',
- title: 'title',
- tr: 'tr',
- track: 'track',
- u: 'u',
- ul: 'ul',
- 'var': 'var',
- video: 'video',
- wbr: 'wbr',
+if ("development" !== 'production') {
+ var ExecutionEnvironment = _dereq_(147);
+ if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
- // SVG
- circle: 'circle',
- clipPath: 'clipPath',
- defs: 'defs',
- ellipse: 'ellipse',
- g: 'g',
- line: 'line',
- linearGradient: 'linearGradient',
- mask: 'mask',
- path: 'path',
- pattern: 'pattern',
- polygon: 'polygon',
- polyline: 'polyline',
- radialGradient: 'radialGradient',
- rect: 'rect',
- stop: 'stop',
- svg: 'svg',
- text: 'text',
- tspan: 'tspan'
+ // 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');
+ }
+ }
-}, createDOMFactory);
+ // If we're in IE8, check to see if we are in compatibility mode and provide
+ // information on preventing compatibility mode
+ var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
-module.exports = ReactDOM;
+ "development" !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
+
+ var expectedFeatures = [
+ // shims
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
+
+ // shams
+ Object.create, Object.freeze];
-},{"158":158,"63":63,"64":64}],47:[function(_dereq_,module,exports){
+ for (var i = 0; i < expectedFeatures.length; i++) {
+ if (!expectedFeatures[i]) {
+ console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
+ break;
+ }
+ }
+ }
+}
+
+module.exports = React;
+},{"122":122,"137":137,"147":147,"173":173,"39":39,"51":51,"54":54,"67":67,"72":72,"78":78,"84":84,"96":96,"97":97}],41:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7865,16 +6579,7 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var keyMirror = _dereq_(156);
-
-var button = ReactElement.createFactory('button');
-
-var mouseListenerNames = keyMirror({
+var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
@@ -7880,42 +6585,38 @@
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
+
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
-});
+};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
-var ReactDOMButton = ReactClass.createClass({
- displayName: 'ReactDOMButton',
- tagName: 'BUTTON',
-
- mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
-
- render: function() {
- var props = {};
+var ReactDOMButton = {
+ getNativeProps: function (inst, props, context) {
+ if (!props.disabled) {
+ return props;
+ }
- // Copy the props; except the mouse listeners if we're disabled
- for (var key in this.props) {
- if (this.props.hasOwnProperty(key) &&
- (!this.props.disabled || !mouseListenerNames[key])) {
- props[key] = this.props[key];
+ // Copy the props, except the mouse listeners
+ var nativeProps = {};
+ for (var key in props) {
+ if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
+ nativeProps[key] = props[key];
}
}
- return button(props, this.props.children);
+ return nativeProps;
}
-
-});
+};
module.exports = ReactDOMButton;
-
-},{"156":156,"2":2,"32":32,"38":38,"63":63}],48:[function(_dereq_,module,exports){
+},{}],42:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7932,104 +6633,293 @@
'use strict';
-var CSSPropertyOperations = _dereq_(6);
-var DOMProperty = _dereq_(11);
-var DOMPropertyOperations = _dereq_(12);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactComponentBrowserEnvironment =
- _dereq_(40);
-var ReactMount = _dereq_(77);
-var ReactMultiChild = _dereq_(78);
-var ReactPerf = _dereq_(82);
-
-var assign = _dereq_(29);
-var escapeTextContentForBrowser = _dereq_(131);
-var invariant = _dereq_(150);
-var isEventSupported = _dereq_(151);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var AutoFocusUtils = _dereq_(2);
+var CSSPropertyOperations = _dereq_(5);
+var DOMProperty = _dereq_(10);
+var DOMPropertyOperations = _dereq_(11);
+var EventConstants = _dereq_(15);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactComponentBrowserEnvironment = _dereq_(35);
+var ReactDOMButton = _dereq_(41);
+var ReactDOMInput = _dereq_(46);
+var ReactDOMOption = _dereq_(47);
+var ReactDOMSelect = _dereq_(48);
+var ReactDOMTextarea = _dereq_(52);
+var ReactMount = _dereq_(72);
+var ReactMultiChild = _dereq_(73);
+var ReactPerf = _dereq_(78);
+var ReactUpdateQueue = _dereq_(95);
+
+var assign = _dereq_(24);
+var canDefineProperty = _dereq_(117);
+var escapeTextContentForBrowser = _dereq_(121);
+var invariant = _dereq_(161);
+var isEventSupported = _dereq_(133);
+var keyOf = _dereq_(166);
+var setInnerHTML = _dereq_(138);
+var setTextContent = _dereq_(139);
+var shallowEqual = _dereq_(171);
+var validateDOMNesting = _dereq_(144);
+var warning = _dereq_(173);
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
-var CONTENT_TYPES = {'string': true, 'number': true};
+var CONTENT_TYPES = { 'string': true, 'number': true };
-var STYLE = keyOf({style: null});
+var CHILDREN = keyOf({ children: null });
+var STYLE = keyOf({ style: null });
+var HTML = keyOf({ __html: null });
var ELEMENT_NODE_TYPE = 1;
-/**
- * Optionally injectable operations for mutating the DOM
- */
-var BackendIDOperations = null;
+function getDeclarationErrorAddendum(internalInstance) {
+ if (internalInstance) {
+ var owner = internalInstance._currentElement._owner || null;
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' This DOM node was rendered by `' + name + '`.';
+ }
+ }
+ }
+ return '';
+}
+
+var legacyPropsDescriptor;
+if ("development" !== 'production') {
+ legacyPropsDescriptor = {
+ props: {
+ enumerable: false,
+ get: function () {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
+ return component._currentElement.props;
+ }
+ }
+ };
+}
+
+function legacyGetDOMNode() {
+ if ("development" !== 'production') {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return this;
+}
+
+function legacyIsMounted() {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return !!component;
+}
+
+function legacySetStateEtc() {
+ if ("development" !== 'production') {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+}
+
+function legacySetProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== '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;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function legacyReplaceProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== '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;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function friendlyStringify(obj) {
+ if (typeof obj === 'object') {
+ if (Array.isArray(obj)) {
+ return '[' + obj.map(friendlyStringify).join(', ') + ']';
+ } else {
+ var pairs = [];
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
+ pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
+ }
+ }
+ return '{' + pairs.join(', ') + '}';
+ }
+ } else if (typeof obj === 'string') {
+ return JSON.stringify(obj);
+ } else if (typeof obj === 'function') {
+ return '[function object]';
+ }
+ // Differs from JSON.stringify in that undefined becauses undefined and that
+ // inf and nan don't become null
+ return String(obj);
+}
+
+var styleMutationWarning = {};
+
+function checkAndWarnForMutatedStyle(style1, style2, component) {
+ if (style1 == null || style2 == null) {
+ return;
+ }
+ if (shallowEqual(style1, style2)) {
+ return;
+ }
+
+ var componentName = component._tag;
+ var owner = component._currentElement._owner;
+ var ownerName;
+ if (owner) {
+ ownerName = owner.getName();
+ }
+
+ var hash = ownerName + '|' + componentName;
+
+ if (styleMutationWarning.hasOwnProperty(hash)) {
+ return;
+ }
+
+ styleMutationWarning[hash] = true;
+
+ "development" !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
+}
/**
+ * @param {object} component
* @param {?object} props
*/
-function assertValidProps(props) {
+function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
+ if ("development" !== 'production') {
+ if (voidElementTags[component._tag]) {
+ "development" !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
+ }
+ }
if (props.dangerouslySetInnerHTML != null) {
- ("production" !== "development" ? invariant(
- props.children == null,
- 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
- ) : invariant(props.children == null));
- ("production" !== "development" ? invariant(
- typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML,
- '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
- 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
- 'for more information.'
- ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML));
- }
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- props.innerHTML == null,
- 'Directly setting property `innerHTML` is not permitted. ' +
- 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
- ) : null);
- ("production" !== "development" ? warning(
- !props.contentEditable || props.children == null,
- 'A component is `contentEditable` and contains `children` managed by ' +
- 'React. It is now your responsibility to guarantee that none of ' +
- 'those nodes are unexpectedly modified or duplicated. This is ' +
- 'probably not intentional.'
- ) : null);
- }
- ("production" !== "development" ? invariant(
- props.style == null || typeof props.style === 'object',
- 'The `style` prop expects a mapping from style properties to values, ' +
- 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
- 'using JSX.'
- ) : invariant(props.style == null || typeof props.style === 'object'));
+ !(props.children == null) ? "development" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? "development" !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
+ }
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
+ "development" !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
+ }
+ !(props.style == null || typeof props.style === 'object') ? "development" !== '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;
}
-function putListener(id, registrationName, listener, transaction) {
- if ("production" !== "development") {
+function enqueuePutListener(id, registrationName, listener, transaction) {
+ if ("development" !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
- ("production" !== "development" ? warning(
- registrationName !== 'onScroll' || isEventSupported('scroll', true),
- 'This browser doesn\'t support the `onScroll` event'
- ) : null);
+ "development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
- var doc = container.nodeType === ELEMENT_NODE_TYPE ?
- container.ownerDocument :
- container;
+ var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
- transaction.getPutListenerQueue().enqueuePutListener(
- id,
- registrationName,
- listener
- );
+ transaction.getReactMountReady().enqueue(putListener, {
+ id: id,
+ registrationName: registrationName,
+ listener: listener
+ });
+}
+
+function putListener() {
+ var listenerToPut = this;
+ ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
+}
+
+// There are so many media events, it makes sense to just
+// maintain a list rather than create a `trapBubbledEvent` for each
+var mediaEvents = {
+ topAbort: 'abort',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
+ topTimeUpdate: 'timeupdate',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting'
+};
+
+function trapBubbledEventsLocal() {
+ var inst = this;
+ // If a component renders to null or if another component fatals and causes
+ // the state of the tree to be corrupted, `node` here can be null.
+ !inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
+ var node = ReactMount.getNode(inst._rootNodeID);
+ !node ? "development" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
+
+ switch (inst._tag) {
+ case 'iframe':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'video':
+ case 'audio':
+
+ inst._wrapperState.listeners = [];
+ // create listener for each media event
+ for (var event in mediaEvents) {
+ if (mediaEvents.hasOwnProperty(event)) {
+ inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
+ }
+ }
+
+ break;
+ case 'img':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'form':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
+ break;
+ }
+}
+
+function mountReadyInputWrapper() {
+ ReactDOMInput.mountReadyWrapper(this);
+}
+
+function postUpdateSelectWrapper() {
+ ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
@@ -8051,24 +6941,49 @@
'source': true,
'track': true,
'wbr': true
- // NOTE: menuitem's close tag should be omitted, but that causes problems.
};
-// We accept any tag to be rendered but since this gets injected into abitrary
+// NOTE: menuitem's close tag should be omitted, but that causes problems.
+var newlineEatingTags = {
+ 'listing': true,
+ 'pre': true,
+ 'textarea': true
+};
+
+// For HTML, certain tags cannot have children. This has the same purpose as
+// `omittedCloseTags` except that `menuitem` should still have its closing tag.
+
+var voidElementTags = assign({
+ 'menuitem': true
+}, omittedCloseTags);
+
+// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
-var hasOwnProperty = {}.hasOwnProperty;
+var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
- ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
+ !VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
+function processChildContextDev(context, inst) {
+ // Pass down our tag name to child components for validation purposes
+ context = assign({}, context);
+ var info = context[validateDOMNesting.ancestorInfoContextKey];
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
+ return context;
+}
+
+function isCustomComponent(tagName, props) {
+ return tagName.indexOf('-') >= 0 || props.is != null;
+}
+
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
@@ -8085,17 +7000,25 @@
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
- this._tag = tag;
+ this._tag = tag.toLowerCase();
this._renderedChildren = null;
+ this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
+ this._wrapperState = null;
+ this._topLevelWrapper = null;
+ this._nodeWithLegacyProperties = null;
+ if ("development" !== 'production') {
+ this._unprocessedContextDev = null;
+ this._processedContextDev = null;
+ }
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
},
@@ -8106,17 +7029,94 @@
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
* @return {string} The computed markup.
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
- assertValidProps(this._currentElement.props);
- var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
- return (
- this._createOpenTagMarkupAndPutListeners(transaction) +
- this._createContentMarkup(transaction, context) +
- closeTag
- );
+
+ var props = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ this._wrapperState = {
+ listeners: null
+ };
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
+ break;
+ case 'button':
+ props = ReactDOMButton.getNativeProps(this, props, context);
+ break;
+ case 'input':
+ ReactDOMInput.mountWrapper(this, props, context);
+ props = ReactDOMInput.getNativeProps(this, props, context);
+ break;
+ case 'option':
+ ReactDOMOption.mountWrapper(this, props, context);
+ props = ReactDOMOption.getNativeProps(this, props, context);
+ break;
+ case 'select':
+ ReactDOMSelect.mountWrapper(this, props, context);
+ props = ReactDOMSelect.getNativeProps(this, props, context);
+ context = ReactDOMSelect.processChildContext(this, props, context);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.mountWrapper(this, props, context);
+ props = ReactDOMTextarea.getNativeProps(this, props, context);
+ break;
+ }
+
+ assertValidProps(this, props);
+ if ("development" !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
+ if ("development" !== 'production') {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ context = this._processedContextDev;
+ }
+
+ 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 + '>';
+ }
+ }
+
+ switch (this._tag) {
+ case 'input':
+ transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
+ // falls through
+ case 'button':
+ case 'select':
+ case 'textarea':
+ if (props.autoFocus) {
+ transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
+ }
+ break;
+ }
+
+ return mountImage;
},
/**
@@ -8129,11 +7129,11 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @return {string} Markup of opening tag.
*/
- _createOpenTagMarkupAndPutListeners: function(transaction) {
- var props = this._currentElement.props;
- var ret = '<' + this._tag;
+ _createOpenTagMarkupAndPutListeners: function (transaction, props) {
+ var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
@@ -8144,16 +7144,28 @@
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, propValue, transaction);
+ if (propValue) {
+ enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
+ }
} else {
if (propKey === STYLE) {
if (propValue) {
+ if ("development" !== 'production') {
+ // See `_updateDOMProperties`. style block
+ this._previousStyle = propValue;
+ }
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
- var markup =
- DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ var markup = null;
+ if (this._tag != null && isCustomComponent(this._tag, props)) {
+ if (propKey !== CHILDREN) {
+ markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
+ }
+ } else {
+ markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ }
if (markup) {
ret += ' ' + markup;
}
@@ -8163,11 +7175,11 @@
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
- return ret + '>';
+ return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
- return ret + ' ' + markupForID + '>';
+ return ret + ' ' + markupForID;
},
/**
@@ -8175,47 +7187,78 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
- _createContentMarkup: function(transaction, context) {
- var prefix = '';
- if (this._tag === 'listing' ||
- this._tag === 'pre' ||
- this._tag === 'textarea') {
- // Add an initial newline because browsers ignore the first newline in
- // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
- prefix = '\n';
- }
+ _createContentMarkup: function (transaction, props, context) {
+ var ret = '';
- var props = this._currentElement.props;
+ // Intentional use of != to avoid catching zero/false.
+ var innerHTML = props.dangerouslySetInnerHTML;
+ if (innerHTML != null) {
+ if (innerHTML.__html != null) {
+ ret = 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
+ ret = escapeTextContentForBrowser(contentToUse);
+ } else if (childrenToUse != null) {
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ ret = mountImages.join('');
+ }
+ }
+ if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
+ // text/html ignores the first character in these tags if it's a newline
+ // Prefer to break application/xml over text/html (for now) by adding
+ // a newline specifically to get eaten by the parser. (Alternately for
+ // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
+ // \r is normalized out by HTMLTextAreaElement#value.)
+ // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
+ // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
+ // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
+ // See: Parsing of "textarea" "listing" and "pre" elements
+ // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
+ return '\n' + ret;
+ } else {
+ return ret;
+ }
+ },
+ _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) {
- return prefix + innerHTML.__html;
+ setInnerHTML(el, innerHTML.__html);
}
} else {
- var contentToUse =
- CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
- return prefix + escapeTextContentForBrowser(contentToUse);
+ // 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,
- context
- );
- return prefix + mountImages.join('');
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ for (var i = 0; i < mountImages.length; i++) {
+ el.appendChild(mountImages[i]);
+ }
}
}
- return prefix;
},
- receiveComponent: function(nextElement, transaction, context) {
+ /**
+ * Receives a next element and updates the component.
+ *
+ * @internal
+ * @param {ReactElement} nextElement
+ * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
+ */
+ receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
@@ -8231,10 +7274,59 @@
* @internal
* @overridable
*/
- updateComponent: function(transaction, prevElement, nextElement, context) {
- assertValidProps(this._currentElement.props);
- this._updateDOMProperties(prevElement.props, transaction);
- this._updateDOMChildren(prevElement.props, transaction, context);
+ updateComponent: function (transaction, prevElement, nextElement, context) {
+ var lastProps = prevElement.props;
+ var nextProps = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'button':
+ lastProps = ReactDOMButton.getNativeProps(this, lastProps);
+ nextProps = ReactDOMButton.getNativeProps(this, nextProps);
+ break;
+ case 'input':
+ ReactDOMInput.updateWrapper(this);
+ lastProps = ReactDOMInput.getNativeProps(this, lastProps);
+ nextProps = ReactDOMInput.getNativeProps(this, nextProps);
+ break;
+ case 'option':
+ lastProps = ReactDOMOption.getNativeProps(this, lastProps);
+ nextProps = ReactDOMOption.getNativeProps(this, nextProps);
+ break;
+ case 'select':
+ lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
+ nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.updateWrapper(this);
+ lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
+ nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
+ break;
+ }
+
+ if ("development" !== 'production') {
+ // If the context is reference-equal to the old one, pass down the same
+ // processed object so the update bailout in ReactReconciler behaves
+ // correctly (and identically in dev and prod). See #5005.
+ if (this._unprocessedContextDev !== context) {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ }
+ context = this._processedContextDev;
+ }
+
+ assertValidProps(this, nextProps);
+ this._updateDOMProperties(lastProps, nextProps, transaction, null);
+ this._updateDOMChildren(lastProps, nextProps, transaction, context);
+
+ if (!canDefineProperty && this._nodeWithLegacyProperties) {
+ this._nodeWithLegacyProperties.props = nextProps;
+ }
+
+ if (this._tag === 'select') {
+ // <select> value update needs to occur after <option> children
+ // reconciliation
+ transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
+ }
},
/**
@@ -8250,16 +7342,16 @@
*
* @private
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {?DOMElement} node
*/
- _updateDOMProperties: function(lastProps, transaction) {
- var nextProps = this._currentElement.props;
+ _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
- if (nextProps.hasOwnProperty(propKey) ||
- !lastProps.hasOwnProperty(propKey)) {
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
@@ -8272,26 +7364,31 @@
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (lastProps[propKey]) {
+ // Only call deleteListener if there was a listener previously or
+ // else willDeleteListener gets called when there wasn't actually a
+ // listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.deletePropertyByID(
- this._rootNodeID,
- propKey
- );
+ }
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
- var lastProp = propKey === STYLE ?
- this._previousStyleCopy :
- lastProps[propKey];
+ var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
+ if ("development" !== 'production') {
+ checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
+ this._previousStyle = nextProp;
+ }
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
@@ -8299,16 +7396,14 @@
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
- if (lastProp.hasOwnProperty(styleName) &&
- (!nextProp || !nextProp.hasOwnProperty(styleName))) {
+ if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
- if (nextProp.hasOwnProperty(styleName) &&
- lastProp[styleName] !== nextProp[styleName]) {
+ if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
@@ -8318,22 +7413,38 @@
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, nextProp, transaction);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.updatePropertyByID(
- this._rootNodeID,
- propKey,
- nextProp
- );
+ if (nextProp) {
+ enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
+ } else if (lastProp) {
+ deleteListener(this._rootNodeID, propKey);
+ }
+ } else if (isCustomComponent(this._tag, nextProps)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ if (propKey === CHILDREN) {
+ nextProp = null;
+ }
+ DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ 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);
}
},
@@ -8342,22 +7453,16 @@
* children content.
*
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {object} context
*/
- _updateDOMChildren: function(lastProps, transaction, context) {
- var nextProps = this._currentElement.props;
+ _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
+ var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
+ var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
- var lastContent =
- CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
- var nextContent =
- CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
-
- var lastHtml =
- lastProps.dangerouslySetInnerHTML &&
- lastProps.dangerouslySetInnerHTML.__html;
- var nextHtml =
- nextProps.dangerouslySetInnerHTML &&
- nextProps.dangerouslySetInnerHTML.__html;
+ var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
+ var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
@@ -8379,10 +7484,7 @@
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
- BackendIDOperations.updateInnerHTMLByID(
- this._rootNodeID,
- nextHtml
- );
+ this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
@@ -8395,11 +7497,76 @@
*
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ var listeners = this._wrapperState.listeners;
+ if (listeners) {
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i].remove();
+ }
+ }
+ break;
+ case 'input':
+ ReactDOMInput.unmountWrapper(this);
+ break;
+ case 'html':
+ case 'head':
+ case 'body':
+ /**
+ * Components like <html> <head> and <body> can't be removed or added
+ * easily in a cross-browser way, however it's valuable to be able to
+ * take advantage of React's reconciliation for styling and <title>
+ * management. So we just document it and throw in dangerous cases.
+ */
+ !false ? "development" !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
+ break;
+ }
+
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
+ this._wrapperState = null;
+ if (this._nodeWithLegacyProperties) {
+ var node = this._nodeWithLegacyProperties;
+ node._reactInternalComponent = null;
+ this._nodeWithLegacyProperties = null;
+ }
+ },
+
+ getPublicInstance: function () {
+ if (!this._nodeWithLegacyProperties) {
+ var node = ReactMount.getNode(this._rootNodeID);
+
+ node._reactInternalComponent = this;
+ node.getDOMNode = legacyGetDOMNode;
+ node.isMounted = legacyIsMounted;
+ node.setState = legacySetStateEtc;
+ node.replaceState = legacySetStateEtc;
+ node.forceUpdate = legacySetStateEtc;
+ node.setProps = legacySetProps;
+ node.replaceProps = legacyReplaceProps;
+
+ if ("development" !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperties(node, legacyPropsDescriptor);
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+
+ this._nodeWithLegacyProperties = node;
+ }
+ return this._nodeWithLegacyProperties;
}
};
@@ -8409,21 +7576,10 @@
updateComponent: 'updateComponent'
});
-assign(
- ReactDOMComponent.prototype,
- ReactDOMComponent.Mixin,
- ReactMultiChild.Mixin
-);
-
-ReactDOMComponent.injection = {
- injectIDOperations: function(IDOperations) {
- ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
- }
-};
+assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
-
-},{"11":11,"12":12,"131":131,"150":150,"151":151,"157":157,"171":171,"29":29,"33":33,"40":40,"6":6,"77":77,"78":78,"82":82}],49:[function(_dereq_,module,exports){
+},{"10":10,"11":11,"117":117,"121":121,"133":133,"138":138,"139":139,"144":144,"15":15,"161":161,"166":166,"171":171,"173":173,"2":2,"24":24,"28":28,"35":35,"41":41,"46":46,"47":47,"48":48,"5":5,"52":52,"72":72,"73":73,"78":78,"95":95}],43:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8432,47 +7588,195 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactDOMForm
+ * @providesModule ReactDOMFactories
+ * @typechecks static-only
*/
'use strict';
-var EventConstants = _dereq_(16);
-var LocalEventTrapMixin = _dereq_(27);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
+var ReactElement = _dereq_(57);
+var ReactElementValidator = _dereq_(58);
-var form = ReactElement.createFactory('form');
+var mapObject = _dereq_(167);
/**
- * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
- * to capture it on the <form> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <form> a
- * composite component and use `componentDidMount` to attach the event handlers.
+ * Create a factory that creates HTML tag elements.
+ *
+ * @param {string} tag Tag name (e.g. `div`).
+ * @private
*/
-var ReactDOMForm = ReactClass.createClass({
- displayName: 'ReactDOMForm',
- tagName: 'FORM',
+function createDOMFactory(tag) {
+ if ("development" !== 'production') {
+ return ReactElementValidator.createFactory(tag);
+ }
+ return ReactElement.createFactory(tag);
+}
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
+/**
+ * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
+ * This is also accessible via `React.DOM`.
+ *
+ * @public
+ */
+var ReactDOMFactories = mapObject({
+ a: 'a',
+ abbr: 'abbr',
+ address: 'address',
+ area: 'area',
+ article: 'article',
+ aside: 'aside',
+ audio: 'audio',
+ b: 'b',
+ base: 'base',
+ bdi: 'bdi',
+ bdo: 'bdo',
+ big: 'big',
+ blockquote: 'blockquote',
+ body: 'body',
+ br: 'br',
+ button: 'button',
+ canvas: 'canvas',
+ caption: 'caption',
+ cite: 'cite',
+ code: 'code',
+ col: 'col',
+ colgroup: 'colgroup',
+ data: 'data',
+ datalist: 'datalist',
+ dd: 'dd',
+ del: 'del',
+ details: 'details',
+ dfn: 'dfn',
+ dialog: 'dialog',
+ div: 'div',
+ dl: 'dl',
+ dt: 'dt',
+ em: 'em',
+ embed: 'embed',
+ fieldset: 'fieldset',
+ figcaption: 'figcaption',
+ figure: 'figure',
+ footer: 'footer',
+ form: 'form',
+ h1: 'h1',
+ h2: 'h2',
+ h3: 'h3',
+ h4: 'h4',
+ h5: 'h5',
+ h6: 'h6',
+ head: 'head',
+ header: 'header',
+ hgroup: 'hgroup',
+ hr: 'hr',
+ html: 'html',
+ i: 'i',
+ iframe: 'iframe',
+ img: 'img',
+ input: 'input',
+ ins: 'ins',
+ kbd: 'kbd',
+ keygen: 'keygen',
+ label: 'label',
+ legend: 'legend',
+ li: 'li',
+ link: 'link',
+ main: 'main',
+ map: 'map',
+ mark: 'mark',
+ menu: 'menu',
+ menuitem: 'menuitem',
+ meta: 'meta',
+ meter: 'meter',
+ nav: 'nav',
+ noscript: 'noscript',
+ object: 'object',
+ ol: 'ol',
+ optgroup: 'optgroup',
+ option: 'option',
+ output: 'output',
+ p: 'p',
+ param: 'param',
+ picture: 'picture',
+ pre: 'pre',
+ progress: 'progress',
+ q: 'q',
+ rp: 'rp',
+ rt: 'rt',
+ ruby: 'ruby',
+ s: 's',
+ samp: 'samp',
+ script: 'script',
+ section: 'section',
+ select: 'select',
+ small: 'small',
+ source: 'source',
+ span: 'span',
+ strong: 'strong',
+ style: 'style',
+ sub: 'sub',
+ summary: 'summary',
+ sup: 'sup',
+ table: 'table',
+ tbody: 'tbody',
+ td: 'td',
+ textarea: 'textarea',
+ tfoot: 'tfoot',
+ th: 'th',
+ thead: 'thead',
+ time: 'time',
+ title: 'title',
+ tr: 'tr',
+ track: 'track',
+ u: 'u',
+ ul: 'ul',
+ 'var': 'var',
+ video: 'video',
+ wbr: 'wbr',
- render: function() {
- // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
- // `jshint` fails to parse JSX so in order for linting to work in the open
- // source repo, we need to just use `ReactDOM.form`.
- return form(this.props);
- },
+ // SVG
+ circle: 'circle',
+ clipPath: 'clipPath',
+ defs: 'defs',
+ ellipse: 'ellipse',
+ g: 'g',
+ image: 'image',
+ line: 'line',
+ linearGradient: 'linearGradient',
+ mask: 'mask',
+ path: 'path',
+ pattern: 'pattern',
+ polygon: 'polygon',
+ polyline: 'polyline',
+ radialGradient: 'radialGradient',
+ rect: 'rect',
+ stop: 'stop',
+ svg: 'svg',
+ text: 'text',
+ tspan: 'tspan'
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
- }
-});
+}, createDOMFactory);
-module.exports = ReactDOMForm;
+module.exports = ReactDOMFactories;
+},{"167":167,"57":57,"58":58}],44:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMFeatureFlags
+ */
+
+'use strict';
+
+var ReactDOMFeatureFlags = {
+ useCreateElement: false
+};
-},{"16":16,"27":27,"32":32,"38":38,"63":63}],50:[function(_dereq_,module,exports){
+module.exports = ReactDOMFeatureFlags;
+},{}],45:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8485,34 +7789,28 @@
* @typechecks static-only
*/
-/*jslint evil: true */
-
'use strict';
-var CSSPropertyOperations = _dereq_(6);
-var DOMChildrenOperations = _dereq_(10);
-var DOMPropertyOperations = _dereq_(12);
-var ReactMount = _dereq_(77);
-var ReactPerf = _dereq_(82);
+var DOMChildrenOperations = _dereq_(9);
+var DOMPropertyOperations = _dereq_(11);
+var ReactMount = _dereq_(72);
+var ReactPerf = _dereq_(78);
-var invariant = _dereq_(150);
-var setInnerHTML = _dereq_(164);
+var invariant = _dereq_(161);
/**
- * Errors for properties that should not be updated with `updatePropertyById()`.
+ * Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
- dangerouslySetInnerHTML:
- '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
+ dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
- * Operations used to process updates to DOM nodes. This is made injectable via
- * `ReactDOMComponent.BackendIDOperations`.
+ * Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
@@ -8525,13 +7823,9 @@
* @param {*} value New value of the property.
* @internal
*/
- updatePropertyByID: function(id, name, value) {
+ updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
- ("production" !== "development" ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
+ !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? "development" !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// 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
@@ -8544,61 +7838,6 @@
},
/**
- * 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);
- ("production" !== "development" ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
- 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 innerHTML.
- *
- * @param {string} id ID of the node to update.
- * @param {string} html An HTML string.
- * @internal
- */
- updateInnerHTMLByID: function(id, html) {
- var node = ReactMount.getNode(id);
- setInnerHTML(node, html);
- },
-
- /**
- * 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.
*
* @param {string} id ID of child to be replaced.
@@ -8606,7 +7845,7 @@
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
- dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
+ dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
@@ -8618,7 +7857,7 @@
* @param {array<string>} markup List of markup strings.
* @internal
*/
- dangerouslyProcessChildrenUpdates: function(updates, markup) {
+ dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
@@ -8627,109 +7866,12 @@
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
- updatePropertyByID: 'updatePropertyByID',
- deletePropertyByID: 'deletePropertyByID',
- updateStylesByID: 'updateStylesByID',
- updateInnerHTMLByID: 'updateInnerHTMLByID',
- updateTextContentByID: 'updateTextContentByID',
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
-
-},{"10":10,"12":12,"150":150,"164":164,"6":6,"77":77,"82":82}],51:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMIframe
- */
-
-'use strict';
-
-var EventConstants = _dereq_(16);
-var LocalEventTrapMixin = _dereq_(27);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var iframe = ReactElement.createFactory('iframe');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <iframe> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <iframe> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMIframe = ReactClass.createClass({
- displayName: 'ReactDOMIframe',
- tagName: 'IFRAME',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return iframe(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- }
-});
-
-module.exports = ReactDOMIframe;
-
-},{"16":16,"27":27,"32":32,"38":38,"63":63}],52:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMImg
- */
-
-'use strict';
-
-var EventConstants = _dereq_(16);
-var LocalEventTrapMixin = _dereq_(27);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var img = ReactElement.createFactory('img');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <img> element itself. There are lots of hacks we could do
- * to accomplish this, but the most reliable is to make <img> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMImg = ReactClass.createClass({
- displayName: 'ReactDOMImg',
- tagName: 'IMG',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return img(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
- }
-});
-
-module.exports = ReactDOMImg;
-
-},{"16":16,"27":27,"32":32,"38":38,"63":63}],53:[function(_dereq_,module,exports){
+},{"11":11,"161":161,"72":72,"78":78,"9":9}],46:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8743,26 +7885,20 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var DOMPropertyOperations = _dereq_(12);
-var LinkedValueUtils = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-var ReactMount = _dereq_(77);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var ReactDOMIDOperations = _dereq_(45);
+var LinkedValueUtils = _dereq_(23);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
-var input = ReactElement.createFactory('input');
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
var instancesByReactID = {};
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMInput.updateWrapper(this);
}
}
@@ -8782,81 +7918,75 @@
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
-var ReactDOMInput = ReactClass.createClass({
- displayName: 'ReactDOMInput',
- tagName: 'INPUT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+var ReactDOMInput = {
+ getNativeProps: function (inst, props, context) {
+ var value = LinkedValueUtils.getValue(props);
+ var checked = LinkedValueUtils.getChecked(props);
+
+ var nativeProps = assign({}, props, {
+ defaultChecked: undefined,
+ defaultValue: undefined,
+ value: value != null ? value : inst._wrapperState.initialValue,
+ checked: checked != null ? checked : inst._wrapperState.initialChecked,
+ onChange: inst._wrapperState.onChange
+ });
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
- return {
- initialChecked: this.props.defaultChecked || false,
- initialValue: defaultValue != null ? defaultValue : null
- };
+ return nativeProps;
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.defaultChecked = null;
- props.defaultValue = null;
-
- var value = LinkedValueUtils.getValue(this);
- props.value = value != null ? value : this.state.initialValue;
-
- var checked = LinkedValueUtils.getChecked(this);
- props.checked = checked != null ? checked : this.state.initialChecked;
-
- props.onChange = this._handleChange;
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
+ }
- return input(props, this.props.children);
+ var defaultValue = props.defaultValue;
+ inst._wrapperState = {
+ initialChecked: props.defaultChecked || false,
+ initialValue: defaultValue != null ? defaultValue : null,
+ onChange: _handleChange.bind(inst)
+ };
},
- componentDidMount: function() {
- var id = ReactMount.getID(this.getDOMNode());
- instancesByReactID[id] = this;
+ mountReadyWrapper: function (inst) {
+ // Can't be in mountWrapper or else server rendering leaks.
+ instancesByReactID[inst._rootNodeID] = inst;
},
- componentWillUnmount: function() {
- var rootNode = this.getDOMNode();
- var id = ReactMount.getID(rootNode);
- delete instancesByReactID[id];
+ unmountWrapper: function (inst) {
+ delete instancesByReactID[inst._rootNodeID];
},
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var rootNode = this.getDOMNode();
- if (this.props.checked != null) {
- DOMPropertyOperations.setValueForProperty(
- rootNode,
- 'checked',
- this.props.checked || false
- );
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // TODO: Shouldn't this be getChecked(props)?
+ var checked = props.checked;
+ if (checked != null) {
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
+
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
- var name = this.props.name;
- if (this.props.type === 'radio' && name != null) {
- var rootNode = this.getDOMNode();
+ var name = props.name;
+ if (props.type === 'radio' && name != null) {
+ var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
@@ -8869,27 +7999,21 @@
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
- var group = queryRoot.querySelectorAll(
- 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
+ var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
- for (var i = 0, groupLen = group.length; i < groupLen; i++) {
+ for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
- if (otherNode === rootNode ||
- otherNode.form !== rootNode.form) {
+ if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
+ // 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);
- ("production" !== "development" ? invariant(
- otherID,
- 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
- 'same `name` is not supported.'
- ) : invariant(otherID));
+ !otherID ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
- ("production" !== "development" ? invariant(
- otherInstance,
- 'ReactDOMInput: Unknown radio button ID %s.',
- otherID
- ) : invariant(otherInstance));
+ !otherInstance ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
@@ -8898,13 +8022,10 @@
}
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMInput;
-
-},{"100":100,"12":12,"150":150,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63,"77":77}],54:[function(_dereq_,module,exports){
+},{"161":161,"23":23,"24":24,"45":45,"72":72,"96":96}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8918,43 +8039,83 @@
'use strict';
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
+var ReactChildren = _dereq_(32);
+var ReactDOMSelect = _dereq_(48);
-var warning = _dereq_(171);
+var assign = _dereq_(24);
+var warning = _dereq_(173);
-var option = ReactElement.createFactory('option');
+var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
-var ReactDOMOption = ReactClass.createClass({
- displayName: 'ReactDOMOption',
- tagName: 'OPTION',
+var ReactDOMOption = {
+ mountWrapper: function (inst, props, context) {
+ // TODO (yungsters): Remove support for `selected` in <option>.
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
+ }
- mixins: [ReactBrowserComponentMixin],
+ // Look up whether this option is 'selected' via context
+ var selectValue = context[valueContextKey];
- componentWillMount: function() {
- // TODO (yungsters): Remove support for `selected` in <option>.
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- this.props.selected == null,
- 'Use the `defaultValue` or `value` props on <select> instead of ' +
- 'setting `selected` on <option>.'
- ) : null);
+ // If context key is null (e.g., no specified value or after initial mount)
+ // or missing (e.g., for <datalist>), we don't change props.selected
+ var selected = null;
+ if (selectValue != null) {
+ selected = false;
+ if (Array.isArray(selectValue)) {
+ // multiple
+ for (var i = 0; i < selectValue.length; i++) {
+ if ('' + selectValue[i] === '' + props.value) {
+ selected = true;
+ break;
+ }
+ }
+ } else {
+ selected = '' + selectValue === '' + props.value;
}
+ }
+
+ inst._wrapperState = { selected: selected };
},
- render: function() {
- return option(this.props, this.props.children);
+ getNativeProps: function (inst, props, context) {
+ var nativeProps = assign({ selected: undefined, children: undefined }, props);
+
+ // Read state only from initial mount because <select> updates value
+ // manually; we need the initial state only for server rendering
+ if (inst._wrapperState.selected != null) {
+ nativeProps.selected = inst._wrapperState.selected;
}
-});
+ var content = '';
-module.exports = ReactDOMOption;
+ // Flatten children and warn if they aren't strings or numbers;
+ // invalid types are ignored.
+ ReactChildren.forEach(props.children, function (child) {
+ if (child == null) {
+ return;
+ }
+ if (typeof child === 'string' || typeof child === 'number') {
+ content += child;
+ } else {
+ "development" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
+ }
+ });
+
+ if (content) {
+ nativeProps.children = content;
+ }
+
+ return nativeProps;
+ }
+
+};
-},{"171":171,"32":32,"38":38,"63":63}],55:[function(_dereq_,module,exports){
+module.exports = ReactDOMOption;
+},{"173":173,"24":24,"32":32,"48":48}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8968,68 +8129,77 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var LinkedValueUtils = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-var ReactUpdates = _dereq_(100);
+var LinkedValueUtils = _dereq_(23);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
-var assign = _dereq_(29);
+var assign = _dereq_(24);
+var warning = _dereq_(173);
-var select = ReactElement.createFactory('select');
+var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
- /*jshint validthis:true */
- if (this._pendingUpdate) {
- this._pendingUpdate = false;
- var value = LinkedValueUtils.getValue(this);
- if (value != null && this.isMounted()) {
- updateOptions(this, value);
+ if (this._rootNodeID && this._wrapperState.pendingUpdate) {
+ this._wrapperState.pendingUpdate = false;
+
+ var props = this._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
+
+ if (value != null) {
+ updateOptions(this, Boolean(props.multiple), value);
}
}
}
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
+}
+
+var valuePropNames = ['value', 'defaultValue'];
+
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
-function selectValueType(props, propName, componentName) {
+function checkSelectPropTypes(inst, props) {
+ var owner = inst._currentElement._owner;
+ LinkedValueUtils.checkPropTypes('select', props, owner);
+
+ for (var i = 0; i < valuePropNames.length; i++) {
+ var propName = valuePropNames[i];
if (props[propName] == null) {
- return null;
+ continue;
}
if (props.multiple) {
- if (!Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be an array if ") +
- ("`multiple` is true.")
- );
- }
+ "development" !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
- if (Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
- ("value if `multiple` is false.")
- );
+ "development" !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
- * @param {ReactComponent} component Instance of ReactDOMSelect
+ * @param {ReactDOMComponent} inst
+ * @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
-function updateOptions(component, propValue) {
- var selectedValue, i, l;
- var options = component.getDOMNode().options;
+function updateOptions(inst, multiple, propValue) {
+ var selectedValue, i;
+ var options = ReactMount.getNode(inst._rootNodeID).options;
- if (component.props.multiple) {
+ if (multiple) {
selectedValue = {};
- for (i = 0, l = propValue.length; i < l; i++) {
+ for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
@@ -9039,7 +8209,7 @@
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
@@ -9066,73 +8236,75 @@
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
-var ReactDOMSelect = ReactClass.createClass({
- displayName: 'ReactDOMSelect',
- tagName: 'SELECT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+var ReactDOMSelect = {
+ valueContextKey: valueContextKey,
- propTypes: {
- defaultValue: selectValueType,
- value: selectValueType
+ getNativeProps: function (inst, props, context) {
+ return assign({}, props, {
+ onChange: inst._wrapperState.onChange,
+ value: undefined
+ });
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.onChange = this._handleChange;
- props.value = null;
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ checkSelectPropTypes(inst, props);
+ }
- return select(props, this.props.children);
+ var value = LinkedValueUtils.getValue(props);
+ inst._wrapperState = {
+ pendingUpdate: false,
+ initialValue: value != null ? value : props.defaultValue,
+ onChange: _handleChange.bind(inst),
+ wasMultiple: Boolean(props.multiple)
+ };
},
- componentWillMount: function() {
- this._pendingUpdate = false;
+ processChildContext: function (inst, props, context) {
+ // Pass down initial value so initial generated markup has correct
+ // `selected` attributes
+ var childContext = assign({}, context);
+ childContext[valueContextKey] = inst._wrapperState.initialValue;
+ return childContext;
},
- componentDidMount: function() {
- var value = LinkedValueUtils.getValue(this);
- if (value != null) {
- updateOptions(this, value);
- } else if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
- }
- },
+ postUpdateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // After the initial mount, we control selected-ness manually so don't pass
+ // the context value down
+ inst._wrapperState.initialValue = undefined;
+
+ var wasMultiple = inst._wrapperState.wasMultiple;
+ inst._wrapperState.wasMultiple = Boolean(props.multiple);
- componentDidUpdate: function(prevProps) {
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- this._pendingUpdate = false;
- updateOptions(this, value);
- } else if (!prevProps.multiple !== !this.props.multiple) {
+ inst._wrapperState.pendingUpdate = false;
+ updateOptions(inst, Boolean(props.multiple), value);
+ } else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
- if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
+ if (props.defaultValue != null) {
+ updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
- updateOptions(this, this.props.multiple ? [] : '');
+ updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
- this._pendingUpdate = true;
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
+
+ this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMSelect;
-
-},{"100":100,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],56:[function(_dereq_,module,exports){
+},{"173":173,"23":23,"24":24,"72":72,"96":96}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9146,10 +8318,10 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
-var getNodeForCharacterOffset = _dereq_(143);
-var getTextContentAccessor = _dereq_(145);
+var getNodeForCharacterOffset = _dereq_(130);
+var getTextContentAccessor = _dereq_(131);
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
@@ -9211,15 +8383,26 @@
var currentRange = selection.getRangeAt(0);
+ // In Firefox, range.startContainer and range.endContainer can be "anonymous
+ // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
+ // divs do not seem to expose properties, triggering a "Permission denied
+ // error" if any of its properties are accessed. The only seemingly possible
+ // way to avoid erroring is to access a property that typically works for
+ // non-anonymous divs and catch any error that may otherwise arise. See
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
+ try {
+ /* eslint-disable no-unused-expressions */
+ currentRange.startContainer.nodeType;
+ currentRange.endContainer.nodeType;
+ /* eslint-enable no-unused-expressions */
+ } catch (e) {
+ return null;
+ }
+
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
- var isSelectionCollapsed = isCollapsed(
- selection.anchorNode,
- selection.anchorOffset,
- selection.focusNode,
- selection.focusOffset
- );
+ var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
@@ -9227,12 +8410,7 @@
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
- var isTempRangeCollapsed = isCollapsed(
- tempRange.startContainer,
- tempRange.startOffset,
- tempRange.endContainer,
- tempRange.endOffset
- );
+ var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
@@ -9295,8 +8473,7 @@
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
- var end = typeof offsets.end === 'undefined' ?
- start : Math.min(offsets.end, length);
+ var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
@@ -9324,11 +8501,7 @@
}
}
-var useIEOffsets = (
- ExecutionEnvironment.canUseDOM &&
- 'selection' in document &&
- !('getSelection' in window)
-);
+var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
@@ -9344,8 +8517,34 @@
};
module.exports = ReactDOMSelection;
+},{"130":130,"131":131,"147":147}],50:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMServer
+ */
+
+'use strict';
+
+var ReactDefaultInjection = _dereq_(54);
+var ReactServerRendering = _dereq_(88);
+var ReactVersion = _dereq_(97);
-},{"143":143,"145":145,"22":22}],57:[function(_dereq_,module,exports){
+ReactDefaultInjection.inject();
+
+var ReactDOMServer = {
+ renderToString: ReactServerRendering.renderToString,
+ renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
+ version: ReactVersion
+};
+
+module.exports = ReactDOMServer;
+},{"54":54,"88":88,"97":97}],51:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9360,13 +8559,15 @@
'use strict';
-var DOMPropertyOperations = _dereq_(12);
-var ReactComponentBrowserEnvironment =
- _dereq_(40);
-var ReactDOMComponent = _dereq_(48);
-
-var assign = _dereq_(29);
-var escapeTextContentForBrowser = _dereq_(131);
+var DOMChildrenOperations = _dereq_(9);
+var DOMPropertyOperations = _dereq_(11);
+var ReactComponentBrowserEnvironment = _dereq_(35);
+var ReactMount = _dereq_(72);
+
+var assign = _dereq_(24);
+var escapeTextContentForBrowser = _dereq_(121);
+var setTextContent = _dereq_(139);
+var validateDOMNesting = _dereq_(144);
/**
* Text nodes violate a couple assumptions that React makes about components:
@@ -9383,7 +8584,7 @@
* @extends ReactComponent
* @internal
*/
-var ReactDOMTextComponent = function(props) {
+var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
@@ -9393,7 +8594,7 @@
* @param {ReactText} text
* @internal
*/
- construct: function(text) {
+ construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
@@ -9412,8 +8613,23 @@
* @return {string} Markup for this text node.
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
+ if ("development" !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
this._rootNodeID = rootID;
+ 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) {
@@ -9423,11 +8639,8 @@
return escapedText;
}
- return (
- '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
- escapedText +
- '</span>'
- );
+ return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
+ }
},
/**
@@ -9437,7 +8650,7 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- receiveComponent: function(nextText, transaction) {
+ receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
@@ -9446,23 +8659,20 @@
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
- ReactDOMComponent.BackendIDOperations.updateTextContentByID(
- this._rootNodeID,
- nextStringText
- );
+ var node = ReactMount.getNode(this._rootNodeID);
+ DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
- unmountComponent: function() {
+ unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
-
-},{"12":12,"131":131,"29":29,"40":40,"48":48}],58:[function(_dereq_,module,exports){
+},{"11":11,"121":121,"139":139,"144":144,"24":24,"35":35,"72":72,"9":9}],52:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9476,25 +8686,18 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var DOMPropertyOperations = _dereq_(12);
-var LinkedValueUtils = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-
-var warning = _dereq_(171);
-
-var textarea = ReactElement.createFactory('textarea');
+var LinkedValueUtils = _dereq_(23);
+var ReactDOMIDOperations = _dereq_(45);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMTextarea.updateWrapper(this);
}
}
@@ -9513,33 +8716,37 @@
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
-var ReactDOMTextarea = ReactClass.createClass({
- displayName: 'ReactDOMTextarea',
- tagName: 'TEXTAREA',
+var ReactDOMTextarea = {
+ getNativeProps: function (inst, props, context) {
+ !(props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+ // Always set children to the same thing. In IE9, the selection range will
+ // get reset if `textContent` is mutated.
+ var nativeProps = assign({}, props, {
+ defaultValue: undefined,
+ value: undefined,
+ children: inst._wrapperState.initialValue,
+ onChange: inst._wrapperState.onChange
+ });
+
+ return nativeProps;
+ },
+
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
+ }
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
+ var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
- var children = this.props.children;
+ var children = props.children;
if (children != null) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- false,
- 'Use the `defaultValue` or `value` props instead of setting ' +
- 'children on <textarea>.'
- ) : null);
- }
- ("production" !== "development" ? invariant(
- defaultValue == null,
- 'If you supply `defaultValue` on a <textarea>, do not pass children.'
- ) : invariant(defaultValue == null));
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
+ }
+ !(defaultValue == null) ? "development" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
- ("production" !== "development" ? invariant(
- children.length <= 1,
- '<textarea> can only have at most one child.'
- ) : invariant(children.length <= 1));
+ !(children.length <= 1) ? "development" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
@@ -9548,59 +8755,38 @@
if (defaultValue == null) {
defaultValue = '';
}
- var value = LinkedValueUtils.getValue(this);
- return {
+ var value = LinkedValueUtils.getValue(props);
+
+ inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
- initialValue: '' + (value != null ? value : defaultValue)
+ initialValue: '' + (value != null ? value : defaultValue),
+ onChange: _handleChange.bind(inst)
};
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- ("production" !== "development" ? invariant(
- props.dangerouslySetInnerHTML == null,
- '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
- ) : invariant(props.dangerouslySetInnerHTML == null));
-
- props.defaultValue = null;
- props.value = null;
- props.onChange = this._handleChange;
-
- // Always set children to the same thing. In IE9, the selection range will
- // get reset if `textContent` is mutated.
- return textarea(props, this.state.initialValue);
- },
-
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var value = LinkedValueUtils.getValue(this);
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- var rootNode = this.getDOMNode();
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMTextarea;
-
-},{"100":100,"12":12,"150":150,"171":171,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],59:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"23":23,"24":24,"45":45,"96":96}],53:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9614,15 +8800,15 @@
'use strict';
-var ReactUpdates = _dereq_(100);
-var Transaction = _dereq_(116);
+var ReactUpdates = _dereq_(96);
+var Transaction = _dereq_(113);
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
- close: function() {
+ close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
@@ -9638,15 +8824,11 @@
this.reinitializeTransaction();
}
-assign(
- ReactDefaultBatchingStrategyTransaction.prototype,
- Transaction.Mixin,
- {
- getTransactionWrappers: function() {
+assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
- }
-);
+});
var transaction = new ReactDefaultBatchingStrategyTransaction();
@@ -9657,23 +8839,22 @@
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
- batchedUpdates: function(callback, a, b, c, d) {
+ batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
- callback(a, b, c, d);
+ callback(a, b, c, d, e);
} else {
- transaction.perform(callback, null, a, b, c, d);
+ transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
-
-},{"100":100,"116":116,"129":129,"29":29}],60:[function(_dereq_,module,exports){
+},{"113":113,"153":153,"24":24,"96":96}],54:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9688,62 +8869,39 @@
'use strict';
var BeforeInputEventPlugin = _dereq_(3);
-var ChangeEventPlugin = _dereq_(8);
-var ClientReactRootIndex = _dereq_(9);
-var DefaultEventPluginOrder = _dereq_(14);
-var EnterLeaveEventPlugin = _dereq_(15);
-var ExecutionEnvironment = _dereq_(22);
-var HTMLDOMPropertyConfig = _dereq_(24);
-var MobileSafariClickEventPlugin = _dereq_(28);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactComponentBrowserEnvironment =
- _dereq_(40);
-var ReactDefaultBatchingStrategy = _dereq_(59);
-var ReactDOMComponent = _dereq_(48);
-var ReactDOMButton = _dereq_(47);
-var ReactDOMForm = _dereq_(49);
-var ReactDOMImg = _dereq_(52);
-var ReactDOMIDOperations = _dereq_(50);
-var ReactDOMIframe = _dereq_(51);
-var ReactDOMInput = _dereq_(53);
-var ReactDOMOption = _dereq_(54);
-var ReactDOMSelect = _dereq_(55);
-var ReactDOMTextarea = _dereq_(58);
-var ReactDOMTextComponent = _dereq_(57);
-var ReactElement = _dereq_(63);
-var ReactEventListener = _dereq_(68);
-var ReactInjection = _dereq_(70);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMount = _dereq_(77);
-var ReactReconcileTransaction = _dereq_(88);
-var SelectEventPlugin = _dereq_(102);
-var ServerReactRootIndex = _dereq_(103);
-var SimpleEventPlugin = _dereq_(104);
-var SVGDOMPropertyConfig = _dereq_(101);
-
-var createFullPageComponent = _dereq_(125);
-
-function autoGenerateWrapperClass(type) {
- return ReactClass.createClass({
- tagName: type.toUpperCase(),
- render: function() {
- return new ReactElement(
- type,
- null,
- null,
- null,
- null,
- this.props
- );
- }
- });
-}
+var ChangeEventPlugin = _dereq_(7);
+var ClientReactRootIndex = _dereq_(8);
+var DefaultEventPluginOrder = _dereq_(13);
+var EnterLeaveEventPlugin = _dereq_(14);
+var ExecutionEnvironment = _dereq_(147);
+var HTMLDOMPropertyConfig = _dereq_(21);
+var ReactBrowserComponentMixin = _dereq_(27);
+var ReactComponentBrowserEnvironment = _dereq_(35);
+var ReactDefaultBatchingStrategy = _dereq_(53);
+var ReactDOMComponent = _dereq_(42);
+var ReactDOMTextComponent = _dereq_(51);
+var ReactEventListener = _dereq_(63);
+var ReactInjection = _dereq_(65);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMount = _dereq_(72);
+var ReactReconcileTransaction = _dereq_(83);
+var SelectEventPlugin = _dereq_(99);
+var ServerReactRootIndex = _dereq_(100);
+var SimpleEventPlugin = _dereq_(101);
+var SVGDOMPropertyConfig = _dereq_(98);
+
+var alreadyInjected = false;
function inject() {
- ReactInjection.EventEmitter.injectReactEventListener(
- ReactEventListener
- );
+ if (alreadyInjected) {
+ // TODO: This is currently true because these injections are shared between
+ // the client and the server package. They should be built independently
+ // and not share any injection state. Then this problem will be solved.
+ return;
+ }
+ alreadyInjected = true;
+
+ ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
@@ -9760,67 +8918,32 @@
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
- MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
- ReactInjection.NativeComponent.injectGenericComponentClass(
- ReactDOMComponent
- );
+ ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
- ReactInjection.NativeComponent.injectTextComponentClass(
- ReactDOMTextComponent
- );
+ ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
- ReactInjection.NativeComponent.injectAutoWrapper(
- autoGenerateWrapperClass
- );
-
- // This needs to happen before createFullPageComponent() otherwise the mixin
- // won't be included.
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
- ReactInjection.NativeComponent.injectComponentClasses({
- 'button': ReactDOMButton,
- 'form': ReactDOMForm,
- 'iframe': ReactDOMIframe,
- 'img': ReactDOMImg,
- 'input': ReactDOMInput,
- 'option': ReactDOMOption,
- 'select': ReactDOMSelect,
- 'textarea': ReactDOMTextarea,
-
- 'html': createFullPageComponent('html'),
- 'head': createFullPageComponent('head'),
- 'body': createFullPageComponent('body')
- });
-
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
- ReactInjection.Updates.injectReconcileTransaction(
- ReactReconcileTransaction
- );
- ReactInjection.Updates.injectBatchingStrategy(
- ReactDefaultBatchingStrategy
- );
+ ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
+ ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
- ReactInjection.RootIndex.injectCreateReactRootIndex(
- ExecutionEnvironment.canUseDOM ?
- ClientReactRootIndex.createReactRootIndex :
- ServerReactRootIndex.createReactRootIndex
- );
+ ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
- ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
- if ("production" !== "development") {
- var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
- if ((/[?&]react_perf\b/).test(url)) {
- var ReactDefaultPerf = _dereq_(61);
+ if ("development" !== 'production') {
+ var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
+ if (/[?&]react_perf\b/.test(url)) {
+ var ReactDefaultPerf = _dereq_(55);
ReactDefaultPerf.start();
}
}
@@ -9829,8 +8952,7 @@
module.exports = {
inject: inject
};
-
-},{"101":101,"102":102,"103":103,"104":104,"125":125,"14":14,"15":15,"22":22,"24":24,"28":28,"3":3,"32":32,"38":38,"40":40,"47":47,"48":48,"49":49,"50":50,"51":51,"52":52,"53":53,"54":54,"55":55,"57":57,"58":58,"59":59,"61":61,"63":63,"68":68,"70":70,"72":72,"77":77,"8":8,"88":88,"9":9}],61:[function(_dereq_,module,exports){
+},{"100":100,"101":101,"13":13,"14":14,"147":147,"21":21,"27":27,"3":3,"35":35,"42":42,"51":51,"53":53,"55":55,"63":63,"65":65,"67":67,"7":7,"72":72,"8":8,"83":83,"98":98,"99":99}],55:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9845,12 +8967,12 @@
'use strict';
-var DOMProperty = _dereq_(11);
-var ReactDefaultPerfAnalysis = _dereq_(62);
-var ReactMount = _dereq_(77);
-var ReactPerf = _dereq_(82);
+var DOMProperty = _dereq_(10);
+var ReactDefaultPerfAnalysis = _dereq_(56);
+var ReactMount = _dereq_(72);
+var ReactPerf = _dereq_(78);
-var performanceNow = _dereq_(162);
+var performanceNow = _dereq_(170);
function roundFloat(val) {
return Math.floor(val * 100) / 100;
@@ -9865,7 +8987,7 @@
_mountStack: [0],
_injected: false,
- start: function() {
+ start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
@@ -9874,18 +8996,18 @@
ReactPerf.enableMeasure = true;
},
- stop: function() {
+ stop: function () {
ReactPerf.enableMeasure = false;
},
- getLastMeasurements: function() {
+ getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
- printExclusive: function(measurements) {
+ printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
@@ -9900,28 +9022,22 @@
// number.
},
- printInclusive: function(measurements) {
+ printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- getMeasurementsSummaryMap: function(measurements) {
- var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
- measurements,
- true
- );
- return summary.map(function(item) {
+ getMeasurementsSummaryMap: function (measurements) {
+ var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
+ return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
@@ -9930,37 +9046,28 @@
});
},
- printWasted: function(measurements) {
+ printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- printDOM: function(measurements) {
+ printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
- result['type'] = item.type;
- result['args'] = JSON.stringify(item.args);
+ result.type = item.type;
+ result.args = JSON.stringify(item.args);
return result;
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- _recordWrite: function(id, fnName, totalTime, args) {
+ _recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
- var writes =
- ReactDefaultPerf
- ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
- .writes;
+ var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
@@ -9969,14 +9076,17 @@
});
},
- measure: function(moduleName, fnName, func) {
- return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ measure: function (moduleName, fnName, func) {
+ return function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
var totalTime;
var rv;
var start;
- if (fnName === '_renderNewRootComponent' ||
- fnName === 'flushBatchedUpdates') {
+ if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
@@ -9988,16 +9098,14 @@
counts: {},
writes: {},
displayNames: {},
- totalTime: 0
+ totalTime: 0,
+ created: {}
});
start = performanceNow();
rv = func.apply(this, args);
- ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ].totalTime = performanceNow() - start;
+ ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
- } else if (fnName === '_mountImageIntoNode' ||
- moduleName === 'ReactDOMIDOperations') {
+ } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
@@ -10007,7 +9115,7 @@
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
- args[0].forEach(function(update) {
+ args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
@@ -10021,46 +9129,35 @@
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
- ReactDefaultPerf._recordWrite(
- update.parentID,
- update.type,
- totalTime,
- writeArgs
- );
+ ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
- ReactDefaultPerf._recordWrite(
- args[0],
- fnName,
- totalTime,
- Array.prototype.slice.call(args, 1)
- );
+ var id = args[0];
+ if (typeof id === 'object') {
+ id = ReactMount.getID(args[0]);
+ }
+ ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
- } else if (moduleName === 'ReactCompositeComponent' && (
- (// TODO: receiveComponent()?
- (fnName === 'mountComponent' ||
- fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
+ } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
+ fnName === '_renderValidatedComponent')) {
- if (typeof this._currentElement.type === 'string') {
+ if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
- var rootNodeID = fnName === 'mountComponent' ?
- args[0] :
- this._rootNodeID;
+ var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
- var entry = ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ];
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
+ entry.created[rootNodeID] = true;
mountStack.push(0);
}
@@ -10081,9 +9178,7 @@
entry.displayNames[rootNodeID] = {
current: this.getName(),
- owner: this._currentElement._owner ?
- this._currentElement._owner.getName() :
- '<root>'
+ owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;
@@ -10095,8 +9190,7 @@
};
module.exports = ReactDefaultPerf;
-
-},{"11":11,"162":162,"62":62,"77":77,"82":82}],62:[function(_dereq_,module,exports){
+},{"10":10,"170":170,"56":56,"72":72,"78":78}],56:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -10108,7 +9202,9 @@
* @providesModule ReactDefaultPerfAnalysis
*/
-var assign = _dereq_(29);
+'use strict';
+
+var assign = _dereq_(24);
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
@@ -10117,12 +9213,14 @@
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
+ SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
- 'updatePropertyByID': 'update attribute',
- 'deletePropertyByID': 'delete attribute',
- 'updateStylesByID': 'update styles',
- 'updateInnerHTMLByID': 'set innerHTML',
- 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
+ 'setValueForProperty': 'update attribute',
+ 'setValueForAttribute': 'update attribute',
+ 'deleteValueForProperty': 'remove attribute',
+ 'setValueForStyles': 'update styles',
+ 'replaceNodeWithMarkup': 'replace',
+ 'updateTextContent': 'set textContent'
};
function getTotalTime(measurements) {
@@ -10140,20 +9238,17 @@
function getDOMSummary(measurements) {
var items = [];
- for (var i = 0; i < measurements.length; i++) {
- var measurement = measurements[i];
- var id;
-
- for (id in measurement.writes) {
- measurement.writes[id].forEach(function(write) {
+ measurements.forEach(function (measurement) {
+ Object.keys(measurement.writes).forEach(function (id) {
+ measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
- }
- }
+ });
+ });
return items;
}
@@ -10163,11 +9258,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
@@ -10202,7 +9293,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
@@ -10215,11 +9306,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
@@ -10261,7 +9348,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.time - a.time;
});
@@ -10286,6 +9373,10 @@
break;
}
}
+ // check if component newly created
+ if (measurement.created[id]) {
+ isDirty = true;
+ }
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
@@ -10301,8 +9392,7 @@
};
module.exports = ReactDefaultPerfAnalysis;
-
-},{"29":29}],63:[function(_dereq_,module,exports){
+},{"24":24}],57:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -10316,142 +9406,101 @@
'use strict';
-var ReactContext = _dereq_(44);
-var ReactCurrentOwner = _dereq_(45);
+var ReactCurrentOwner = _dereq_(39);
-var assign = _dereq_(29);
-var warning = _dereq_(171);
+var assign = _dereq_(24);
+var canDefineProperty = _dereq_(117);
+
+// 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 REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
- ref: true
+ ref: true,
+ __self: true,
+ __source: true
};
/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} object
- * @param {string} key
- */
-function defineWarningProperty(object, key) {
- Object.defineProperty(object, key, {
-
- configurable: false,
- enumerable: true,
-
- get: function() {
- if (!this._store) {
- return null;
- }
- return this._store[key];
- },
-
- set: function(value) {
- ("production" !== "development" ? warning(
- false,
- 'Don\'t set the %s property of the React element. Instead, ' +
- 'specify the correct value when initially creating the element.',
- key
- ) : null);
- this._store[key] = value;
- }
-
- });
-}
-
-/**
- * This is updated to true if the membrane is successfully created.
- */
-var useMutationMembrane = false;
-
-/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} element
- */
-function defineMutationMembrane(prototype) {
- try {
- var pseudoFrozenProperties = {
- props: true
- };
- for (var key in pseudoFrozenProperties) {
- defineWarningProperty(prototype, key);
- }
- useMutationMembrane = true;
- } catch (x) {
- // IE will fail on defineProperty
- }
-}
-
-/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
- * @param {string|object} ref
* @param {*} key
+ * @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
* @param {*} props
* @internal
*/
-var ReactElement = function(type, key, ref, owner, context, props) {
+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: REACT_ELEMENT_TYPE,
+
// Built-in properties that belong on the element
- this.type = type;
- this.key = key;
- this.ref = ref;
+ type: type,
+ key: key,
+ ref: ref,
+ props: props,
// Record the component responsible for creating this element.
- this._owner = owner;
-
- // TODO: Deprecate withContext, and then the context becomes accessible
- // through the owner.
- this._context = context;
+ _owner: owner
+ };
- if ("production" !== "development") {
- // The validation flag and props are currently mutative. We put them on
+ if ("development" !== 'production') {
+ // The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
- this._store = {props: props, originalProps: assign({}, props)};
+ element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
- try {
- Object.defineProperty(this._store, 'validated', {
+ if (canDefineProperty) {
+ Object.defineProperty(element._store, 'validated', {
+ configurable: false,
+ enumerable: false,
+ writable: true,
+ value: false
+ });
+ // self and source are DEV only properties.
+ Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
- writable: true
+ writable: false,
+ value: self
});
- } catch (x) {
- }
- this._store.validated = false;
-
- // We're not allowed to set props directly on the object so we early
- // return and rely on the prototype membrane to forward to the backing
- // store.
- if (useMutationMembrane) {
- Object.freeze(this);
- return;
+ // 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(element.props);
+ Object.freeze(element);
}
- this.props = props;
-};
-
-// 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;
};
-if ("production" !== "development") {
- defineMutationMembrane(ReactElement.prototype);
-}
-
-ReactElement.createElement = function(type, config, children) {
+ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
@@ -10459,14 +9508,17 @@
var key = null;
var ref = null;
+ var self = null;
+ var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
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
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -10495,20 +9547,13 @@
}
}
- return new ReactElement(
- type,
- key,
- ref,
- ReactCurrentOwner.current,
- ReactContext.current,
- props
- );
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
-ReactElement.createFactory = function(type) {
+ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
- // easily accessed on elements. E.g. <Foo />.type === Foo.type.
+ // easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
@@ -10516,17 +9561,16 @@
return factory;
};
-ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
- var newElement = new ReactElement(
- oldElement.type,
- oldElement.key,
- oldElement.ref,
- oldElement._owner,
- oldElement._context,
- newProps
- );
+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 = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
@@ -10530,10 +9574,11 @@
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
+
return newElement;
};
-ReactElement.cloneElement = function(element, config, children) {
+ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
@@ -10542,6 +9587,12 @@
// Reserved names are extracted
var key = element.key;
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;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
@@ -10557,8 +9608,7 @@
}
// Remaining properties override existing props
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -10577,14 +9627,7 @@
props.children = childArray;
}
- return new ReactElement(
- element.type,
- key,
- ref,
- owner,
- element._context,
- props
- );
+ return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
@@ -10592,23 +9635,12 @@
* @return {boolean} True if `object` is a valid component.
* @final
*/
-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;
+ReactElement.isValidElement = function (object) {
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
-
-},{"171":171,"29":29,"44":44,"45":45}],64:[function(_dereq_,module,exports){
+},{"117":117,"24":24,"39":39}],58:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -10629,16 +9661,15 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactFragment = _dereq_(69);
-var ReactPropTypeLocations = _dereq_(85);
-var ReactPropTypeLocationNames = _dereq_(84);
-var ReactCurrentOwner = _dereq_(45);
-var ReactNativeComponent = _dereq_(80);
-
-var getIteratorFn = _dereq_(141);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactElement = _dereq_(57);
+var ReactPropTypeLocations = _dereq_(81);
+var ReactPropTypeLocationNames = _dereq_(80);
+var ReactCurrentOwner = _dereq_(39);
+
+var canDefineProperty = _dereq_(117);
+var getIteratorFn = _dereq_(129);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
@@ -10659,39 +9690,6 @@
var loggedTypeFailures = {};
-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.
* This element is in an array. The array could grow and shrink or be
@@ -10703,84 +9701,59 @@
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
- if (element._store.validated || element.key != null) {
+ if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
- warnAndMonitorForKeyUse(
- 'Each child in an array or iterator should have a unique "key" prop.',
- element,
- parentType
- );
-}
-
-/**
- * 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)) {
+ var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
+ if (addenda === null) {
+ // we already showed the warning
return;
}
- warnAndMonitorForKeyUse(
- 'Child objects should have non-numeric keys so ordering is preserved.',
- element,
- parentType
- );
+ "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
- * @param {string} message The base warning that gets output.
+ * @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
+ * @returns {?object} A set of addenda to use in the warning message, or null
+ * if the warning has already been shown before (and shouldn't be shown again).
*/
-function warnAndMonitorForKeyUse(message, element, parentType) {
- var ownerName = getCurrentOwnerDisplayName();
- var parentName = typeof parentType === 'string' ?
- parentType : parentType.displayName || parentType.name;
-
- var useName = ownerName || parentName;
- var memoizer = ownerHasKeyUseWarning[message] || (
- (ownerHasKeyUseWarning[message] = {})
- );
- if (memoizer.hasOwnProperty(useName)) {
- return;
+function getAddendaForKeyUse(messageType, element, parentType) {
+ 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 + '>.';
+ }
}
- memoizer[useName] = true;
- var parentOrOwnerAddendum =
- ownerName ? (" Check the render method of " + ownerName + ".") :
- parentName ? (" Check the React.render call using <" + parentName + ">.") :
- '';
+ var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
+ if (memoizer[addendum]) {
+ return null;
+ }
+ memoizer[addendum] = true;
+
+ var addenda = {
+ parentOrOwner: addendum,
+ url: ' See https://fb.me/react-warning-keys for more information.',
+ childOwner: null
+ };
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
- var childOwnerAddendum = '';
- if (element &&
- element._owner &&
- element._owner !== ReactCurrentOwner.current) {
- // Name of the component that originally created this child.
- var childOwnerName = getName(element._owner);
-
- childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
- }
-
- ("production" !== "development" ? warning(
- false,
- message + '%s%s See https://fb.me/react-warning-keys for more information.',
- parentOrOwnerAddendum,
- childOwnerAddendum
- ) : null);
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
+ // Give the component that originally created this child.
+ addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
+ }
+
+ return addenda;
}
/**
@@ -10793,6 +9766,9 @@
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
+ if (typeof node !== 'object') {
+ return;
+ }
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
@@ -10802,7 +9778,9 @@
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
+ if (node._store) {
node._store.validated = true;
+ }
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
@@ -10816,13 +9794,6 @@
}
}
}
- } else if (typeof node === 'object') {
- var fragment = ReactFragment.extractIfFragment(node);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- validatePropertyKey(key, fragment[key], parentType);
- }
- }
}
}
}
@@ -10846,109 +9817,19 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== "development" ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
+ "development" !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
- var addendum = getDeclarationErrorAddendum(this);
- ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
- }
- }
- }
-}
-
-var warnedPropsMutations = {};
-
-/**
- * Warn about mutating props when setting `propName` on `element`.
- *
- * @param {string} propName The string key within props that was set
- * @param {ReactElement} element
- */
-function warnForPropsMutation(propName, element) {
- var type = element.type;
- var elementName = typeof type === 'string' ? type : type.displayName;
- var ownerName = element._owner ?
- element._owner.getPublicInstance().constructor.displayName : null;
-
- var warningKey = propName + '|' + elementName + '|' + ownerName;
- if (warnedPropsMutations.hasOwnProperty(warningKey)) {
- return;
- }
- warnedPropsMutations[warningKey] = true;
-
- var elementInfo = '';
- if (elementName) {
- elementInfo = ' <' + elementName + ' />';
- }
- var ownerInfo = '';
- if (ownerName) {
- ownerInfo = ' The element was created by ' + ownerName + '.';
- }
-
- ("production" !== "development" ? warning(
- false,
- 'Don\'t set .props.%s of the React component%s. Instead, specify the ' +
- 'correct value when initially creating the element or use ' +
- 'React.cloneElement to make a new element with updated props.%s',
- propName,
- elementInfo,
- ownerInfo
- ) : null);
-}
-
-// Inline Object.is polyfill
-function is(a, b) {
- if (a !== a) {
- // NaN
- return b !== b;
- }
- if (a === 0 && b === 0) {
- // +-0
- return 1 / a === 1 / b;
- }
- return a === b;
-}
-
-/**
- * Given an element, check if its props have been mutated since element
- * creation (or the last call to this function). In particular, check if any
- * new props have been added, which we can't directly catch by defining warning
- * properties on the props object.
- *
- * @param {ReactElement} element
- */
-function checkAndWarnForMutatedProps(element) {
- if (!element._store) {
- // Element was created using `new ReactElement` directly or with
- // `ReactElement.createElement`; skip mutation checking
- return;
- }
-
- var originalProps = element._store.originalProps;
- var props = element.props;
-
- for (var propName in props) {
- if (props.hasOwnProperty(propName)) {
- if (!originalProps.hasOwnProperty(propName) ||
- !is(originalProps[propName], props[propName])) {
- warnForPropsMutation(propName, element);
-
- // Copy over the new value so that the two props objects match again
- originalProps[propName] = props[propName];
+ var addendum = getDeclarationErrorAddendum();
+ "development" !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
@@ -10961,48 +9842,26 @@
* @param {ReactElement} element
*/
function validatePropTypes(element) {
- if (element.type == null) {
- // This has already warned. Don't throw.
+ var componentClass = element.type;
+ if (typeof componentClass !== 'function') {
return;
}
- // Extract the component class from the element. Converts string types
- // to a composite class which may have propTypes.
- // TODO: Validating a string's propTypes is not decoupled from the
- // rendering target which is problematic.
- var componentClass = ReactNativeComponent.getComponentClassForElement(
- element
- );
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
- checkPropTypes(
- name,
- componentClass.propTypes,
- element.props,
- ReactPropTypeLocations.prop
- );
+ checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
- ("production" !== "development" ? warning(
- componentClass.getDefaultProps.isReactClassApproved,
- 'getDefaultProps is only used on classic React.createClass ' +
- 'definitions. Use a static property named `defaultProps` instead.'
- ) : null);
+ "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
- checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
-
- createElement: function(type, props, children) {
+ createElement: function (type, props, children) {
+ var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
- ("production" !== "development" ? warning(
- type != null,
- 'React.createElement: type should not be null or undefined. It should ' +
- 'be a string (for DOM elements) or a ReactClass (for composite ' +
- 'components).'
- ) : null);
+ "development" !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
@@ -11012,45 +9871,39 @@
return element;
}
+ // Skip key warning if the type isn't valid since our key validation logic
+ // doesn't expect a non-string/function type and can throw confusing errors.
+ // We don't want exception behavior to differ between dev and prod.
+ // (Rendering will throw with a helpful message and as soon as the type is
+ // fixed, the key warnings will appear.)
+ if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
+ }
validatePropTypes(element);
return element;
},
- createFactory: function(type) {
- var validatedFactory = ReactElementValidator.createElement.bind(
- null,
- type
- );
+ createFactory: function (type) {
+ var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
- if ("production" !== "development") {
- try {
- Object.defineProperty(
- validatedFactory,
- 'type',
- {
+ if ("development" !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
- get: function() {
- ("production" !== "development" ? warning(
- false,
- 'Factory.type is deprecated. Access the class directly ' +
- 'before passing it to createFactory.'
- ) : null);
+ get: function () {
+ "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
- }
- );
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
+ });
}
}
@@ -11054,11 +9907,10 @@
}
}
-
return validatedFactory;
},
- cloneElement: function(element, props, children) {
+ cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
@@ -11070,8 +9922,7 @@
};
module.exports = ReactElementValidator;
-
-},{"141":141,"150":150,"171":171,"45":45,"63":63,"69":69,"80":80,"84":84,"85":85}],65:[function(_dereq_,module,exports){
+},{"117":117,"129":129,"161":161,"173":173,"39":39,"57":57,"80":80,"81":81}],59:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -11085,52 +9936,73 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactInstanceMap = _dereq_(73);
+var ReactElement = _dereq_(57);
+var ReactEmptyComponentRegistry = _dereq_(60);
+var ReactReconciler = _dereq_(84);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
-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);
+function registerNullComponentID() {
+ ReactEmptyComponentRegistry.registerNullComponentID(this._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) {
+ transaction.getReactMountReady().enqueue(registerNullComponentID, this);
+ 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() {
- ("production" !== "development" ? invariant(
- component,
- 'Trying to return null from a render, but no null placeholder component ' +
- 'was injected.'
- ) : invariant(component));
- return component();
-};
+});
-var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
+ReactEmptyComponent.injection = ReactEmptyComponentInjection;
+
+module.exports = ReactEmptyComponent;
+},{"24":24,"57":57,"60":60,"84":84}],60:[function(_dereq_,module,exports){
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactEmptyComponentRegistry
+ */
+
+'use strict';
+
+// This registry keeps track of the React IDs of the components that rendered to
+// `null` (in reality a placeholder such as `noscript`)
+var nullComponentIDsRegistry = {};
+
+/**
+ * @param {string} id Component's `_rootNodeID`.
+ * @return {boolean} True if the component is rendered to null.
+ */
+function isNullComponentID(id) {
+ return !!nullComponentIDsRegistry[id];
+}
/**
* Mark the component as having rendered to null.
@@ -11148,23 +10020,14 @@
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
+var ReactEmptyComponentRegistry = {
+ isNullComponentID: isNullComponentID,
+ registerNullComponentID: registerNullComponentID,
+ deregisterNullComponentID: deregisterNullComponentID
};
-module.exports = ReactEmptyComponent;
-
-},{"150":150,"63":63,"73":73}],66:[function(_dereq_,module,exports){
+module.exports = ReactEmptyComponentRegistry;
+},{}],61:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11177,26 +10040,72 @@
* @typechecks
*/
-"use strict";
+'use strict';
+
+var caughtError = null;
+
+/**
+ * Call a function while guarding against errors that happens within it.
+ *
+ * @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
+ */
+function invokeGuardedCallback(name, func, a, b) {
+ try {
+ return func(a, b);
+ } catch (x) {
+ if (caughtError === null) {
+ caughtError = x;
+ }
+ return undefined;
+ }
+}
var ReactErrorUtils = {
+ invokeGuardedCallback: invokeGuardedCallback,
+
/**
- * 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.
- *
- * @param {function} func Function to be executed
- * @param {string} name The name of the guard
- * @return {function}
+ * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
+ * handler are sure to be rethrown by rethrowCaughtError.
*/
- guard: function(func, name) {
- return func;
+ invokeGuardedCallbackWithCatch: invokeGuardedCallback,
+
+ /**
+ * 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;
+ }
}
};
-module.exports = ReactErrorUtils;
+if ("development" !== '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 document !== 'undefined' && typeof document.createEvent === 'function') {
+ var fakeNode = document.createElement('react');
+ ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
+ var boundFunc = func.bind(null, a, b);
+ var evtType = 'react-' + name;
+ fakeNode.addEventListener(evtType, boundFunc, false);
+ var evt = document.createEvent('Event');
+ evt.initEvent(evtType, false, false);
+ fakeNode.dispatchEvent(evt);
+ fakeNode.removeEventListener(evtType, boundFunc, false);
+ };
+ }
+}
-},{}],67:[function(_dereq_,module,exports){
+module.exports = ReactErrorUtils;
+},{}],62:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11210,11 +10119,11 @@
'use strict';
-var EventPluginHub = _dereq_(18);
+var EventPluginHub = _dereq_(16);
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
@@ -11228,25 +10137,14 @@
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
- handleTopLevel: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- var events = EventPluginHub.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
-
+ handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
-
-},{"18":18}],68:[function(_dereq_,module,exports){
+},{"16":16}],63:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11261,16 +10159,18 @@
'use strict';
-var EventListener = _dereq_(17);
-var ExecutionEnvironment = _dereq_(22);
-var PooledClass = _dereq_(30);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMount = _dereq_(77);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var getEventTarget = _dereq_(140);
-var getUnboundedScrollPosition = _dereq_(146);
+var EventListener = _dereq_(146);
+var ExecutionEnvironment = _dereq_(147);
+var PooledClass = _dereq_(25);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var getEventTarget = _dereq_(128);
+var getUnboundedScrollPosition = _dereq_(158);
+
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
@@ -11297,21 +10197,32 @@
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
- destructor: function() {
+ destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
-PooledClass.addPoolingTo(
- TopLevelCallbackBookKeeping,
- PooledClass.twoArgumentPooler
-);
+PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
- var topLevelTarget = ReactMount.getFirstReactDOM(
- getEventTarget(bookKeeping.nativeEvent)
- ) || window;
+ // 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);
+}
+
+// Legacy browsers don't have a path attribute on native events
+function handleTopLevelWithoutPath(bookKeeping) {
+ var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
@@ -11323,15 +10234,44 @@
ancestor = findParent(ancestor);
}
- for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
- ReactEventListener._handleTopLevel(
- bookKeeping.topLevelType,
- topLevelTarget,
- topLevelTargetID,
- bookKeeping.nativeEvent
- );
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
+ }
+}
+
+// New browsers have a path attribute on native events
+function handleTopLevelWithPath(bookKeeping) {
+ var path = bookKeeping.nativeEvent.path;
+ var currentNativeTarget = path[0];
+ var eventsFired = 0;
+ for (var i = 0; i < path.length; i++) {
+ var currentPathElement = path[i];
+ if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
+ currentNativeTarget = path[i + 1];
+ }
+ // TODO: slow
+ var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
+ if (reactParent === currentPathElement) {
+ var currentPathElementID = ReactMount.getID(currentPathElement);
+ var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
+ bookKeeping.ancestors.push(currentPathElement);
+
+ var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
+ eventsFired++;
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
+
+ // Jump to the root of this React render tree
+ while (currentPathElementID !== newRootID) {
+ i++;
+ currentPathElement = path[i];
+ currentPathElementID = ReactMount.getID(currentPathElement);
+ }
+ }
+ }
+ if (eventsFired === 0) {
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
@@ -11346,15 +10286,15 @@
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
- setHandleTopLevel: function(handleTopLevel) {
+ setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
- isEnabled: function() {
+ isEnabled: function () {
return ReactEventListener._enabled;
},
@@ -11358,27 +10298,22 @@
return ReactEventListener._enabled;
},
-
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.listen(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
@@ -11387,36 +10322,29 @@
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.capture(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
- monitorScrollValue: function(refresh) {
+ monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
- dispatchEvent: function(topLevelType, nativeEvent) {
+ dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
- topLevelType,
- nativeEvent
- );
+ var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
@@ -11428,8 +10356,7 @@
};
module.exports = ReactEventListener;
-
-},{"100":100,"140":140,"146":146,"17":17,"22":22,"29":29,"30":30,"72":72,"77":77}],69:[function(_dereq_,module,exports){
+},{"128":128,"146":146,"147":147,"158":158,"24":24,"25":25,"67":67,"72":72,"96":96}],64:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
@@ -11438,181 +10365,63 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
-* @providesModule ReactFragment
-*/
+ * @providesModule ReactFragment
+ */
'use strict';
-var ReactElement = _dereq_(63);
+var ReactChildren = _dereq_(32);
+var ReactElement = _dereq_(57);
-var warning = _dereq_(171);
+var emptyFunction = _dereq_(153);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* We used to allow keyed objects to serve as a collection of ReactElements,
* or nested sets. This allowed us a way to explicitly key a set a fragment of
* components. This is now being replaced with an opaque data structure.
* 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.
*/
-if ("production" !== "development") {
- var fragmentKey = '_reactFragment';
- var didWarnKey = '_reactDidWarn';
- var canWarnForReactFragment = 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}
- );
+var numericPropertyRegex = /^\d+$/;
- canWarnForReactFragment = true;
- } catch (x) { }
-
- var proxyPropertyAccessWithWarning = function(obj, key) {
- Object.defineProperty(obj, key, {
- enumerable: true,
- get: function() {
- ("production" !== "development" ? 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.'
- ) : null);
- this[didWarnKey] = true;
- return this[fragmentKey][key];
- },
- set: function(value) {
- ("production" !== "development" ? warning(
- this[didWarnKey],
- 'A ReactFragment is an immutable opaque type. Mutating its ' +
- 'properties is deprecated.'
- ) : null);
- 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 warnedAboutNumeric = false;
var ReactFragment = {
// Wrap a keyed object in an opaque proxy that warns you if you access any
// of its properties.
- create: function(object) {
- if ("production" !== "development") {
+ create: function (object) {
if (typeof object !== 'object' || !object || Array.isArray(object)) {
- ("production" !== "development" ? warning(
- false,
- 'React.addons.createFragment only accepts a single object.',
- object
- ) : null);
+ "development" !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
return object;
}
if (ReactElement.isValidElement(object)) {
- ("production" !== "development" ? warning(
- false,
- 'React.addons.createFragment does not accept a ReactElement ' +
- 'without a wrapper object.'
- ) : null);
+ "development" !== '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
- });
+
+ !(object.nodeType !== 1) ? "development" !== '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) {
- proxyPropertyAccessWithWarning(proxy, key);
+ if ("development" !== 'production') {
+ if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
+ "development" !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
+ warnedAboutNumeric = true;
}
- Object.preventExtensions(proxy);
- return proxy;
}
+ ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
}
- return object;
- },
- // Extract the original keyed object from the fragment opaque type. Warn if
- // a plain object is passed here.
- extract: function(fragment) {
- if ("production" !== "development") {
- if (canWarnForReactFragment) {
- if (!fragment[fragmentKey]) {
- ("production" !== "development" ? warning(
- didWarnForFragment(fragment),
- 'Any use of a keyed object should be wrapped in ' +
- 'React.addons.createFragment(object) before being passed as a ' +
- 'child.'
- ) : null);
- return fragment;
- }
- return fragment[fragmentKey];
- }
- }
- 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 ("production" !== "development") {
- if (canWarnForReactFragment) {
- // If it is the opaque type, return the keyed object.
- if (fragment[fragmentKey]) {
- return fragment[fragmentKey];
- }
- // 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);
- }
- }
- }
- }
- return fragment;
+
+ return result;
}
};
module.exports = ReactFragment;
-
-},{"171":171,"63":63}],70:[function(_dereq_,module,exports){
+},{"153":153,"161":161,"173":173,"32":32,"57":57}],65:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11626,22 +10435,20 @@
'use strict';
-var DOMProperty = _dereq_(11);
-var EventPluginHub = _dereq_(18);
-var ReactComponentEnvironment = _dereq_(41);
-var ReactClass = _dereq_(38);
-var ReactEmptyComponent = _dereq_(65);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactNativeComponent = _dereq_(80);
-var ReactDOMComponent = _dereq_(48);
-var ReactPerf = _dereq_(82);
-var ReactRootIndex = _dereq_(91);
-var ReactUpdates = _dereq_(100);
+var DOMProperty = _dereq_(10);
+var EventPluginHub = _dereq_(16);
+var ReactComponentEnvironment = _dereq_(36);
+var ReactClass = _dereq_(33);
+var ReactEmptyComponent = _dereq_(59);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactNativeComponent = _dereq_(75);
+var ReactPerf = _dereq_(78);
+var ReactRootIndex = _dereq_(86);
+var ReactUpdates = _dereq_(96);
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
- DOMComponent: ReactDOMComponent.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
@@ -11653,8 +10460,7 @@
};
module.exports = ReactInjection;
-
-},{"100":100,"11":11,"18":18,"33":33,"38":38,"41":41,"48":48,"65":65,"80":80,"82":82,"91":91}],71:[function(_dereq_,module,exports){
+},{"10":10,"16":16,"28":28,"33":33,"36":36,"59":59,"75":75,"78":78,"86":86,"96":96}],66:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11668,11 +10474,11 @@
'use strict';
-var ReactDOMSelection = _dereq_(56);
+var ReactDOMSelection = _dereq_(49);
-var containsNode = _dereq_(123);
-var focusNode = _dereq_(134);
-var getActiveElement = _dereq_(136);
+var containsNode = _dereq_(150);
+var focusNode = _dereq_(155);
+var getActiveElement = _dereq_(156);
function isInDocument(node) {
return containsNode(document.documentElement, node);
@@ -11686,21 +10492,16 @@
*/
var ReactInputSelection = {
- hasSelectionCapabilities: function(elem) {
- return elem && (
- ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
- elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
- );
+ hasSelectionCapabilities: function (elem) {
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
- getSelectionInformation: function() {
+ getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
- selectionRange:
- ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
- ReactInputSelection.getSelection(focusedElem) :
- null
+ selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
@@ -11709,17 +10510,13 @@
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
- restoreSelection: function(priorSelectionInformation) {
+ restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
- if (curFocusedElem !== priorFocusedElem &&
- isInDocument(priorFocusedElem)) {
+ if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
- ReactInputSelection.setSelection(
- priorFocusedElem,
- priorSelectionRange
- );
+ ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
@@ -11731,7 +10528,7 @@
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
- getSelection: function(input) {
+ getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
@@ -11740,7 +10537,7 @@
start: input.selectionStart,
end: input.selectionEnd
};
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
@@ -11756,7 +10553,7 @@
selection = ReactDOMSelection.getOffsets(input);
}
- return selection || {start: 0, end: 0};
+ return selection || { start: 0, end: 0 };
},
/**
@@ -11765,7 +10562,7 @@
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
- setSelection: function(input, offsets) {
+ setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
@@ -11775,7 +10572,7 @@
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
@@ -11788,8 +10585,7 @@
};
module.exports = ReactInputSelection;
-
-},{"123":123,"134":134,"136":136,"56":56}],72:[function(_dereq_,module,exports){
+},{"150":150,"155":155,"156":156,"49":49}],67:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11804,9 +10600,9 @@
'use strict';
-var ReactRootIndex = _dereq_(91);
+var ReactRootIndex = _dereq_(86);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
@@ -11814,7 +10610,7 @@
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
-var MAX_TREE_DEPTH = 100;
+var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
@@ -11847,9 +10643,7 @@
* @private
*/
function isValidID(id) {
- return id === '' || (
- id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
- );
+ return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
@@ -11861,10 +10655,7 @@
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
- return (
- descendantID.indexOf(ancestorID) === 0 &&
- isBoundary(descendantID, ancestorID.length)
- );
+ return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
@@ -11888,19 +10679,8 @@
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
- ("production" !== "development" ? invariant(
- isValidID(ancestorID) && isValidID(destinationID),
- 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
- ancestorID,
- destinationID
- ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
- ("production" !== "development" ? invariant(
- isAncestorIDOf(ancestorID, destinationID),
- 'getNextDescendantID(...): React has made an invalid assumption about ' +
- 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
- ancestorID,
- destinationID
- ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
+ !(isValidID(ancestorID) && isValidID(destinationID)) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
+ !isAncestorIDOf(ancestorID, destinationID) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
@@ -11942,13 +10722,7 @@
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
- ("production" !== "development" ? invariant(
- isValidID(longestCommonID),
- 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
- oneID,
- twoID,
- longestCommonID
- ) : invariant(isValidID(longestCommonID)));
+ !isValidID(longestCommonID) ? "development" !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
@@ -11960,6 +10734,7 @@
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
+ * @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
@@ -11967,23 +10742,13 @@
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
- ("production" !== "development" ? invariant(
- start !== stop,
- 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
- start
- ) : invariant(start !== stop));
+ !(start !== stop) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
- ("production" !== "development" ? invariant(
- traverseUp || isAncestorIDOf(start, stop),
- 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
- 'not have a parent path.',
- start,
- stop
- ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
+ !(traverseUp || isAncestorIDOf(start, stop)) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
- for (var id = start; /* until break */; id = traverse(id, stop)) {
+ for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
@@ -11992,12 +10757,7 @@
// Only break //after// visiting `stop`.
break;
}
- ("production" !== "development" ? invariant(
- depth++ < MAX_TREE_DEPTH,
- 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
- 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
- start, stop
- ) : invariant(depth++ < MAX_TREE_DEPTH));
+ !(depth++ < MAX_TREE_DEPTH) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
@@ -12014,7 +10774,7 @@
* Constructs a React root ID
* @return {string} A React root ID.
*/
- createReactRootID: function() {
+ createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
@@ -12026,7 +10786,7 @@
* @return {string} A React ID.
* @internal
*/
- createReactID: function(rootID, name) {
+ createReactID: function (rootID, name) {
return rootID + name;
},
@@ -12038,7 +10798,7 @@
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
- getReactRootIDFromNodeID: function(id) {
+ getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
@@ -12060,7 +10820,7 @@
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
- traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
+ traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
@@ -12080,7 +10840,7 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseTwoPhase: function(targetID, cb, arg) {
+ traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
@@ -12088,6 +10848,16 @@
},
/**
+ * Same as `traverseTwoPhase` but skips the `targetID`.
+ */
+ traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
+ if (targetID) {
+ traverseParentPath('', targetID, cb, arg, true, true);
+ traverseParentPath(targetID, '', cb, arg, true, true);
+ }
+ },
+
+ /**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
@@ -12099,15 +10869,11 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseAncestors: function(targetID, cb, arg) {
+ traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
- /**
- * Exposed for unit testing.
- * @private
- */
- _getFirstCommonAncestorID: getFirstCommonAncestorID,
+ getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
@@ -12122,8 +10888,7 @@
};
module.exports = ReactInstanceHandles;
-
-},{"150":150,"91":91}],73:[function(_dereq_,module,exports){
+},{"161":161,"86":86}],68:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12152,64 +10917,101 @@
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
- remove: function(key) {
+ remove: function (key) {
key._reactInternalInstance = undefined;
},
- get: function(key) {
+ get: function (key) {
return key._reactInternalInstance;
},
- has: function(key) {
+ has: function (key) {
return key._reactInternalInstance !== undefined;
},
- set: function(key, value) {
+ set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
-
-},{}],74:[function(_dereq_,module,exports){
+},{}],69:[function(_dereq_,module,exports){
/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactLifeCycle
+ * @providesModule ReactIsomorphic
*/
'use strict';
-/**
- * This module manages the bookkeeping when a component is in the process
- * of being mounted or being unmounted. This is used as a way to enforce
- * invariants (or warnings) when it is not recommended to call
- * setState/forceUpdate.
- *
- * currentlyMountingInstance: During the construction phase, it is not possible
- * to trigger an update since the instance is not fully mounted yet. However, we
- * currently allow this as a convenience for mutating the initial state.
- *
- * currentlyUnmountingInstance: During the unmounting phase, the instance is
- * still mounted and can therefore schedule an update. However, this is not
- * recommended and probably an error since it's about to be unmounted.
- * Therefore we still want to trigger in an error for that case.
- */
+var ReactChildren = _dereq_(32);
+var ReactComponent = _dereq_(34);
+var ReactClass = _dereq_(33);
+var ReactDOMFactories = _dereq_(43);
+var ReactElement = _dereq_(57);
+var ReactElementValidator = _dereq_(58);
+var ReactPropTypes = _dereq_(82);
+var ReactVersion = _dereq_(97);
-var ReactLifeCycle = {
- currentlyMountingInstance: null,
- currentlyUnmountingInstance: null
-};
+var assign = _dereq_(24);
+var onlyChild = _dereq_(135);
+
+var createElement = ReactElement.createElement;
+var createFactory = ReactElement.createFactory;
+var cloneElement = ReactElement.cloneElement;
-module.exports = ReactLifeCycle;
+if ("development" !== 'production') {
+ createElement = ReactElementValidator.createElement;
+ createFactory = ReactElementValidator.createFactory;
+ cloneElement = ReactElementValidator.cloneElement;
+}
-},{}],75:[function(_dereq_,module,exports){
+var React = {
+
+ // Modern
+
+ Children: {
+ map: ReactChildren.map,
+ forEach: ReactChildren.forEach,
+ count: ReactChildren.count,
+ toArray: ReactChildren.toArray,
+ only: onlyChild
+ },
+
+ Component: ReactComponent,
+
+ createElement: createElement,
+ cloneElement: cloneElement,
+ isValidElement: ReactElement.isValidElement,
+
+ // Classic
+
+ PropTypes: ReactPropTypes,
+ createClass: ReactClass.createClass,
+ createFactory: createFactory,
+ createMixin: function (mixin) {
+ // Currently a noop. Will be used to validate and trace mixins.
+ return mixin;
+ },
+
+ // This looks DOM specific but these are actually isomorphic helpers
+ // since they are just generating DOM strings.
+ DOM: ReactDOMFactories,
+
+ version: ReactVersion,
+
+ // Hook for JSX spread, don't use this for anything else.
+ __spread: assign
+};
+
+module.exports = React;
+},{"135":135,"24":24,"32":32,"33":33,"34":34,"43":43,"57":57,"58":58,"82":82,"97":97}],70:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12238,7 +11040,7 @@
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
- * this._handleValueChange: function(newValue) {
+ * _handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
@@ -12247,7 +11049,7 @@
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
-var React = _dereq_(31);
+var React = _dereq_(26);
/**
* @param {*} value current value of the link
@@ -12268,9 +11070,7 @@
*/
function createLinkTypeChecker(linkType) {
var shapes = {
- value: typeof linkType === 'undefined' ?
- React.PropTypes.any.isRequired :
- linkType.isRequired,
+ value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
requestChange: React.PropTypes.func.isRequired
};
return React.PropTypes.shape(shapes);
@@ -12281,8 +11081,7 @@
};
module.exports = ReactLink;
-
-},{"31":31}],76:[function(_dereq_,module,exports){
+},{"26":26}],71:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12296,7 +11095,9 @@
'use strict';
-var adler32 = _dereq_(119);
+var adler32 = _dereq_(116);
+
+var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -12305,12 +11106,11 @@
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
- addChecksumToMarkup: function(markup) {
+ addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
- return markup.replace(
- '>',
- ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
- );
+
+ // Add checksum (handle both parent tags and self-closing tags)
+ return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
@@ -12318,10 +11118,8 @@
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
- canReuseMarkup: function(markup, element) {
- var existingChecksum = element.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ canReuseMarkup: function (markup, element) {
+ var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
@@ -12329,8 +11127,7 @@
};
module.exports = ReactMarkupChecksum;
-
-},{"119":119}],77:[function(_dereq_,module,exports){
+},{"116":116}],72:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12344,36 +11141,38 @@
'use strict';
-var DOMProperty = _dereq_(11);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
-var ReactEmptyComponent = _dereq_(65);
-var ReactInstanceHandles = _dereq_(72);
-var ReactInstanceMap = _dereq_(73);
-var ReactMarkupChecksum = _dereq_(76);
-var ReactPerf = _dereq_(82);
-var ReactReconciler = _dereq_(89);
-var ReactUpdateQueue = _dereq_(99);
-var ReactUpdates = _dereq_(100);
-
-var emptyObject = _dereq_(130);
-var containsNode = _dereq_(123);
-var getReactRootElementInContainer = _dereq_(144);
-var instantiateReactComponent = _dereq_(149);
-var invariant = _dereq_(150);
-var setInnerHTML = _dereq_(164);
-var shouldUpdateReactComponent = _dereq_(167);
-var warning = _dereq_(171);
-
-var SEPARATOR = ReactInstanceHandles.SEPARATOR;
+var DOMProperty = _dereq_(10);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactCurrentOwner = _dereq_(39);
+var ReactDOMFeatureFlags = _dereq_(44);
+var ReactElement = _dereq_(57);
+var ReactEmptyComponentRegistry = _dereq_(60);
+var ReactInstanceHandles = _dereq_(67);
+var ReactInstanceMap = _dereq_(68);
+var ReactMarkupChecksum = _dereq_(71);
+var ReactPerf = _dereq_(78);
+var ReactReconciler = _dereq_(84);
+var ReactUpdateQueue = _dereq_(95);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var containsNode = _dereq_(150);
+var instantiateReactComponent = _dereq_(132);
+var invariant = _dereq_(161);
+var setInnerHTML = _dereq_(138);
+var shouldUpdateReactComponent = _dereq_(141);
+var validateDOMNesting = _dereq_(144);
+var warning = _dereq_(173);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
+
+var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
@@ -12381,7 +11180,7 @@
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
-if ("production" !== "development") {
+if ("development" !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
@@ -12406,6 +11205,23 @@
}
/**
+ * @param {DOMElement|DOMDocument} container DOM element that may contain
+ * a React component
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
+ */
+function getReactRootElementInContainer(container) {
+ if (!container) {
+ return null;
+ }
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ return container.documentElement;
+ } else {
+ return container.firstChild;
+ }
+}
+
+/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
@@ -12430,11 +11246,7 @@
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
- ("production" !== "development" ? invariant(
- !isValid(cached, id),
- 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
- ATTR_NAME, id
- ) : invariant(!isValid(cached, id)));
+ !!isValid(cached, id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
@@ -12491,7 +11303,7 @@
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
- if (ReactEmptyComponent.isNullComponentID(id)) {
+ if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
@@ -12512,11 +11324,7 @@
*/
function isValid(node, id) {
if (node) {
- ("production" !== "development" ? invariant(
- internalGetID(node) === id,
- 'ReactMount: Unexpected modification of `%s`',
- ATTR_NAME
- ) : invariant(internalGetID(node) === id));
+ !(internalGetID(node) === id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
@@ -12553,10 +11361,7 @@
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
- ReactInstanceHandles.traverseAncestors(
- targetID,
- findDeepestCachedAncestorImpl
- );
+ ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
@@ -12572,17 +11377,25 @@
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function mountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup) {
- var markup = ReactReconciler.mountComponent(
- componentInstance, rootID, transaction, emptyObject
- );
- componentInstance._isTopLevel = true;
- ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
+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 ("development" !== 'production') {
+ if (context === emptyObject) {
+ context = {};
+ }
+ var tag = container.nodeName.toLowerCase();
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
+ }
+ var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
+ componentInstance._renderedComponent._topLevelWrapper = componentInstance;
+ ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
@@ -12593,25 +11406,107 @@
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function batchedMountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- shouldReuseMarkup) {
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- transaction.perform(
- mountComponentIntoNode,
- null,
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup
- );
+function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
+ /* forceHTML */shouldReuseMarkup);
+ transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
+ * Unmounts a component and removes it from the DOM.
+ *
+ * @param {ReactComponent} instance React component instance.
+ * @param {DOMElement} container DOM element to unmount from.
+ * @final
+ * @internal
+ * @see {ReactMount.unmountComponentAtNode}
+ */
+function unmountComponentFromNode(instance, container) {
+ ReactReconciler.unmountComponent(instance);
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ container = container.documentElement;
+ }
+
+ // http://jsperf.com/emptying-a-node
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+}
+
+/**
+ * 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;
+ if (current == null) {
+ // The passed-in node has been detached from the container it was
+ // originally rendered into.
+ return null;
+ }
+ } while (lastID !== reactRootID);
+
+ if (current === containersByReactRootID[reactRootID]) {
+ return node;
+ }
+ }
+ return null;
+}
+
+/**
+ * Temporary (?) hack so that we can store all top-level pending updates on
+ * composites instead of having to worry about different types of components
+ * here.
+ */
+var TopLevelWrapper = function () {};
+TopLevelWrapper.prototype.isReactComponent = {};
+if ("development" !== 'production') {
+ TopLevelWrapper.displayName = 'TopLevelWrapper';
+}
+TopLevelWrapper.prototype.render = function () {
+ // this.props is actually a ReactElement
+ return this.props;
+};
+
+/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
@@ -12630,6 +11525,9 @@
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
+
+ TopLevelWrapper: TopLevelWrapper,
+
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
@@ -12641,7 +11539,7 @@
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
- scrollMonitor: function(container, renderCallback) {
+ scrollMonitor: function (container, renderCallback) {
renderCallback();
},
@@ -12652,26 +11550,17 @@
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
- _updateRootComponent: function(
- prevComponent,
- nextElement,
- container,
- callback) {
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
- }
-
- ReactMount.scrollMonitor(container, function() {
+ _updateRootComponent: function (prevComponent, nextElement, container, callback) {
+ ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[getReactRootID(container)] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
@@ -12684,15 +11573,8 @@
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
- _registerComponent: function(nextComponent, container) {
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- '_registerComponent(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ _registerComponent: function (nextComponent, container) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
@@ -12708,44 +11590,24 @@
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
- _renderNewRootComponent: function(
- nextElement,
- container,
- shouldReuseMarkup
- ) {
+ _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- '_renderNewRootComponent(): Render methods should be a pure function ' +
- 'of props and state; triggering nested component updates from ' +
- 'render is not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
- var reactRootID = ReactMount._registerComponent(
- componentInstance,
- container
- );
+ var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
- ReactUpdates.batchedUpdates(
- batchedMountComponentIntoNode,
- componentInstance,
- reactRootID,
- container,
- shouldReuseMarkup
- );
+ ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[reactRootID] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
@@ -12758,76 +11620,64 @@
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
+ * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- render: function(nextElement, container, callback) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(nextElement),
- '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.' :
+ renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !(parentComponent != null && parentComponent._reactInternalInstance != null) ? "development" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
+ return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
+ },
+
+ _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !ReactElement.isValidElement(nextElement) ? "development" !== '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
- nextElement != null && nextElement.props !== undefined ?
- ' This may be caused by unintentionally loading two independent ' +
- 'copies of React.' :
- ''
- )
- ) : invariant(ReactElement.isValidElement(nextElement)));
+ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
+
+ "development" !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
+
+ var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
- var prevElement = prevComponent._currentElement;
+ var prevWrappedElement = prevComponent._currentElement;
+ var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
- return ReactMount._updateRootComponent(
- prevComponent,
- nextElement,
- container,
- callback
- ).getPublicInstance();
+ var publicInst = prevComponent._renderedComponent.getPublicInstance();
+ var updatedCallback = callback && function () {
+ callback.call(publicInst);
+ };
+ ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
+ return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
- var containerHasReactMarkup =
- reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
+ var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ if ("development" !== 'production') {
+ "development" !== '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 ("production" !== "development") {
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
- if (ReactMount.isRenderedByReact(rootElementSibling)) {
- ("production" !== "development" ? 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.'
- ) : null);
+ if (internalGetID(rootElementSibling)) {
+ "development" !== '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;
}
}
}
- var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
-
- var component = ReactMount._renderNewRootComponent(
- nextElement,
- container,
- shouldReuseMarkup
- ).getPublicInstance();
+ var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
+ var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
@@ -12835,36 +11685,19 @@
},
/**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into the supplied `container`.
+ * Renders a React component into the DOM in the supplied `container`.
*
- * @param {function} constructor React component constructor.
- * @param {?object} props Initial props of the component instance.
+ * If the React component was previously rendered into `container`, this will
+ * perform an update on it and only mutate the DOM as necessary to reflect the
+ * latest React component.
+ *
+ * @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
+ * @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- constructAndRenderComponent: function(constructor, props, container) {
- var element = ReactElement.createElement(constructor, props);
- return ReactMount.render(element, container);
- },
-
- /**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into a container node identified by supplied `id`.
- *
- * @param {function} componentConstructor React component constructor
- * @param {?object} props Initial props of the component instance.
- * @param {string} id ID of the DOM element to render into.
- * @return {ReactComponent} Component instance rendered in the container node.
- */
- constructAndRenderComponentByID: function(constructor, props, id) {
- var domNode = document.getElementById(id);
- ("production" !== "development" ? invariant(
- domNode,
- 'Tried to get element with id of "%s" but it is not present on the page.',
- id
- ) : invariant(domNode));
- return ReactMount.constructAndRenderComponent(constructor, props, domNode);
+ render: function (nextElement, container, callback) {
+ return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
@@ -12875,7 +11708,7 @@
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
- registerContainer: function(container) {
+ registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
@@ -12896,101 +11729,68 @@
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
- unmountComponentAtNode: function(container) {
+ unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- 'unmountComponentAtNode(): Render methods should be a pure function of ' +
- 'props and state; triggering nested component updates from render is ' +
- 'not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
-
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'unmountComponentAtNode(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
+
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
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 ("development" !== 'production') {
+ "development" !== '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;
}
- ReactMount.unmountComponentFromNode(component, container);
+ ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
- * Unmounts a component and removes it from the DOM.
- *
- * @param {ReactComponent} instance React component instance.
- * @param {DOMElement} container DOM element to unmount from.
- * @final
- * @internal
- * @see {ReactMount.unmountComponentAtNode}
- */
- unmountComponentFromNode: function(instance, container) {
- ReactReconciler.unmountComponent(instance);
-
- if (container.nodeType === DOC_NODE_TYPE) {
- container = container.documentElement;
- }
-
- // http://jsperf.com/emptying-a-node
- while (container.lastChild) {
- container.removeChild(container.lastChild);
- }
- },
-
- /**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
- findReactContainerForID: function(id) {
+ findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
- ("production" !== "development" ? invariant(
+ "development" !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID,
- 'ReactMount: Root element ID differed from reactRootID.'
- ) : invariant(// Call internalGetID here because getID calls isValid which calls
- // findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID));
-
+ internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
- if (containerChild &&
- reactRootID === internalGetID(containerChild)) {
+ if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
- ("production" !== "development" ? warning(
- false,
- 'ReactMount: Root element has been removed from its original ' +
- 'container. New container:', rootElement.parentNode
- ) : null);
+ "development" !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
@@ -13004,44 +11804,21 @@
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
- findReactNodeByID: function(id) {
+ findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
- * 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.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
- getFirstReactDOM: function(node) {
- var current = node;
- while (current && current.parentNode !== current) {
- if (ReactMount.isRenderedByReact(current)) {
- return current;
- }
- current = current.parentNode;
- }
- return null;
+ getFirstReactDOM: function (node) {
+ return findFirstReactDOMImpl(node);
},
/**
@@ -13054,12 +11831,17 @@
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
- findComponentRoot: function(ancestorNode, targetID) {
+ findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
+ if ("development" !== 'production') {
+ // This will throw on the next line; give an early warning
+ "development" !== '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;
firstChildren.length = 1;
@@ -13110,91 +11891,68 @@
firstChildren.length = 0;
- ("production" !== "development" ? invariant(
- false,
- 'findComponentRoot(..., %s): Unable to find element. This probably ' +
- 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
- 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
- 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
- 'parent. ' +
- 'Try inspecting the child nodes of the element with React ID `%s`.',
- targetID,
- ReactMount.getID(ancestorNode)
- ) : invariant(false));
- },
-
- _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'mountComponentIntoNode(...): Target container is not valid.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ !false ? "development" !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
+ },
+
+ _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
- var checksum = rootElement.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
- rootElement.setAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
- checksum
- );
+ rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
+
+ var normalizedMarkup = markup;
+ if ("development" !== 'production') {
+ // because rootMarkup is retrieved from the DOM, various normalizations
+ // will have occurred which will not be present in `markup`. Here,
+ // insert markup into a <div> or <iframe> depending on the container
+ // type to perform the same normalizations before comparing.
+ var normalizer;
+ if (container.nodeType === ELEMENT_NODE_TYPE) {
+ normalizer = document.createElement('div');
+ normalizer.innerHTML = markup;
+ normalizedMarkup = normalizer.innerHTML;
+ } else {
+ normalizer = document.createElement('iframe');
+ document.body.appendChild(normalizer);
+ normalizer.contentDocument.write(markup);
+ normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
+ document.body.removeChild(normalizer);
+ }
+ }
+
+ var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
+ var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
+
+ !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
- var diffIndex = firstDifferenceIndex(markup, rootMarkup);
- var difference = ' (client) ' +
- markup.substring(diffIndex - 20, diffIndex + 20) +
- '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
-
- ("production" !== "development" ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document using ' +
- 'server rendering but the checksum was invalid. This usually ' +
- 'means you rendered a different component type or props on ' +
- 'the client from the one on the server, or your render() ' +
- 'methods are impure. React cannot handle this case due to ' +
- 'cross-browser quirks by rendering at the document root. You ' +
- 'should look for environment dependent code in your components ' +
- 'and ensure the props are the same client and server side:\n%s',
- difference
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- false,
- 'React attempted to reuse markup in a container but the ' +
- 'checksum was invalid. This generally means that you are ' +
- 'using server rendering and the markup generated on the ' +
- 'server was not what the client was expecting. React injected ' +
- 'new markup to compensate which works but you have lost many ' +
- 'of the benefits of server rendering. Instead, figure out ' +
- 'why the markup being generated is different on the client ' +
- 'or server:\n%s',
- difference
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
- ("production" !== "development" ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- '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(container.nodeType !== DOC_NODE_TYPE));
+ !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== '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;
+ if (transaction.useCreateElement) {
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+ container.appendChild(markup);
+ } else {
setInnerHTML(container, markup);
+ }
},
+ ownerDocumentContextKey: ownerDocumentContextKey,
+
/**
* React ID utilities.
*/
@@ -13209,6 +11967,8 @@
getNodeFromInstance: getNodeFromInstance,
+ isValid: isValid,
+
purgeID: purgeID
};
@@ -13218,8 +11978,7 @@
});
module.exports = ReactMount;
-
-},{"100":100,"11":11,"123":123,"130":130,"144":144,"149":149,"150":150,"164":164,"167":167,"171":171,"33":33,"45":45,"63":63,"64":64,"65":65,"72":72,"73":73,"76":76,"82":82,"89":89,"99":99}],78:[function(_dereq_,module,exports){
+},{"10":10,"132":132,"138":138,"141":141,"144":144,"150":150,"154":154,"161":161,"173":173,"24":24,"28":28,"39":39,"44":44,"57":57,"60":60,"67":67,"68":68,"71":71,"78":78,"84":84,"95":95,"96":96}],73:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13234,11 +11993,14 @@
'use strict';
-var ReactComponentEnvironment = _dereq_(41);
-var ReactMultiChildUpdateTypes = _dereq_(79);
+var ReactComponentEnvironment = _dereq_(36);
+var ReactMultiChildUpdateTypes = _dereq_(74);
-var ReactReconciler = _dereq_(89);
-var ReactChildReconciler = _dereq_(36);
+var ReactCurrentOwner = _dereq_(39);
+var ReactReconciler = _dereq_(84);
+var ReactChildReconciler = _dereq_(31);
+
+var flattenChildren = _dereq_(123);
/**
* Updating children of a component may trigger recursive updates. The depth is
@@ -13275,14 +12037,14 @@
* @param {number} toIndex Destination index.
* @private
*/
-function enqueueMarkup(parentID, markup, toIndex) {
+function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
- textContent: null,
+ content: null,
fromIndex: null,
toIndex: toIndex
});
@@ -13303,7 +12065,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
@@ -13323,13 +12085,33 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
+ * Enqueues setting the markup of a node.
+ *
+ * @param {string} parentID ID of the parent component.
+ * @param {string} markup Markup that renders into an element.
+ * @private
+ */
+function enqueueSetMarkup(parentID, markup) {
+ // NOTE: Null values reduce hidden classes.
+ updateQueue.push({
+ parentID: parentID,
+ parentNode: null,
+ type: ReactMultiChildUpdateTypes.SET_MARKUP,
+ markupIndex: null,
+ content: markup,
+ fromIndex: null,
+ toIndex: null
+ });
+}
+
+/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
@@ -13343,7 +12125,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
- textContent: textContent,
+ content: textContent,
fromIndex: null,
toIndex: null
});
@@ -13356,10 +12138,7 @@
*/
function processQueue() {
if (updateQueue.length) {
- ReactComponentEnvironment.processChildrenUpdates(
- updateQueue,
- markupQueue
- );
+ ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
@@ -13391,6 +12170,37 @@
*/
Mixin: {
+ _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
+ if ("development" !== '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 ("development" !== '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);
+ },
+
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
@@ -13399,10 +12209,8 @@
* @return {array} An array of mounted representations.
* @internal
*/
- mountChildren: function(nestedChildren, transaction, context) {
- var children = ReactChildReconciler.instantiateChildren(
- nestedChildren, transaction, context
- );
+ mountChildren: function (nestedChildren, transaction, context) {
+ var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
@@ -13411,15 +12219,9 @@
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
- child._mountIndex = index;
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
+ child._mountIndex = index++;
mountImages.push(mountImage);
- index++;
}
}
return mountImages;
@@ -13431,7 +12233,7 @@
* @param {string} nextContent String of content.
* @internal
*/
- updateTextContent: function(nextContent) {
+ updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
@@ -13441,7 +12243,7 @@
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
- this._unmountChildByName(prevChildren[name], name);
+ this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
@@ -13460,17 +12262,49 @@
},
/**
+ * Replaces any rendered children with a markup string.
+ *
+ * @param {string} nextMarkup String of markup.
+ * @internal
+ */
+ updateMarkup: function (nextMarkup) {
+ updateDepth++;
+ var errorThrown = true;
+ try {
+ var prevChildren = this._renderedChildren;
+ // Remove any rendered children.
+ ReactChildReconciler.unmountChildren(prevChildren);
+ for (var name in prevChildren) {
+ if (prevChildren.hasOwnProperty(name)) {
+ this._unmountChildByName(prevChildren[name], name);
+ }
+ }
+ this.setMarkup(nextMarkup);
+ errorThrown = false;
+ } finally {
+ updateDepth--;
+ if (!updateDepth) {
+ if (errorThrown) {
+ clearQueue();
+ } else {
+ processQueue();
+ }
+ }
+ }
+ },
+
+ /**
* Updates the rendered children with new children.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- updateChildren: function(nextNestedChildren, transaction, context) {
+ updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
- this._updateChildren(nextNestedChildren, transaction, context);
+ this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
@@ -13489,16 +12322,14 @@
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
- _updateChildren: function(nextNestedChildren, transaction, context) {
+ _updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
- var nextChildren = ReactChildReconciler.updateChildren(
- prevChildren, nextNestedChildren, transaction, context
- );
+ var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
@@ -13522,20 +12353,17 @@
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
- this._unmountChildByName(prevChild, name);
+ this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
- this._mountChildByNameAtIndex(
- nextChild, name, nextIndex, transaction, context
- );
+ this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
- this._unmountChildByName(prevChildren[name], name);
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ this._unmountChild(prevChildren[name]);
}
}
},
@@ -13546,7 +12374,7 @@
*
* @internal
*/
- unmountChildren: function() {
+ unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
@@ -13560,7 +12388,7 @@
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
- moveChild: function(child, toIndex, lastIndex) {
+ moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
@@ -13576,8 +12404,8 @@
* @param {string} mountImage Markup to insert.
* @protected
*/
- createChild: function(child, mountImage) {
- enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
+ createChild: function (child, mountImage) {
+ enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
@@ -13586,7 +12414,7 @@
* @param {ReactComponent} child Child to remove.
* @protected
*/
- removeChild: function(child) {
+ removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
@@ -13596,11 +12424,21 @@
* @param {string} textContent Text content to set.
* @protected
*/
- setTextContent: function(textContent) {
+ setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
+ * Sets this markup string.
+ *
+ * @param {string} markup Markup to set.
+ * @protected
+ */
+ setMarkup: function (markup) {
+ enqueueSetMarkup(this._rootNodeID, markup);
+ },
+
+ /**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
@@ -13611,34 +12449,23 @@
* @param {ReactReconcileTransaction} transaction
* @private
*/
- _mountChildByNameAtIndex: function(
- child,
- name,
- index,
- transaction,
- context) {
+ _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
- * Unmounts a rendered child by name.
+ * Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
- * @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
- _unmountChildByName: function(child, name) {
+ _unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}
@@ -13648,8 +12475,7 @@
};
module.exports = ReactMultiChild;
-
-},{"36":36,"41":41,"79":79,"89":89}],79:[function(_dereq_,module,exports){
+},{"123":123,"31":31,"36":36,"39":39,"74":74,"84":84}],74:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13663,7 +12489,7 @@
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
/**
* When a component's children are updated, a series of update configuration
@@ -13677,12 +12503,12 @@
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
+ SET_MARKUP: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
-
-},{"156":156}],80:[function(_dereq_,module,exports){
+},{"165":165}],75:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -13696,35 +12522,30 @@
'use strict';
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
-// This registry keeps track of wrapper classes around native tags
+// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
- injectGenericComponentClass: function(componentClass) {
+ injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
- injectTextComponentClass: function(componentClass) {
+ injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
- injectComponentClasses: function(componentClasses) {
+ injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
- },
- // Temporary hack since we expect DOM refs to behave like composites,
- // for this release.
- injectAutoWrapper: function(wrapperFactory) {
- autoGenerateWrapperClass = wrapperFactory;
}
};
@@ -13753,11 +12574,7 @@
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
- ("production" !== "development" ? invariant(
- genericComponentClass,
- 'There is no registered component for the tag %s',
- element.type
- ) : invariant(genericComponentClass));
+ !genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}
@@ -13786,8 +12603,126 @@
};
module.exports = ReactNativeComponent;
+},{"161":161,"24":24}],76:[function(_dereq_,module,exports){
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactNoopUpdateQueue
+ */
+
+'use strict';
+
+var warning = _dereq_(173);
+
+function warnTDZ(publicInstance, callerName) {
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
+ }
+}
+
+/**
+ * This is the abstract API for an update queue.
+ */
+var ReactNoopUpdateQueue = {
+
+ /**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ return false;
+ },
+
+ /**
+ * Enqueue a callback that will be executed after all the pending updates
+ * have processed.
+ *
+ * @param {ReactClass} publicInstance The instance to use as `this` context.
+ * @param {?function} callback Called after state is updated.
+ * @internal
+ */
+ enqueueCallback: function (publicInstance, callback) {},
+
+ /**
+ * Forces an update. This should only be invoked when it is known with
+ * certainty that we are **not** in a DOM transaction.
+ *
+ * You may want to call this when you know that some deeper aspect of the
+ * component's state has changed but `setState` was not called.
+ *
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
+ * `componentWillUpdate` and `componentDidUpdate`.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @internal
+ */
+ enqueueForceUpdate: function (publicInstance) {
+ warnTDZ(publicInstance, 'forceUpdate');
+ },
+
+ /**
+ * Replaces all of the state. Always use this or `setState` to mutate state.
+ * You should treat `this.state` as immutable.
+ *
+ * There is no guarantee that `this.state` will be immediately updated, so
+ * accessing `this.state` after calling this method may return the old value.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} completeState Next state.
+ * @internal
+ */
+ enqueueReplaceState: function (publicInstance, completeState) {
+ warnTDZ(publicInstance, 'replaceState');
+ },
+
+ /**
+ * Sets a subset of the state. This only exists because _pendingState is
+ * internal. This provides a merging strategy that is not available to deep
+ * properties which is confusing. TODO: Expose pendingState or don't use it
+ * during the merge.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialState Next partial state to be merged with state.
+ * @internal
+ */
+ enqueueSetState: function (publicInstance, partialState) {
+ warnTDZ(publicInstance, 'setState');
+ },
+
+ /**
+ * Sets a subset of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialProps Subset of the next props.
+ * @internal
+ */
+ enqueueSetProps: function (publicInstance, partialProps) {
+ warnTDZ(publicInstance, 'setProps');
+ },
+
+ /**
+ * Replaces all of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} props New props.
+ * @internal
+ */
+ enqueueReplaceProps: function (publicInstance, props) {
+ warnTDZ(publicInstance, 'replaceProps');
+ }
-},{"150":150,"29":29}],81:[function(_dereq_,module,exports){
+};
+
+module.exports = ReactNoopUpdateQueue;
+},{"173":173}],77:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13801,7 +12736,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* ReactOwners are capable of storing references to owned components.
@@ -13840,11 +12775,8 @@
* @return {boolean} True if `object` is a valid owner.
* @final
*/
- isValidOwner: function(object) {
- return !!(
- (object &&
- typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
- );
+ isValidOwner: function (object) {
+ return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
@@ -13856,15 +12788,8 @@
* @final
* @internal
*/
- addComponentAsRefTo: function(component, ref, owner) {
- ("production" !== "development" ? invariant(
- ReactOwner.isValidOwner(owner),
- '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(ReactOwner.isValidOwner(owner)));
+ addComponentAsRefTo: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? "development" !== '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);
},
@@ -13877,15 +12802,8 @@
* @final
* @internal
*/
- removeComponentAsRefFrom: function(component, ref, owner) {
- ("production" !== "development" ? invariant(
- ReactOwner.isValidOwner(owner),
- 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to remove 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(ReactOwner.isValidOwner(owner)));
+ removeComponentAsRefFrom: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? "development" !== '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
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
@@ -13896,8 +12814,7 @@
};
module.exports = ReactOwner;
-
-},{"150":150}],82:[function(_dereq_,module,exports){
+},{"161":161}],78:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13934,17 +12851,13 @@
* @param {string} objectName
* @param {object<string>} methodNames
*/
- measureMethods: function(object, objectName, methodNames) {
- if ("production" !== "development") {
+ measureMethods: function (object, objectName, methodNames) {
+ if ("development" !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
- object[key] = ReactPerf.measure(
- objectName,
- methodNames[key],
- object[key]
- );
+ object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
@@ -13957,10 +12870,10 @@
* @param {function} func
* @return {function}
*/
- measure: function(objName, fnName, func) {
- if ("production" !== "development") {
+ measure: function (objName, fnName, func) {
+ if ("development" !== 'production') {
var measuredFunc = null;
- var wrapper = function() {
+ var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
@@ -13979,7 +12892,7 @@
/**
* @param {function} measure
*/
- injectMeasure: function(measure) {
+ injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}
@@ -13998,8 +12911,7 @@
}
module.exports = ReactPerf;
-
-},{}],83:[function(_dereq_,module,exports){
+},{}],79:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14013,9 +12925,9 @@
'use strict';
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
-var joinClasses = _dereq_(155);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
+var joinClasses = _dereq_(164);
/**
* Creates a transfer strategy that will merge prop values using the supplied
@@ -14025,7 +12937,7 @@
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
- return function(props, key, value) {
+ return function (props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
@@ -14034,7 +12946,7 @@
};
}
-var transferStrategyMerge = createTransferStrategy(function(a, b) {
+var transferStrategyMerge = createTransferStrategy(function (a, b) {
// `merge` overrides the first object's (`props[key]` above) keys using the
// second object's (`value`) keys. An object's style's existing `propA` would
// get overridden. Flip the order here.
@@ -14101,15 +13013,14 @@
* @param {object} newProps new props to merge in
* @return {object} a new object containing both sets of props merged.
*/
- mergeProps: function(oldProps, newProps) {
+ mergeProps: function (oldProps, newProps) {
return transferInto(assign({}, oldProps), newProps);
}
};
module.exports = ReactPropTransferer;
-
-},{"129":129,"155":155,"29":29}],84:[function(_dereq_,module,exports){
+},{"153":153,"164":164,"24":24}],80:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14125,7 +13036,7 @@
var ReactPropTypeLocationNames = {};
-if ("production" !== "development") {
+if ("development" !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
@@ -14134,8 +13045,7 @@
}
module.exports = ReactPropTypeLocationNames;
-
-},{}],85:[function(_dereq_,module,exports){
+},{}],81:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14149,7 +13059,7 @@
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
var ReactPropTypeLocations = keyMirror({
prop: null,
@@ -14158,8 +13068,7 @@
});
module.exports = ReactPropTypeLocations;
-
-},{"156":156}],86:[function(_dereq_,module,exports){
+},{"165":165}],82:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14173,11 +13082,11 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactFragment = _dereq_(69);
-var ReactPropTypeLocationNames = _dereq_(84);
+var ReactElement = _dereq_(57);
+var ReactPropTypeLocationNames = _dereq_(80);
-var emptyFunction = _dereq_(129);
+var emptyFunction = _dereq_(153);
+var getIteratorFn = _dereq_(129);
/**
* Collection of methods that allow declaration and validation of props that are
@@ -14228,9 +13137,6 @@
var ANONYMOUS = '<<anonymous>>';
-var elementTypeChecker = createElementTypeChecker();
-var nodeTypeChecker = createNodeChecker();
-
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
@@ -14241,9 +13147,9 @@
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
- element: elementTypeChecker,
+ element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
- node: nodeTypeChecker,
+ node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
@@ -14251,19 +13157,17 @@
};
function createChainableTypeChecker(validate) {
- function checkType(isRequired, props, propName, componentName, location) {
+ function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
+ propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
- return new Error(
- ("Required " + locationName + " `" + propName + "` was not specified in ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
- return validate(props, propName, componentName, location);
+ return validate(props, propName, componentName, location, propFullName);
}
}
@@ -14274,7 +13178,7 @@
}
function createPrimitiveTypeChecker(expectedType) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
@@ -14284,10 +13188,7 @@
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
- ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
@@ -14299,18 +13200,15 @@
}
function createArrayOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
- var error = typeChecker(propValue, i, componentName, location);
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -14321,13 +13219,10 @@
}
function createElementTypeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactElement.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
@@ -14335,14 +13230,12 @@
}
function createInstanceTypeChecker(expectedClass) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` 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 + '`.'));
}
return null;
}
@@ -14350,7 +13243,13 @@
}
function createEnumTypeChecker(expectedValues) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(expectedValues)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
@@ -14360,28 +13259,22 @@
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
- ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
- var error = typeChecker(propValue, key, componentName, location);
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -14393,31 +13286,31 @@
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(arrayOfTypeCheckers)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
- if (checker(props, propName, componentName, location) == null) {
+ if (checker(props, propName, componentName, location, propFullName, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED') == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactNode.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
@@ -14425,22 +13318,19 @@
}
function createShapeTypeChecker(shapeTypes) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
- ("supplied to `" + componentName + "`, expected `object`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
- var error = checker(propValue, key, componentName, location);
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error) {
return error;
}
@@ -14465,12 +13355,32 @@
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
- propValue = ReactFragment.extractIfFragment(propValue);
- for (var k in propValue) {
- if (!isNode(propValue[k])) {
+
+ var iteratorFn = getIteratorFn(propValue);
+ if (iteratorFn) {
+ var iterator = iteratorFn.call(propValue);
+ var step;
+ if (iteratorFn !== propValue.entries) {
+ while (!(step = iterator.next()).done) {
+ if (!isNode(step.value)) {
+ return false;
+ }
+ }
+ } else {
+ // Iterator will provide entry [k,v] tuples rather than values.
+ while (!(step = iterator.next()).done) {
+ var entry = step.value;
+ if (entry) {
+ if (!isNode(entry[1])) {
return false;
}
}
+ }
+ }
+ } else {
+ return false;
+ }
+
return true;
default:
return false;
@@ -14506,65 +13416,16 @@
return propType;
}
-module.exports = ReactPropTypes;
-
-},{"129":129,"63":63,"69":69,"84":84}],87:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactPutListenerQueue
- */
-
-'use strict';
-
-var PooledClass = _dereq_(30);
-var ReactBrowserEventEmitter = _dereq_(33);
-
-var assign = _dereq_(29);
-
-function ReactPutListenerQueue() {
- this.listenersToPut = [];
-}
-
-assign(ReactPutListenerQueue.prototype, {
- enqueuePutListener: function(rootNodeID, propKey, propValue) {
- this.listenersToPut.push({
- rootNodeID: rootNodeID,
- propKey: propKey,
- propValue: propValue
- });
- },
-
- putListeners: function() {
- for (var i = 0; i < this.listenersToPut.length; i++) {
- var listenerToPut = this.listenersToPut[i];
- ReactBrowserEventEmitter.putListener(
- listenerToPut.rootNodeID,
- listenerToPut.propKey,
- listenerToPut.propValue
- );
+// Returns class name of the object, if any.
+function getClassName(propValue) {
+ if (!propValue.constructor || !propValue.constructor.name) {
+ return '<<anonymous>>';
}
- },
-
- reset: function() {
- this.listenersToPut.length = 0;
- },
-
- destructor: function() {
- this.reset();
- }
-});
-
-PooledClass.addPoolingTo(ReactPutListenerQueue);
-
-module.exports = ReactPutListenerQueue;
+ return propValue.constructor.name;
+}
-},{"29":29,"30":30,"33":33}],88:[function(_dereq_,module,exports){
+module.exports = ReactPropTypes;
+},{"129":129,"153":153,"57":57,"80":80}],83:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14579,14 +13440,14 @@
'use strict';
-var CallbackQueue = _dereq_(7);
-var PooledClass = _dereq_(30);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactInputSelection = _dereq_(71);
-var ReactPutListenerQueue = _dereq_(87);
-var Transaction = _dereq_(116);
+var CallbackQueue = _dereq_(6);
+var PooledClass = _dereq_(25);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactDOMFeatureFlags = _dereq_(44);
+var ReactInputSelection = _dereq_(66);
+var Transaction = _dereq_(113);
-var assign = _dereq_(29);
+var assign = _dereq_(24);
/**
* Ensures that, when possible, the selection range (currently selected text
@@ -14613,7 +13474,7 @@
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
- initialize: function() {
+ initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
@@ -14621,10 +13482,10 @@
/**
* @param {boolean} previouslyEnabled Enabled status of
- * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
+ * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
- close: function(previouslyEnabled) {
+ close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
@@ -14637,39 +13498,24 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
- close: function() {
+ close: function () {
this.reactMountReady.notifyAll();
}
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: function() {
- this.putListenerQueue.putListeners();
- }
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- SELECTION_RESTORATION,
- EVENT_SUPPRESSION,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
@@ -14685,7 +13531,7 @@
*
* @class ReactReconcileTransaction
*/
-function ReactReconcileTransaction() {
+function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
@@ -14694,7 +13540,7 @@
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
@@ -14702,34 +13548,27 @@
* @see Transaction
* @abstract
* @final
- * @return {array<object>} List of operation wrap proceedures.
+ * @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
@@ -14733,14 +13572,12 @@
}
};
-
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
-
-},{"116":116,"29":29,"30":30,"33":33,"7":7,"71":71,"87":87}],89:[function(_dereq_,module,exports){
+},{"113":113,"24":24,"25":25,"28":28,"44":44,"6":6,"66":66}],84:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14754,8 +13591,7 @@
'use strict';
-var ReactRef = _dereq_(90);
-var ReactElementValidator = _dereq_(64);
+var ReactRef = _dereq_(85);
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
@@ -14777,14 +13613,11 @@
* @final
* @internal
*/
- mountComponent: function(internalInstance, rootID, transaction, context) {
+ mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(
- internalInstance._currentElement
- );
- }
+ if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
+ }
return markup;
},
@@ -14794,7 +13627,7 @@
* @final
* @internal
*/
- unmountComponent: function(internalInstance) {
+ unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
@@ -14808,12 +13641,10 @@
* @param {object} context
* @internal
*/
- receiveComponent: function(
- internalInstance, nextElement, transaction, context
- ) {
+ receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
- if (nextElement === prevElement && nextElement._owner != null) {
+ 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
@@ -14821,17 +13652,13 @@
// 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.
- return;
- }
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
+ // 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
- );
+ var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
@@ -14839,7 +13666,7 @@
internalInstance.receiveComponent(nextElement, transaction, context);
- if (refsChanged) {
+ if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
@@ -14851,18 +13678,14 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(
- internalInstance,
- transaction
- ) {
+ performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
-
-},{"64":64,"90":90}],90:[function(_dereq_,module,exports){
+},{"85":85}],85:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14876,7 +13699,7 @@
'use strict';
-var ReactOwner = _dereq_(81);
+var ReactOwner = _dereq_(77);
var ReactRef = {};
@@ -14898,14 +13721,17 @@
}
}
-ReactRef.attachRefs = function(instance, element) {
+ReactRef.attachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
-ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
+ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
@@ -14918,13 +13744,19 @@
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
- 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.
+ prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
-ReactRef.detachRefs = function(instance, element) {
+ReactRef.detachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
@@ -14932,8 +13764,7 @@
};
module.exports = ReactRef;
-
-},{"81":81}],91:[function(_dereq_,module,exports){
+},{"77":77}],86:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14952,7 +13783,7 @@
/**
* @param {function} _createReactRootIndex
*/
- injectCreateReactRootIndex: function(_createReactRootIndex) {
+ injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
@@ -14963,8 +13794,31 @@
};
module.exports = ReactRootIndex;
+},{}],87:[function(_dereq_,module,exports){
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactServerBatchingStrategy
+ * @typechecks
+ */
+
+'use strict';
+
+var ReactServerBatchingStrategy = {
+ isBatchingUpdates: false,
+ batchedUpdates: function (callback) {
+ // Don't do anything here. During the server rendering we don't want to
+ // schedule any updates. We will simply ignore them.
+ }
+};
-},{}],92:[function(_dereq_,module,exports){
+module.exports = ReactServerBatchingStrategy;
+},{}],88:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14978,39 +13832,42 @@
*/
'use strict';
-var ReactElement = _dereq_(63);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMarkupChecksum = _dereq_(76);
-var ReactServerRenderingTransaction =
- _dereq_(93);
-
-var emptyObject = _dereq_(130);
-var instantiateReactComponent = _dereq_(149);
-var invariant = _dereq_(150);
+var ReactDefaultBatchingStrategy = _dereq_(53);
+var ReactElement = _dereq_(57);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMarkupChecksum = _dereq_(71);
+var ReactServerBatchingStrategy = _dereq_(87);
+var ReactServerRenderingTransaction = _dereq_(89);
+var ReactUpdates = _dereq_(96);
+
+var emptyObject = _dereq_(154);
+var instantiateReactComponent = _dereq_(132);
+var invariant = _dereq_(161);
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(element),
- 'renderToString(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
- var markup =
- componentInstance.mountComponent(id, transaction, emptyObject);
+ var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -15020,22 +13877,24 @@
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(element),
- 'renderToStaticMarkup(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -15043,8 +13902,7 @@
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
-
-},{"130":130,"149":149,"150":150,"63":63,"72":72,"76":76,"93":93}],93:[function(_dereq_,module,exports){
+},{"132":132,"154":154,"161":161,"53":53,"57":57,"67":67,"71":71,"87":87,"89":89,"96":96}],89:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -15059,13 +13917,12 @@
'use strict';
-var PooledClass = _dereq_(30);
-var CallbackQueue = _dereq_(7);
-var ReactPutListenerQueue = _dereq_(87);
-var Transaction = _dereq_(116);
+var PooledClass = _dereq_(25);
+var CallbackQueue = _dereq_(6);
+var Transaction = _dereq_(113);
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
@@ -15075,30 +13932,19 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: emptyFunction
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
@@ -15108,7 +13954,7 @@
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = false;
}
var Mixin = {
@@ -15116,48 +13962,35 @@
* @see Transaction
* @abstract
* @final
- * @return {array} Empty list of operation wrap proceedures.
+ * @return {array} Empty list of operation wrap procedures.
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
-
-assign(
- ReactServerRenderingTransaction.prototype,
- Transaction.Mixin,
- Mixin
-);
+assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
-
-},{"116":116,"129":129,"29":29,"30":30,"7":7,"87":87}],94:[function(_dereq_,module,exports){
+},{"113":113,"153":153,"24":24,"25":25,"6":6}],90:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15182,8 +14015,8 @@
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
- createStateSetter: function(component, funcReturningState) {
- return function(a, b, c, d, e, f) {
+ createStateSetter: function (component, funcReturningState) {
+ return function (a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
@@ -15202,7 +14035,7 @@
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
- createStateKeySetter: function(component, key) {
+ createStateKeySetter: function (component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
@@ -15237,7 +14070,7 @@
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
- createStateSetter: function(funcReturningState) {
+ createStateSetter: function (funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
@@ -15256,14 +14089,13 @@
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
- createStateKeySetter: function(key) {
+ createStateKeySetter: function (key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
module.exports = ReactStateSetters;
-
-},{}],95:[function(_dereq_,module,exports){
+},{}],91:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15277,22 +14109,24 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPropagators = _dereq_(21);
-var React = _dereq_(31);
-var ReactElement = _dereq_(63);
-var ReactEmptyComponent = _dereq_(65);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactCompositeComponent = _dereq_(43);
-var ReactInstanceHandles = _dereq_(72);
-var ReactInstanceMap = _dereq_(73);
-var ReactMount = _dereq_(77);
-var ReactUpdates = _dereq_(100);
-var SyntheticEvent = _dereq_(108);
-
-var assign = _dereq_(29);
-var emptyObject = _dereq_(130);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPropagators = _dereq_(19);
+var React = _dereq_(26);
+var ReactDOM = _dereq_(40);
+var ReactElement = _dereq_(57);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactCompositeComponent = _dereq_(38);
+var ReactInstanceHandles = _dereq_(67);
+var ReactInstanceMap = _dereq_(68);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
+var SyntheticEvent = _dereq_(105);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var findDOMNode = _dereq_(122);
+var invariant = _dereq_(161);
var topLevelTypes = EventConstants.topLevelTypes;
@@ -15302,74 +14136,97 @@
* @class ReactTestUtils
*/
+function findAllInRenderedTreeInternal(inst, test) {
+ if (!inst || !inst.getPublicInstance) {
+ return [];
+ }
+ var publicInst = inst.getPublicInstance();
+ var ret = test(publicInst) ? [publicInst] : [];
+ var currentElement = inst._currentElement;
+ if (ReactTestUtils.isDOMComponent(publicInst)) {
+ var renderedChildren = inst._renderedChildren;
+ var key;
+ for (key in renderedChildren) {
+ if (!renderedChildren.hasOwnProperty(key)) {
+ continue;
+ }
+ ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
+ }
+ } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
+ ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
+ }
+ return ret;
+}
+
/**
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
var ReactTestUtils = {
- renderIntoDocument: function(instance) {
+ renderIntoDocument: function (instance) {
var div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
- return React.render(instance, div);
+ return ReactDOM.render(instance, div);
},
- isElement: function(element) {
+ isElement: function (element) {
return ReactElement.isValidElement(element);
},
- isElementOfType: function(inst, convenienceConstructor) {
- return (
- ReactElement.isValidElement(inst) &&
- inst.type === convenienceConstructor
- );
+ isElementOfType: function (inst, convenienceConstructor) {
+ return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
},
- isDOMComponent: function(inst) {
- // TODO: Fix this heuristic. It's just here because composites can currently
- // pretend to be DOM components.
- return !!(inst && inst.tagName && inst.getDOMNode);
+ isDOMComponent: function (inst) {
+ return !!(inst && inst.nodeType === 1 && inst.tagName);
},
- isDOMComponentElement: function(inst) {
- return !!(inst &&
- ReactElement.isValidElement(inst) &&
- !!inst.tagName);
+ isDOMComponentElement: function (inst) {
+ return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
},
- isCompositeComponent: function(inst) {
- return typeof inst.render === 'function' &&
- typeof inst.setState === 'function';
+ isCompositeComponent: function (inst) {
+ if (ReactTestUtils.isDOMComponent(inst)) {
+ // Accessing inst.setState warns; just return false as that'll be what
+ // this returns when we have DOM nodes as refs directly
+ return false;
+ }
+ return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
},
- isCompositeComponentWithType: function(inst, type) {
- return !!(ReactTestUtils.isCompositeComponent(inst) &&
- (inst.constructor === type));
+ isCompositeComponentWithType: function (inst, type) {
+ if (!ReactTestUtils.isCompositeComponent(inst)) {
+ return false;
+ }
+ var internalInstance = ReactInstanceMap.get(inst);
+ var constructor = internalInstance._currentElement.type;
+
+ return constructor === type;
},
- isCompositeComponentElement: function(inst) {
+ isCompositeComponentElement: function (inst) {
if (!ReactElement.isValidElement(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
- return (
- typeof prototype.render === 'function' &&
- typeof prototype.setState === 'function'
- );
+ return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
},
- isCompositeComponentElementWithType: function(inst, type) {
- return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
- (inst.constructor === type));
+ isCompositeComponentElementWithType: function (inst, type) {
+ var internalInstance = ReactInstanceMap.get(inst);
+ var constructor = internalInstance._currentElement.type;
+
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
},
- getRenderedChildOfCompositeComponent: function(inst) {
+ getRenderedChildOfCompositeComponent: function (inst) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return null;
}
@@ -15377,53 +14234,36 @@
return internalInstance._renderedComponent.getPublicInstance();
},
- findAllInRenderedTree: function(inst, test) {
+ findAllInRenderedTree: function (inst, test) {
if (!inst) {
return [];
}
- var ret = test(inst) ? [inst] : [];
- if (ReactTestUtils.isDOMComponent(inst)) {
- var internalInstance = ReactInstanceMap.get(inst);
- var renderedChildren = internalInstance
- ._renderedComponent
- ._renderedChildren;
- var key;
- for (key in renderedChildren) {
- if (!renderedChildren.hasOwnProperty(key)) {
- continue;
- }
- if (!renderedChildren[key].getPublicInstance) {
- continue;
- }
- ret = ret.concat(
- ReactTestUtils.findAllInRenderedTree(
- renderedChildren[key].getPublicInstance(),
- test
- )
- );
- }
- } else if (ReactTestUtils.isCompositeComponent(inst)) {
- ret = ret.concat(
- ReactTestUtils.findAllInRenderedTree(
- ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
- test
- )
- );
- }
- return ret;
+ !ReactTestUtils.isCompositeComponent(inst) ? "development" !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
+ return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedDOMComponentsWithClass: function(root, className) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- var instClassName = inst.props.className;
- return ReactTestUtils.isDOMComponent(inst) && (
- (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
- );
+ scryRenderedDOMComponentsWithClass: function (root, classNames) {
+ if (!Array.isArray(classNames)) {
+ classNames = classNames.split(/\s+/);
+ }
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ if (ReactTestUtils.isDOMComponent(inst)) {
+ var className = inst.className;
+ if (typeof className !== 'string') {
+ // SVG, probably.
+ className = inst.getAttribute('class') || '';
+ }
+ var classList = className.split(/\s+/);
+ return classNames.every(function (name) {
+ return classList.indexOf(name) !== -1;
+ });
+ }
+ return false;
});
},
@@ -15433,13 +14273,10 @@
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
- findRenderedDOMComponentWithClass: function(root, className) {
- var all =
- ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
+ findRenderedDOMComponentWithClass: function (root, className) {
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
- throw new Error('Did not find exactly one match ' +
- '(found: ' + all.length + ') for class:' + className
- );
+ throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
}
return all[0];
},
@@ -15444,16 +14281,14 @@
return all[0];
},
-
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedDOMComponentsWithTag: function(root, tagName) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- return ReactTestUtils.isDOMComponent(inst) &&
- inst.tagName === tagName.toUpperCase();
+ scryRenderedDOMComponentsWithTag: function (root, tagName) {
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
},
@@ -15463,7 +14298,7 @@
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
- findRenderedDOMComponentWithTag: function(root, tagName) {
+ findRenderedDOMComponentWithTag: function (root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for tag:' + tagName);
@@ -15471,17 +14306,13 @@
return all[0];
},
-
/**
* Finds all instances of components with type equal to `componentType`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedComponentsWithType: function(root, componentType) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- return ReactTestUtils.isCompositeComponentWithType(
- inst,
- componentType
- );
+ scryRenderedComponentsWithType: function (root, componentType) {
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
},
@@ -15491,15 +14322,10 @@
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
- findRenderedComponentWithType: function(root, componentType) {
- var all = ReactTestUtils.scryRenderedComponentsWithType(
- root,
- componentType
- );
+ findRenderedComponentWithType: function (root, componentType) {
+ var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
- throw new Error(
- 'Did not find exactly one match for componentType:' + componentType
- );
+ throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
}
return all[0];
},
@@ -15517,62 +14343,46 @@
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
- mockComponent: function(module, mockTagName) {
- mockTagName = mockTagName || module.mockTagName || "div";
+ mockComponent: function (module, mockTagName) {
+ mockTagName = mockTagName || module.mockTagName || 'div';
- module.prototype.render.mockImplementation(function() {
- return React.createElement(
- mockTagName,
- null,
- this.props.children
- );
+ module.prototype.render.mockImplementation(function () {
+ return React.createElement(mockTagName, null, this.props.children);
});
return this;
},
/**
- * 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.
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
- simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
+ simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
- ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
- topLevelType,
- fakeNativeEvent
- );
+ ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
},
/**
- * 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`.
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
- * @param comp {!ReactDOMComponent}
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
+ * @param {!ReactDOMComponent} comp
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
- simulateNativeEventOnDOMComponent: function(
- topLevelType,
- comp,
- fakeNativeEvent) {
- ReactTestUtils.simulateNativeEventOnNode(
- topLevelType,
- comp.getDOMNode(),
- fakeNativeEvent
- );
+ simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
+ ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
},
- nativeTouchData: function(x, y) {
+ nativeTouchData: function (x, y) {
return {
- touches: [
- {pageX: x, pageY: y}
- ]
+ touches: [{ pageX: x, pageY: y }]
};
},
- createRenderer: function() {
+ createRenderer: function () {
return new ReactShallowRenderer();
},
@@ -15583,73 +14393,70 @@
/**
* @class ReactShallowRenderer
*/
-var ReactShallowRenderer = function() {
+var ReactShallowRenderer = function () {
this._instance = null;
};
-ReactShallowRenderer.prototype.getRenderOutput = function() {
- return (
- (this._instance && this._instance._renderedComponent &&
- this._instance._renderedComponent._renderedOutput)
- || null
- );
+ReactShallowRenderer.prototype.getRenderOutput = function () {
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
};
-var NoopInternalComponent = function(element) {
+var NoopInternalComponent = function (element) {
this._renderedOutput = element;
- this._currentElement = element === null || element === false ?
- ReactEmptyComponent.emptyElement :
- element;
+ this._currentElement = element;
};
NoopInternalComponent.prototype = {
- mountComponent: function() {
- },
+ mountComponent: function () {},
- receiveComponent: function(element) {
+ receiveComponent: function (element) {
this._renderedOutput = element;
- this._currentElement = element === null || element === false ?
- ReactEmptyComponent.emptyElement :
- element;
+ this._currentElement = element;
},
- unmountComponent: function() {
- }
+ unmountComponent: function () {},
+ getPublicInstance: function () {
+ return null;
+ }
};
-var ShallowComponentWrapper = function() { };
-assign(
- ShallowComponentWrapper.prototype,
- ReactCompositeComponent.Mixin, {
- _instantiateReactComponent: function(element) {
+var ShallowComponentWrapper = function () {};
+assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
+ _instantiateReactComponent: function (element) {
return new NoopInternalComponent(element);
},
- _replaceNodeWithMarkupByID: function() {},
- _renderValidatedComponent:
- ReactCompositeComponent.Mixin.
- _renderValidatedComponentWithoutOwnerOrContext
- }
-);
+ _replaceNodeWithMarkupByID: function () {},
+ _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
+});
+
+ReactShallowRenderer.prototype.render = function (element, context) {
+ !ReactElement.isValidElement(element) ? "development" !== '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') ? "development" !== '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;
-ReactShallowRenderer.prototype.render = function(element, context) {
if (!context) {
context = emptyObject;
}
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- this._render(element, transaction, context);
- ReactUpdates.ReactReconcileTransaction.release(transaction);
+ ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
};
-ReactShallowRenderer.prototype.unmount = function() {
+function _batchedRender(renderer, element, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
+ renderer._render(element, transaction, context);
+ ReactUpdates.ReactReconcileTransaction.release(transaction);
+}
+
+ReactShallowRenderer.prototype.unmount = function () {
if (this._instance) {
this._instance.unmountComponent();
}
};
-ReactShallowRenderer.prototype._render = function(element, transaction, context) {
- if (!this._instance) {
+ReactShallowRenderer.prototype._render = function (element, transaction, context) {
+ if (this._instance) {
+ this._instance.receiveComponent(element, transaction, context);
+ } else {
var rootID = ReactInstanceHandles.createReactRootID();
var instance = new ShallowComponentWrapper(element.type);
instance.construct(element);
@@ -15657,8 +14464,6 @@
instance.mountComponent(rootID, transaction, context);
this._instance = instance;
- } else {
- this._instance.receiveComponent(element, transaction, context);
}
};
@@ -15671,29 +14476,32 @@
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
- return function(domComponentOrNode, eventData) {
+ return function (domComponentOrNode, eventData) {
var node;
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- node = domComponentOrNode.getDOMNode();
+ node = findDOMNode(domComponentOrNode);
} else if (domComponentOrNode.tagName) {
node = domComponentOrNode;
}
+ var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
+
var fakeNativeEvent = new Event();
fakeNativeEvent.target = node;
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
- var event = new SyntheticEvent(
- ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
- ReactMount.getID(node),
- fakeNativeEvent
- );
+ var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
assign(event, eventData);
+
+ if (dispatchConfig.phasedRegistrationNames) {
EventPropagators.accumulateTwoPhaseDispatches(event);
+ } else {
+ EventPropagators.accumulateDirectDispatches(event);
+ }
- ReactUpdates.batchedUpdates(function() {
+ ReactUpdates.batchedUpdates(function () {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(true);
});
};
}
@@ -15704,7 +14512,7 @@
var eventType;
for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
/**
- * @param {!Element || ReactDOMComponent} domComponentOrNode
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
@@ -15713,12 +14521,12 @@
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
-EventPluginHub.injection.injectEventPluginOrder = function() {
+EventPluginHub.injection.injectEventPluginOrder = function () {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
-EventPluginHub.injection.injectEventPluginsByName = function() {
+EventPluginHub.injection.injectEventPluginsByName = function () {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
@@ -15742,42 +14550,30 @@
*/
function makeNativeSimulator(eventType) {
- return function(domComponentOrNode, nativeEventData) {
+ return function (domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- ReactTestUtils.simulateNativeEventOnDOMComponent(
- eventType,
- domComponentOrNode,
- fakeNativeEvent
- );
- } else if (!!domComponentOrNode.tagName) {
+ ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
+ } else if (domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
- ReactTestUtils.simulateNativeEventOnNode(
- eventType,
- domComponentOrNode,
- fakeNativeEvent
- );
+ ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
}
};
}
-var eventType;
-for (eventType in topLevelTypes) {
+Object.keys(topLevelTypes).forEach(function (eventType) {
// Event type is stored as 'topClick' - we transform that to 'click'
- var convenienceName = eventType.indexOf('top') === 0 ?
- eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
+ var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
- * @param {!Element || ReactDOMComponent} domComponentOrNode
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
- ReactTestUtils.SimulateNative[convenienceName] =
- makeNativeSimulator(eventType);
-}
+ ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
+});
module.exports = ReactTestUtils;
-
-},{"100":100,"108":108,"130":130,"16":16,"18":18,"21":21,"29":29,"31":31,"33":33,"43":43,"63":63,"65":65,"72":72,"73":73,"77":77}],96:[function(_dereq_,module,exports){
+},{"105":105,"122":122,"15":15,"154":154,"16":16,"161":161,"19":19,"24":24,"26":26,"28":28,"38":38,"40":40,"57":57,"67":67,"68":68,"72":72,"96":96}],92:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15792,24 +14588,21 @@
'use strict';
-var ReactChildren = _dereq_(37);
-var ReactFragment = _dereq_(69);
+var flattenChildren = _dereq_(123);
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().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
- getChildMapping: function(children) {
+ getChildMapping: function (children) {
if (!children) {
return children;
}
- return ReactFragment.extract(ReactChildren.map(children, function(child) {
- return child;
- }));
+ return flattenChildren(children);
},
/**
@@ -15829,7 +14622,7 @@
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
- mergeChildMappings: function(prev, next) {
+ mergeChildMappings: function (prev, next) {
prev = prev || {};
next = next || {};
@@ -15863,9 +14656,7 @@
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
- childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
- pendingNextKey
- );
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
@@ -15881,8 +14672,7 @@
};
module.exports = ReactTransitionChildMapping;
-
-},{"37":37,"69":69}],97:[function(_dereq_,module,exports){
+},{"123":123}],93:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15896,7 +14686,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
/**
* EVENT_NAME_MAP is used to determine which event fired when a
@@ -15969,31 +14759,30 @@
}
var ReactTransitionEvents = {
- addEndEventListener: function(node, eventListener) {
+ addEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
- endEvents.forEach(function(endEvent) {
+ endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
- removeEndEventListener: function(node, eventListener) {
+ removeEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
return;
}
- endEvents.forEach(function(endEvent) {
+ endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
-
-},{"22":22}],98:[function(_dereq_,module,exports){
+},{"147":147}],94:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16007,12 +14796,11 @@
'use strict';
-var React = _dereq_(31);
-var ReactTransitionChildMapping = _dereq_(96);
+var React = _dereq_(26);
+var ReactTransitionChildMapping = _dereq_(92);
-var assign = _dereq_(29);
-var cloneWithProps = _dereq_(122);
-var emptyFunction = _dereq_(129);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
@@ -16022,26 +14810,26 @@
childFactory: React.PropTypes.func
},
- getDefaultProps: function() {
+ getDefaultProps: function () {
return {
component: 'span',
childFactory: emptyFunction.thatReturnsArgument
};
},
- getInitialState: function() {
+ getInitialState: function () {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
- componentWillMount: function() {
+ componentWillMount: function () {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
- componentDidMount: function() {
+ componentDidMount: function () {
var initialChildMapping = this.state.children;
for (var key in initialChildMapping) {
if (initialChildMapping[key]) {
@@ -16050,33 +14838,26 @@
}
},
- componentWillReceiveProps: function(nextProps) {
- var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
- nextProps.children
- );
+ componentWillReceiveProps: function (nextProps) {
+ var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
var prevChildMapping = this.state.children;
this.setState({
- children: ReactTransitionChildMapping.mergeChildMappings(
- prevChildMapping,
- nextChildMapping
- )
+ children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
- if (nextChildMapping[key] && !hasPrev &&
- !this.currentlyTransitioningKeys[key]) {
+ if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
- if (prevChildMapping[key] && !hasNext &&
- !this.currentlyTransitioningKeys[key]) {
+ if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
@@ -16084,7 +14865,7 @@
// If we want to someday check for reordering, we could do it here.
},
- componentDidUpdate: function() {
+ componentDidUpdate: function () {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
@@ -16094,21 +14875,19 @@
keysToLeave.forEach(this.performLeave);
},
- performAppear: function(key) {
+ performAppear: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillAppear) {
- component.componentWillAppear(
- this._handleDoneAppearing.bind(this, key)
- );
+ component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
} else {
this._handleDoneAppearing(key);
}
},
- _handleDoneAppearing: function(key) {
+ _handleDoneAppearing: function (key) {
var component = this.refs[key];
if (component.componentDidAppear) {
component.componentDidAppear();
@@ -16116,9 +14895,7 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully appeared. Remove it.
@@ -16126,21 +14903,19 @@
}
},
- performEnter: function(key) {
+ performEnter: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
- component.componentWillEnter(
- this._handleDoneEntering.bind(this, key)
- );
+ component.componentWillEnter(this._handleDoneEntering.bind(this, key));
} else {
this._handleDoneEntering(key);
}
},
- _handleDoneEntering: function(key) {
+ _handleDoneEntering: function (key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
@@ -16148,9 +14923,7 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
@@ -16158,7 +14931,7 @@
}
},
- performLeave: function(key) {
+ performLeave: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
@@ -16172,7 +14945,7 @@
}
},
- _handleDoneLeaving: function(key) {
+ _handleDoneLeaving: function (key) {
var component = this.refs[key];
if (component.componentDidLeave) {
@@ -16181,21 +14954,21 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
- var newChildren = assign({}, this.state.children);
+ this.setState(function (state) {
+ var newChildren = assign({}, state.children);
delete newChildren[key];
- this.setState({children: newChildren});
+ return { children: newChildren };
+ });
}
},
- render: function() {
+ render: function () {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = [];
@@ -16207,23 +14980,15 @@
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
- childrenToRender.push(cloneWithProps(
- this.props.childFactory(child),
- {ref: key, key: key}
- ));
+ childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
}
}
- return React.createElement(
- this.props.component,
- this.props,
- childrenToRender
- );
+ return React.createElement(this.props.component, this.props, childrenToRender);
}
});
module.exports = ReactTransitionGroup;
-
-},{"122":122,"129":129,"29":29,"31":31,"96":96}],99:[function(_dereq_,module,exports){
+},{"153":153,"24":24,"26":26,"92":92}],95:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
@@ -16237,55 +15002,33 @@
'use strict';
-var ReactLifeCycle = _dereq_(74);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactInstanceMap = _dereq_(73);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactCurrentOwner = _dereq_(39);
+var ReactElement = _dereq_(57);
+var ReactInstanceMap = _dereq_(68);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
function enqueueUpdate(internalInstance) {
- if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
- // If we're in a componentWillMount handler, don't enqueue a rerender
- // because ReactUpdates assumes we're in a browser context (which is
- // wrong for server rendering) and we're about to do a render anyway.
- // See bug in #1740.
ReactUpdates.enqueueUpdate(internalInstance);
- }
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
- ("production" !== "development" ? invariant(
- 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
- ) : invariant(ReactCurrentOwner.current == null));
-
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
- ("production" !== "development" ? warning(
- !callerName,
- '%s(...): Can only update a mounted or mounting component. ' +
- 'This usually means you called %s() on an unmounted ' +
- 'component. This is a no-op.',
- callerName,
- callerName
- ) : null);
+ "development" !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
- if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
- return null;
+ if ("development" !== 'production') {
+ "development" !== '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;
@@ -16298,6 +15041,32 @@
var ReactUpdateQueue = {
/**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ if ("development" !== 'production') {
+ var owner = ReactCurrentOwner.current;
+ if (owner !== null) {
+ "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
+ owner._warnedAboutRefsInRender = true;
+ }
+ }
+ var internalInstance = ReactInstanceMap.get(publicInstance);
+ if (internalInstance) {
+ // During componentWillMount and render this will still be null but after
+ // that will always render to something. At least for now. So we can use
+ // this hack.
+ return !!internalInstance._renderedComponent;
+ } else {
+ return false;
+ }
+ },
+
+ /**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
@@ -16305,13 +15074,8 @@
* @param {?function} callback Called after state is updated.
* @internal
*/
- enqueueCallback: function(publicInstance, callback) {
- ("production" !== "development" ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallback: function (publicInstance, callback) {
+ !(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
@@ -16319,8 +15083,7 @@
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
- if (!internalInstance ||
- internalInstance === ReactLifeCycle.currentlyMountingInstance) {
+ if (!internalInstance) {
return null;
}
@@ -16336,13 +15099,8 @@
enqueueUpdate(internalInstance);
},
- enqueueCallbackInternal: function(internalInstance, callback) {
- ("production" !== "development" ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallbackInternal: function (internalInstance, callback) {
+ !(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
@@ -16358,17 +15116,14 @@
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
- * This will not invoke `shouldUpdateComponent`, but it will invoke
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
- enqueueForceUpdate: function(publicInstance) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'forceUpdate'
- );
+ enqueueForceUpdate: function (publicInstance) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
@@ -16390,11 +15145,8 @@
* @param {object} completeState Next state.
* @internal
*/
- enqueueReplaceState: function(publicInstance, completeState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceState'
- );
+ enqueueReplaceState: function (publicInstance, completeState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
@@ -16416,19 +15168,14 @@
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
- enqueueSetState: function(publicInstance, partialState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setState'
- );
+ enqueueSetState: function (publicInstance, partialState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
- var queue =
- internalInstance._pendingStateQueue ||
- (internalInstance._pendingStateQueue = []);
+ var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
@@ -16441,36 +15188,26 @@
* @param {object} partialProps Subset of the next props.
* @internal
*/
- enqueueSetProps: function(publicInstance, partialProps) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setProps'
- );
-
+ enqueueSetProps: function (publicInstance, partialProps) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
+ },
- ("production" !== "development" ? invariant(
- internalInstance._isTopLevel,
- 'setProps(...): You called `setProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueSetPropsInternal: function (internalInstance, partialProps) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? "development" !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
/**
@@ -16480,38 +15217,28 @@
* @param {object} props New props.
* @internal
*/
- enqueueReplaceProps: function(publicInstance, props) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceProps'
- );
-
+ enqueueReplaceProps: function (publicInstance, props) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
+ },
- ("production" !== "development" ? invariant(
- internalInstance._isTopLevel,
- 'replaceProps(...): You called `replaceProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueReplacePropsInternal: function (internalInstance, props) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? "development" !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
- enqueueElementInternal: function(internalInstance, newElement) {
+ enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
@@ -16519,8 +15246,7 @@
};
module.exports = ReactUpdateQueue;
-
-},{"100":100,"150":150,"171":171,"29":29,"45":45,"63":63,"73":73,"74":74}],100:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"24":24,"39":39,"57":57,"68":68,"96":96}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16534,16 +15260,14 @@
'use strict';
-var CallbackQueue = _dereq_(7);
-var PooledClass = _dereq_(30);
-var ReactCurrentOwner = _dereq_(45);
-var ReactPerf = _dereq_(82);
-var ReactReconciler = _dereq_(89);
-var Transaction = _dereq_(116);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var CallbackQueue = _dereq_(6);
+var PooledClass = _dereq_(25);
+var ReactPerf = _dereq_(78);
+var ReactReconciler = _dereq_(84);
+var Transaction = _dereq_(113);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
@@ -16552,18 +15276,14 @@
var batchingStrategy = null;
function ensureInjected() {
- ("production" !== "development" ? invariant(
- ReactUpdates.ReactReconcileTransaction && batchingStrategy,
- 'ReactUpdates: must inject a reconcile transaction class and batching ' +
- 'strategy'
- ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
- initialize: function() {
+ initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
- close: function() {
+ close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
@@ -16579,10 +15299,10 @@
};
var UPDATE_QUEUEING = {
- initialize: function() {
+ initialize: function () {
this.callbackQueue.reset();
},
- close: function() {
+ close: function () {
this.callbackQueue.notifyAll();
}
};
@@ -16593,18 +15313,15 @@
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
- this.reconcileTransaction =
- ReactUpdates.ReactReconcileTransaction.getPooled();
+ this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
-assign(
- ReactUpdatesFlushTransaction.prototype,
- Transaction.Mixin, {
- getTransactionWrappers: function() {
+assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
- destructor: function() {
+ destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
@@ -16612,25 +15329,18 @@
this.reconcileTransaction = null;
},
- perform: function(method, scope, a) {
+ perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
- return Transaction.Mixin.perform.call(
- this,
- this.reconcileTransaction.perform,
- this.reconcileTransaction,
- method,
- scope,
- a
- );
+ return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
-function batchedUpdates(callback, a, b, c, d) {
+function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
- batchingStrategy.batchedUpdates(callback, a, b, c, d);
+ batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
@@ -16646,13 +15356,7 @@
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
- ("production" !== "development" ? invariant(
- len === dirtyComponents.length,
- 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
- 'match dirty-components array length (%s).',
- len,
- dirtyComponents.length
- ) : invariant(len === dirtyComponents.length));
+ !(len === dirtyComponents.length) ? "development" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -16671,23 +15375,17 @@
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
- ReactReconciler.performUpdateIfNecessary(
- component,
- transaction.reconcileTransaction
- );
+ ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
- transaction.callbackQueue.enqueue(
- callbacks[j],
- component.getPublicInstance()
- );
+ transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
-var flushBatchedUpdates = function() {
+var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
@@ -16708,11 +15406,7 @@
}
}
};
-flushBatchedUpdates = ReactPerf.measure(
- 'ReactUpdates',
- 'flushBatchedUpdates',
- flushBatchedUpdates
-);
+flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
@@ -16726,13 +15420,6 @@
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- 'enqueueUpdate(): Render methods should be a pure function of props ' +
- 'and state; triggering nested component updates from render is not ' +
- 'allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
@@ -16747,37 +15434,21 @@
* if no updates are currently being performed.
*/
function asap(callback, context) {
- ("production" !== "development" ? invariant(
- batchingStrategy.isBatchingUpdates,
- 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
- 'updates are not being batched.'
- ) : invariant(batchingStrategy.isBatchingUpdates));
+ !batchingStrategy.isBatchingUpdates ? "development" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
- injectReconcileTransaction: function(ReconcileTransaction) {
- ("production" !== "development" ? invariant(
- ReconcileTransaction,
- 'ReactUpdates: must provide a reconcile transaction class'
- ) : invariant(ReconcileTransaction));
+ injectReconcileTransaction: function (ReconcileTransaction) {
+ !ReconcileTransaction ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
- injectBatchingStrategy: function(_batchingStrategy) {
- ("production" !== "development" ? invariant(
- _batchingStrategy,
- 'ReactUpdates: must provide a batching strategy'
- ) : invariant(_batchingStrategy));
- ("production" !== "development" ? invariant(
- typeof _batchingStrategy.batchedUpdates === 'function',
- 'ReactUpdates: must provide a batchedUpdates() function'
- ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
- ("production" !== "development" ? invariant(
- typeof _batchingStrategy.isBatchingUpdates === 'boolean',
- 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
- ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
+ injectBatchingStrategy: function (_batchingStrategy) {
+ !_batchingStrategy ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};
@@ -16799,8 +15470,22 @@
};
module.exports = ReactUpdates;
+},{"113":113,"161":161,"24":24,"25":25,"6":6,"78":78,"84":84}],97:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactVersion
+ */
+
+'use strict';
-},{"116":116,"150":150,"171":171,"29":29,"30":30,"45":45,"7":7,"82":82,"89":89}],101:[function(_dereq_,module,exports){
+module.exports = '0.14.9';
+},{}],98:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16812,14 +15497,17 @@
* @providesModule SVGDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
-var DOMProperty = _dereq_(11);
+var DOMProperty = _dereq_(10);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
+var NS = {
+ xlink: 'http://www.w3.org/1999/xlink',
+ xml: 'http://www.w3.org/XML/1998/namespace'
+};
+
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
@@ -16863,10 +15551,32 @@
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
+ xlinkActuate: MUST_USE_ATTRIBUTE,
+ xlinkArcrole: MUST_USE_ATTRIBUTE,
+ xlinkHref: MUST_USE_ATTRIBUTE,
+ xlinkRole: MUST_USE_ATTRIBUTE,
+ xlinkShow: MUST_USE_ATTRIBUTE,
+ xlinkTitle: MUST_USE_ATTRIBUTE,
+ xlinkType: MUST_USE_ATTRIBUTE,
+ xmlBase: MUST_USE_ATTRIBUTE,
+ xmlLang: MUST_USE_ATTRIBUTE,
+ xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
+ DOMAttributeNamespaces: {
+ xlinkActuate: NS.xlink,
+ xlinkArcrole: NS.xlink,
+ xlinkHref: NS.xlink,
+ xlinkRole: NS.xlink,
+ xlinkShow: NS.xlink,
+ xlinkTitle: NS.xlink,
+ xlinkType: NS.xlink,
+ xmlBase: NS.xml,
+ xmlLang: NS.xml,
+ xmlSpace: NS.xml
+ },
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
@@ -16888,13 +15598,22 @@
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
- viewBox: 'viewBox'
+ viewBox: 'viewBox',
+ xlinkActuate: 'xlink:actuate',
+ xlinkArcrole: 'xlink:arcrole',
+ xlinkHref: 'xlink:href',
+ xlinkRole: 'xlink:role',
+ xlinkShow: 'xlink:show',
+ xlinkTitle: 'xlink:title',
+ xlinkType: 'xlink:type',
+ xmlBase: 'xml:base',
+ xmlLang: 'xml:lang',
+ xmlSpace: 'xml:space'
}
};
module.exports = SVGDOMPropertyConfig;
-
-},{"11":11}],102:[function(_dereq_,module,exports){
+},{"10":10}],99:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16908,33 +15627,28 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var ReactInputSelection = _dereq_(71);
-var SyntheticEvent = _dereq_(108);
-
-var getActiveElement = _dereq_(136);
-var isTextInputElement = _dereq_(153);
-var keyOf = _dereq_(157);
-var shallowEqual = _dereq_(166);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var ReactInputSelection = _dereq_(66);
+var SyntheticEvent = _dereq_(105);
+
+var getActiveElement = _dereq_(156);
+var isTextInputElement = _dereq_(134);
+var keyOf = _dereq_(166);
+var shallowEqual = _dereq_(171);
var topLevelTypes = EventConstants.topLevelTypes;
+var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
+
var eventTypes = {
select: {
phasedRegistrationNames: {
- bubbled: keyOf({onSelect: null}),
- captured: keyOf({onSelectCapture: null})
+ bubbled: keyOf({ onSelect: null }),
+ captured: keyOf({ onSelectCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topContextMenu,
- topLevelTypes.topFocus,
- topLevelTypes.topKeyDown,
- topLevelTypes.topMouseDown,
- topLevelTypes.topMouseUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
@@ -16943,6 +15657,11 @@
var lastSelection = null;
var mouseDown = false;
+// Track whether a listener exists for this plugin. If none exist, we do
+// not extract events.
+var hasListener = false;
+var ON_SELECT_KEY = keyOf({ onSelect: null });
+
/**
* Get an object which is a unique representation of the current selection.
*
@@ -16950,11 +15669,10 @@
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
- * @param {object}
+ * @return {object}
*/
function getSelection(node) {
- if ('selectionStart' in node &&
- ReactInputSelection.hasSelectionCapabilities(node)) {
+ if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
@@ -16984,14 +15702,12 @@
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
-function constructSelectEvent(nativeEvent) {
+function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
- if (mouseDown ||
- activeElement == null ||
- activeElement !== getActiveElement()) {
+ if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
@@ -17000,11 +15716,7 @@
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
- var syntheticEvent = SyntheticEvent.getPooled(
- eventTypes.select,
- activeElementID,
- nativeEvent
- );
+ var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
@@ -17013,6 +15725,8 @@
return syntheticEvent;
}
+
+ return null;
}
/**
@@ -17041,17 +15755,15 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (!hasListener) {
+ return null;
+ }
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
- if (isTextInputElement(topLevelTarget) ||
- topLevelTarget.contentEditable === 'true') {
+ if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
@@ -17071,25 +15783,39 @@
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
// 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
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// 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:
case topLevelTypes.topKeyUp:
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
+ }
+
+ return null;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ if (registrationName === ON_SELECT_KEY) {
+ hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
-
-},{"108":108,"136":136,"153":153,"157":157,"16":16,"166":166,"21":21,"71":71}],103:[function(_dereq_,module,exports){
+},{"105":105,"134":134,"147":147,"15":15,"156":156,"166":166,"171":171,"19":19,"66":66}],100:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17113,14 +15839,13 @@
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
-
-},{}],104:[function(_dereq_,module,exports){
+},{}],101:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17134,244 +15859,379 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginUtils = _dereq_(20);
-var EventPropagators = _dereq_(21);
-var SyntheticClipboardEvent = _dereq_(105);
-var SyntheticEvent = _dereq_(108);
-var SyntheticFocusEvent = _dereq_(109);
-var SyntheticKeyboardEvent = _dereq_(111);
-var SyntheticMouseEvent = _dereq_(112);
-var SyntheticDragEvent = _dereq_(107);
-var SyntheticTouchEvent = _dereq_(113);
-var SyntheticUIEvent = _dereq_(114);
-var SyntheticWheelEvent = _dereq_(115);
-
-var getEventCharCode = _dereq_(137);
-
-var invariant = _dereq_(150);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var EventConstants = _dereq_(15);
+var EventListener = _dereq_(146);
+var EventPropagators = _dereq_(19);
+var ReactMount = _dereq_(72);
+var SyntheticClipboardEvent = _dereq_(102);
+var SyntheticEvent = _dereq_(105);
+var SyntheticFocusEvent = _dereq_(106);
+var SyntheticKeyboardEvent = _dereq_(108);
+var SyntheticMouseEvent = _dereq_(109);
+var SyntheticDragEvent = _dereq_(104);
+var SyntheticTouchEvent = _dereq_(110);
+var SyntheticUIEvent = _dereq_(111);
+var SyntheticWheelEvent = _dereq_(112);
+
+var emptyFunction = _dereq_(153);
+var getEventCharCode = _dereq_(125);
+var invariant = _dereq_(161);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
+ abort: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAbort: true }),
+ captured: keyOf({ onAbortCapture: true })
+ }
+ },
blur: {
phasedRegistrationNames: {
- bubbled: keyOf({onBlur: true}),
- captured: keyOf({onBlurCapture: true})
+ bubbled: keyOf({ onBlur: true }),
+ captured: keyOf({ onBlurCapture: true })
+ }
+ },
+ canPlay: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlay: true }),
+ captured: keyOf({ onCanPlayCapture: true })
+ }
+ },
+ canPlayThrough: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlayThrough: true }),
+ captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
- bubbled: keyOf({onClick: true}),
- captured: keyOf({onClickCapture: true})
+ bubbled: keyOf({ onClick: true }),
+ captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
- bubbled: keyOf({onContextMenu: true}),
- captured: keyOf({onContextMenuCapture: true})
+ bubbled: keyOf({ onContextMenu: true }),
+ captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
- bubbled: keyOf({onCopy: true}),
- captured: keyOf({onCopyCapture: true})
+ bubbled: keyOf({ onCopy: true }),
+ captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
- bubbled: keyOf({onCut: true}),
- captured: keyOf({onCutCapture: true})
+ bubbled: keyOf({ onCut: true }),
+ captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
- bubbled: keyOf({onDoubleClick: true}),
- captured: keyOf({onDoubleClickCapture: true})
+ bubbled: keyOf({ onDoubleClick: true }),
+ captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrag: true}),
- captured: keyOf({onDragCapture: true})
+ bubbled: keyOf({ onDrag: true }),
+ captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnd: true}),
- captured: keyOf({onDragEndCapture: true})
+ bubbled: keyOf({ onDragEnd: true }),
+ captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnter: true}),
- captured: keyOf({onDragEnterCapture: true})
+ bubbled: keyOf({ onDragEnter: true }),
+ captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragExit: true}),
- captured: keyOf({onDragExitCapture: true})
+ bubbled: keyOf({ onDragExit: true }),
+ captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragLeave: true}),
- captured: keyOf({onDragLeaveCapture: true})
+ bubbled: keyOf({ onDragLeave: true }),
+ captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragOver: true}),
- captured: keyOf({onDragOverCapture: true})
+ bubbled: keyOf({ onDragOver: true }),
+ captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragStart: true}),
- captured: keyOf({onDragStartCapture: true})
+ bubbled: keyOf({ onDragStart: true }),
+ captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrop: true}),
- captured: keyOf({onDropCapture: true})
+ bubbled: keyOf({ onDrop: true }),
+ captured: keyOf({ onDropCapture: true })
+ }
+ },
+ durationChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onDurationChange: true }),
+ captured: keyOf({ onDurationChangeCapture: true })
+ }
+ },
+ emptied: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEmptied: true }),
+ captured: keyOf({ onEmptiedCapture: true })
+ }
+ },
+ encrypted: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEncrypted: true }),
+ captured: keyOf({ onEncryptedCapture: true })
+ }
+ },
+ ended: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEnded: true }),
+ captured: keyOf({ onEndedCapture: true })
+ }
+ },
+ error: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onError: true }),
+ captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
- bubbled: keyOf({onFocus: true}),
- captured: keyOf({onFocusCapture: true})
+ bubbled: keyOf({ onFocus: true }),
+ captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
- bubbled: keyOf({onInput: true}),
- captured: keyOf({onInputCapture: true})
+ bubbled: keyOf({ onInput: true }),
+ captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyDown: true}),
- captured: keyOf({onKeyDownCapture: true})
+ bubbled: keyOf({ onKeyDown: true }),
+ captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyPress: true}),
- captured: keyOf({onKeyPressCapture: true})
+ bubbled: keyOf({ onKeyPress: true }),
+ captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyUp: true}),
- captured: keyOf({onKeyUpCapture: true})
+ bubbled: keyOf({ onKeyUp: true }),
+ captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
- bubbled: keyOf({onLoad: true}),
- captured: keyOf({onLoadCapture: true})
+ bubbled: keyOf({ onLoad: true }),
+ captured: keyOf({ onLoadCapture: true })
}
},
- error: {
+ loadedData: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadedData: true }),
+ captured: keyOf({ onLoadedDataCapture: true })
+ }
+ },
+ loadedMetadata: {
phasedRegistrationNames: {
- bubbled: keyOf({onError: true}),
- captured: keyOf({onErrorCapture: true})
+ bubbled: keyOf({ onLoadedMetadata: true }),
+ captured: keyOf({ onLoadedMetadataCapture: true })
+ }
+ },
+ loadStart: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadStart: true }),
+ captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseDown: true}),
- captured: keyOf({onMouseDownCapture: true})
+ bubbled: keyOf({ onMouseDown: true }),
+ captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseMove: true}),
- captured: keyOf({onMouseMoveCapture: true})
+ bubbled: keyOf({ onMouseMove: true }),
+ captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOut: true}),
- captured: keyOf({onMouseOutCapture: true})
+ bubbled: keyOf({ onMouseOut: true }),
+ captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOver: true}),
- captured: keyOf({onMouseOverCapture: true})
+ bubbled: keyOf({ onMouseOver: true }),
+ captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseUp: true}),
- captured: keyOf({onMouseUpCapture: true})
+ bubbled: keyOf({ onMouseUp: true }),
+ captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
- bubbled: keyOf({onPaste: true}),
- captured: keyOf({onPasteCapture: true})
+ bubbled: keyOf({ onPaste: true }),
+ captured: keyOf({ onPasteCapture: true })
+ }
+ },
+ pause: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPause: true }),
+ captured: keyOf({ onPauseCapture: true })
+ }
+ },
+ play: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlay: true }),
+ captured: keyOf({ onPlayCapture: true })
+ }
+ },
+ playing: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlaying: true }),
+ captured: keyOf({ onPlayingCapture: true })
+ }
+ },
+ progress: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onProgress: true }),
+ captured: keyOf({ onProgressCapture: true })
+ }
+ },
+ rateChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onRateChange: true }),
+ captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
- bubbled: keyOf({onReset: true}),
- captured: keyOf({onResetCapture: true})
+ bubbled: keyOf({ onReset: true }),
+ captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
- bubbled: keyOf({onScroll: true}),
- captured: keyOf({onScrollCapture: true})
+ bubbled: keyOf({ onScroll: true }),
+ captured: keyOf({ onScrollCapture: true })
+ }
+ },
+ seeked: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeked: true }),
+ captured: keyOf({ onSeekedCapture: true })
+ }
+ },
+ seeking: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeking: true }),
+ captured: keyOf({ onSeekingCapture: true })
+ }
+ },
+ stalled: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onStalled: true }),
+ captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
- bubbled: keyOf({onSubmit: true}),
- captured: keyOf({onSubmitCapture: true})
+ bubbled: keyOf({ onSubmit: true }),
+ captured: keyOf({ onSubmitCapture: true })
+ }
+ },
+ suspend: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSuspend: true }),
+ captured: keyOf({ onSuspendCapture: true })
+ }
+ },
+ timeUpdate: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onTimeUpdate: true }),
+ captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchCancel: true}),
- captured: keyOf({onTouchCancelCapture: true})
+ bubbled: keyOf({ onTouchCancel: true }),
+ captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchEnd: true}),
- captured: keyOf({onTouchEndCapture: true})
+ bubbled: keyOf({ onTouchEnd: true }),
+ captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchMove: true}),
- captured: keyOf({onTouchMoveCapture: true})
+ bubbled: keyOf({ onTouchMove: true }),
+ captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchStart: true}),
- captured: keyOf({onTouchStartCapture: true})
+ bubbled: keyOf({ onTouchStart: true }),
+ captured: keyOf({ onTouchStartCapture: true })
+ }
+ },
+ volumeChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onVolumeChange: true }),
+ captured: keyOf({ onVolumeChangeCapture: true })
+ }
+ },
+ waiting: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onWaiting: true }),
+ captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
- bubbled: keyOf({onWheel: true}),
- captured: keyOf({onWheelCapture: true})
+ bubbled: keyOf({ onWheel: true }),
+ captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
+ topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
+ topCanPlay: eventTypes.canPlay,
+ topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
@@ -17385,6 +16245,10 @@
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
+ topDurationChange: eventTypes.durationChange,
+ topEmptied: eventTypes.emptied,
+ topEncrypted: eventTypes.encrypted,
+ topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
@@ -17392,19 +16256,34 @@
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
+ topLoadedData: eventTypes.loadedData,
+ topLoadedMetadata: eventTypes.loadedMetadata,
+ topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
+ topPause: eventTypes.pause,
+ topPlay: eventTypes.play,
+ topPlaying: eventTypes.playing,
+ topProgress: eventTypes.progress,
+ topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
+ topSeeked: eventTypes.seeked,
+ topSeeking: eventTypes.seeking,
+ topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
+ topSuspend: eventTypes.suspend,
+ topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
+ topVolumeChange: eventTypes.volumeChange,
+ topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
@@ -17412,35 +16291,14 @@
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
+var ON_CLICK_KEY = keyOf({ onClick: null });
+var onClickListeners = {};
+
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
- * 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 to be dispatched.
- * @param {function} 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);
-
- ("production" !== "development" ? 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.'
- ) : null);
-
- if (returnValue === false) {
- event.stopPropagation();
- event.preventDefault();
- }
- },
-
- /**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
@@ -17448,22 +16306,40 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
+ case topLevelTypes.topAbort:
+ case topLevelTypes.topCanPlay:
+ case topLevelTypes.topCanPlayThrough:
+ case topLevelTypes.topDurationChange:
+ case topLevelTypes.topEmptied:
+ case topLevelTypes.topEncrypted:
+ case topLevelTypes.topEnded:
+ case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
- case topLevelTypes.topError:
+ case topLevelTypes.topLoadedData:
+ case topLevelTypes.topLoadedMetadata:
+ case topLevelTypes.topLoadStart:
+ case topLevelTypes.topPause:
+ case topLevelTypes.topPlay:
+ case topLevelTypes.topPlaying:
+ case topLevelTypes.topProgress:
+ case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
+ case topLevelTypes.topSeeked:
+ case topLevelTypes.topSeeking:
+ case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
+ case topLevelTypes.topSuspend:
+ case topLevelTypes.topTimeUpdate:
+ case topLevelTypes.topVolumeChange:
+ case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
@@ -17528,25 +16404,36 @@
EventConstructor = SyntheticClipboardEvent;
break;
}
- ("production" !== "development" ? invariant(
- EventConstructor,
- 'SimpleEventPlugin: Unhandled event type, `%s`.',
- topLevelType
- ) : invariant(EventConstructor));
- var event = EventConstructor.getPooled(
- dispatchConfig,
- topLevelTargetID,
- nativeEvent
- );
+ !EventConstructor ? "development" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
+ var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ // Mobile Safari does not fire properly bubble click events on
+ // non-interactive elements, which means delegated click listeners do not
+ // fire. The workaround for this bug involves attaching an empty click
+ // listener on the target node.
+ if (registrationName === ON_CLICK_KEY) {
+ var node = ReactMount.getNode(id);
+ if (!onClickListeners[id]) {
+ onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
+ }
+ }
+ },
+
+ willDeleteListener: function (id, registrationName) {
+ if (registrationName === ON_CLICK_KEY) {
+ onClickListeners[id].remove();
+ delete onClickListeners[id];
+ }
}
};
module.exports = SimpleEventPlugin;
-
-},{"105":105,"107":107,"108":108,"109":109,"111":111,"112":112,"113":113,"114":114,"115":115,"137":137,"150":150,"157":157,"16":16,"171":171,"20":20,"21":21}],105:[function(_dereq_,module,exports){
+},{"102":102,"104":104,"105":105,"106":106,"108":108,"109":109,"110":110,"111":111,"112":112,"125":125,"146":146,"15":15,"153":153,"161":161,"166":166,"19":19,"72":72}],102:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17561,19 +16448,15 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
- clipboardData: function(event) {
- return (
- 'clipboardData' in event ?
- event.clipboardData :
- window.clipboardData
- );
+ clipboardData: function (event) {
+ return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
@@ -17583,15 +16466,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
-
-},{"108":108}],106:[function(_dereq_,module,exports){
+},{"105":105}],103:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17606,7 +16488,7 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
/**
* @interface Event
@@ -17622,21 +16504,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticCompositionEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticCompositionEvent,
- CompositionEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
-
-},{"108":108}],107:[function(_dereq_,module,exports){
+},{"105":105}],104:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17651,7 +16526,7 @@
'use strict';
-var SyntheticMouseEvent = _dereq_(112);
+var SyntheticMouseEvent = _dereq_(109);
/**
* @interface DragEvent
@@ -17667,15 +16542,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
-
-},{"112":112}],108:[function(_dereq_,module,exports){
+},{"109":109}],105:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17690,11 +16564,11 @@
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
-var getEventTarget = _dereq_(140);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
+var warning = _dereq_(173);
/**
* @interface Event
@@ -17702,13 +16576,13 @@
*/
var EventInterface = {
type: null,
- target: getEventTarget,
+ target: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
- timeStamp: function(event) {
+ timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
@@ -17732,7 +16606,7 @@
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
-function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
+function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
@@ -17746,13 +16620,15 @@
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
+ if (propName === 'target') {
+ this.target = nativeEventTarget;
+ } else {
this[propName] = nativeEvent[propName];
}
}
+ }
- var defaultPrevented = nativeEvent.defaultPrevented != null ?
- nativeEvent.defaultPrevented :
- nativeEvent.returnValue === false;
+ var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
@@ -17763,9 +16639,16 @@
assign(SyntheticEvent.prototype, {
- preventDefault: function() {
+ preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
+ if ("development" !== 'production') {
+ "development" !== '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) {
event.preventDefault();
} else {
@@ -17774,8 +16657,15 @@
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
- stopPropagation: function() {
+ stopPropagation: function () {
var event = this.nativeEvent;
+ if ("development" !== 'production') {
+ "development" !== '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) {
event.stopPropagation();
} else {
@@ -17789,7 +16679,7 @@
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
- persist: function() {
+ persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
@@ -17803,7 +16693,7 @@
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
- destructor: function() {
+ destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
@@ -17823,7 +16713,7 @@
* @param {function} Class
* @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function(Class, Interface) {
+SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
@@ -17834,14 +16724,13 @@
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
- PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
+ PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
-PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
+PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
-
-},{"129":129,"140":140,"29":29,"30":30}],109:[function(_dereq_,module,exports){
+},{"153":153,"173":173,"24":24,"25":25}],106:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17856,7 +16745,7 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
+var SyntheticUIEvent = _dereq_(111);
/**
* @interface FocusEvent
@@ -17872,15 +16761,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
-
-},{"114":114}],110:[function(_dereq_,module,exports){
+},{"111":111}],107:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17895,7 +16783,7 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
/**
* @interface Event
@@ -17912,21 +16800,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticInputEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticInputEvent,
- InputEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
-
-},{"108":108}],111:[function(_dereq_,module,exports){
+},{"105":105}],108:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17941,11 +16822,11 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
+var SyntheticUIEvent = _dereq_(111);
-var getEventCharCode = _dereq_(137);
-var getEventKey = _dereq_(138);
-var getEventModifierState = _dereq_(139);
+var getEventCharCode = _dereq_(125);
+var getEventKey = _dereq_(126);
+var getEventModifierState = _dereq_(127);
/**
* @interface KeyboardEvent
@@ -17962,7 +16843,7 @@
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
- charCode: function(event) {
+ charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
@@ -17973,7 +16854,7 @@
}
return 0;
},
- keyCode: function(event) {
+ keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
@@ -17986,7 +16867,7 @@
}
return 0;
},
- which: function(event) {
+ which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
@@ -18005,15 +16886,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
-
-},{"114":114,"137":137,"138":138,"139":139}],112:[function(_dereq_,module,exports){
+},{"111":111,"125":125,"126":126,"127":127}],109:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18028,10 +16908,10 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
-var ViewportMetrics = _dereq_(117);
+var SyntheticUIEvent = _dereq_(111);
+var ViewportMetrics = _dereq_(114);
-var getEventModifierState = _dereq_(139);
+var getEventModifierState = _dereq_(127);
/**
* @interface MouseEvent
@@ -18047,7 +16927,7 @@
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
- button: function(event) {
+ button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
@@ -18062,21 +16942,15 @@
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
- relatedTarget: function(event) {
- return event.relatedTarget || (
- ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
- );
+ relatedTarget: function (event) {
+ return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
- pageX: function(event) {
- return 'pageX' in event ?
- event.pageX :
- event.clientX + ViewportMetrics.currentScrollLeft;
- },
- pageY: function(event) {
- return 'pageY' in event ?
- event.pageY :
- event.clientY + ViewportMetrics.currentScrollTop;
+ pageX: function (event) {
+ return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
+ },
+ pageY: function (event) {
+ return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
@@ -18086,15 +16960,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
-
-},{"114":114,"117":117,"139":139}],113:[function(_dereq_,module,exports){
+},{"111":111,"114":114,"127":127}],110:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18109,9 +16982,9 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
+var SyntheticUIEvent = _dereq_(111);
-var getEventModifierState = _dereq_(139);
+var getEventModifierState = _dereq_(127);
/**
* @interface TouchEvent
@@ -18134,15 +17007,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
-
-},{"114":114,"139":139}],114:[function(_dereq_,module,exports){
+},{"111":111,"127":127}],111:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18157,16 +17029,16 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
-var getEventTarget = _dereq_(140);
+var getEventTarget = _dereq_(128);
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
- view: function(event) {
+ view: function (event) {
if (event.view) {
return event.view;
}
@@ -18185,7 +17057,7 @@
return window;
}
},
- detail: function(event) {
+ detail: function (event) {
return event.detail || 0;
}
};
@@ -18196,15 +17068,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
-function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
-
-},{"108":108,"140":140}],115:[function(_dereq_,module,exports){
+},{"105":105,"128":128}],112:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18219,28 +17090,24 @@
'use strict';
-var SyntheticMouseEvent = _dereq_(112);
+var SyntheticMouseEvent = _dereq_(109);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
- deltaX: function(event) {
- return (
- 'deltaX' in event ? event.deltaX :
+ deltaX: function (event) {
+ return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
- 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
- );
+ 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
- deltaY: function(event) {
- return (
- 'deltaY' in event ? event.deltaY :
+ deltaY: function (event) {
+ return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
- 'wheelDelta' in event ? -event.wheelDelta : 0
- );
+ 'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
@@ -18257,15 +17124,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
-function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
-
-},{"112":112}],116:[function(_dereq_,module,exports){
+},{"109":109}],113:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18279,7 +17145,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* `Transaction` creates a black box that is able to wrap any method such that
@@ -18350,12 +17216,12 @@
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
- reinitializeTransaction: function() {
+ reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
- if (!this.wrapperInitData) {
- this.wrapperInitData = [];
- } else {
+ if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
+ } else {
+ this.wrapperInitData = [];
}
this._isInTransaction = false;
},
@@ -18368,27 +17234,29 @@
*/
getTransactionWrappers: null,
- isInTransaction: function() {
+ isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
- * need to be safety checked.
+ * need to be safety checked. The optional arguments helps prevent the need
+ * to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
- * @param {Object?=} args... Arguments to pass to the method (optional).
- * Helps prevent need to bind in many cases.
- * @return Return value from `method`.
- */
- perform: function(method, scope, a, b, c, d, e, f) {
- ("production" !== "development" ? invariant(
- !this.isInTransaction(),
- 'Transaction.perform(...): Cannot initialize a transaction when there ' +
- 'is already an outstanding transaction.'
- ) : invariant(!this.isInTransaction()));
+ * @param {Object?=} a Argument to pass to the method.
+ * @param {Object?=} b Argument to pass to the method.
+ * @param {Object?=} c Argument to pass to the method.
+ * @param {Object?=} d Argument to pass to the method.
+ * @param {Object?=} e Argument to pass to the method.
+ * @param {Object?=} f Argument to pass to the method.
+ *
+ * @return {*} Return value from `method`.
+ */
+ perform: function (method, scope, a, b, c, d, e, f) {
+ !!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
@@ -18408,8 +17276,7 @@
// by invoking `closeAll`.
try {
this.closeAll(0);
- } catch (err) {
- }
+ } catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
@@ -18422,7 +17289,7 @@
return ret;
},
- initializeAll: function(startIndex) {
+ initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -18432,9 +17299,7 @@
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
- this.wrapperInitData[i] = wrapper.initialize ?
- wrapper.initialize.call(this) :
- null;
+ this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
@@ -18442,8 +17307,7 @@
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
- } catch (err) {
- }
+ } catch (err) {}
}
}
}
@@ -18455,11 +17319,8 @@
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
- closeAll: function(startIndex) {
- ("production" !== "development" ? invariant(
- this.isInTransaction(),
- 'Transaction.closeAll(): Cannot close transaction when none are open.'
- ) : invariant(this.isInTransaction()));
+ closeAll: function (startIndex) {
+ !this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -18482,8 +17343,7 @@
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
- } catch (e) {
- }
+ } catch (e) {}
}
}
}
@@ -18496,15 +17356,14 @@
Mixin: Mixin,
/**
- * Token to look for to determine if an error occured.
+ * Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
-
-},{"150":150}],117:[function(_dereq_,module,exports){
+},{"161":161}],114:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18524,7 +17383,7 @@
currentScrollTop: 0,
- refreshScrollValues: function(scrollPosition) {
+ refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
@@ -18532,8 +17391,7 @@
};
module.exports = ViewportMetrics;
-
-},{}],118:[function(_dereq_,module,exports){
+},{}],115:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -18547,7 +17405,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
*
@@ -18564,10 +17422,7 @@
*/
function accumulateInto(current, next) {
- ("production" !== "development" ? invariant(
- next != null,
- 'accumulateInto(...): Accumulated items must not be null or undefined.'
- ) : invariant(next != null));
+ !(next != null) ? "development" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}
@@ -18596,8 +17451,7 @@
}
module.exports = accumulateInto;
-
-},{"150":150}],119:[function(_dereq_,module,exports){
+},{"161":161}],116:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18609,29 +17463,38 @@
* @providesModule adler32
*/
-/* jslint bitwise:true */
-
'use strict';
var MOD = 65521;
-// This is a clean-room implementation of adler32 designed for detecting
-// if markup is not what we expect it to be. It does not need to be
-// cryptographically strong, only reasonably good at detecting if markup
-// generated on the server is different than that on the client.
+// adler32 is not cryptographically strong, and is only used to sanity check that
+// markup generated on the server matches the markup generated on the client.
+// This implementation (a modified version of the SheetJS version) has been optimized
+// for our use case, at the expense of conforming to the adler32 specification
+// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
- for (var i = 0; i < data.length; i++) {
- a = (a + data.charCodeAt(i)) % MOD;
- b = (b + a) % MOD;
- }
- return a | (b << 16);
+ var i = 0;
+ var l = data.length;
+ var m = l & ~0x3;
+ while (i < m) {
+ for (; i < Math.min(i + 4096, m); i += 4) {
+ b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
+ }
+ a %= MOD;
+ b %= MOD;
+ }
+ for (; i < l; i++) {
+ b += a += data.charCodeAt(i);
+ }
+ a %= MOD;
+ b %= MOD;
+ return a | b << 16;
}
module.exports = adler32;
-
-},{}],120:[function(_dereq_,module,exports){
+},{}],117:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18640,72 +17503,23 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule camelize
- * @typechecks
+ * @providesModule canDefineProperty
*/
-var _hyphenPattern = /-(.)/g;
-
-/**
- * Camelcases a hyphenated string, for example:
- *
- * > camelize('background-color')
- * < "backgroundColor"
- *
- * @param {string} string
- * @return {string}
- */
-function camelize(string) {
- return string.replace(_hyphenPattern, function(_, character) {
- return character.toUpperCase();
- });
-}
-
-module.exports = camelize;
-
-},{}],121:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule camelizeStyleName
- * @typechecks
- */
-
-"use strict";
-
-var camelize = _dereq_(120);
-
-var msPattern = /^-ms-/;
+'use strict';
-/**
- * Camelcases a hyphenated CSS property name, for example:
- *
- * > camelizeStyleName('background-color')
- * < "backgroundColor"
- * > camelizeStyleName('-moz-transition')
- * < "MozTransition"
- * > camelizeStyleName('-ms-transition')
- * < "msTransition"
- *
- * As Andi Smith suggests
- * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
- * is converted to lowercase `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function camelizeStyleName(string) {
- return camelize(string.replace(msPattern, 'ms-'));
+var canDefineProperty = false;
+if ("development" !== 'production') {
+ try {
+ Object.defineProperty({}, 'x', { get: function () {} });
+ canDefineProperty = true;
+ } catch (x) {
+ // IE will fail on defineProperty
+ }
}
-module.exports = camelizeStyleName;
-
-},{"120":120}],122:[function(_dereq_,module,exports){
+module.exports = canDefineProperty;
+},{}],118:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18720,13 +17534,15 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactPropTransferer = _dereq_(83);
+var ReactElement = _dereq_(57);
+var ReactPropTransferer = _dereq_(79);
+
+var keyOf = _dereq_(166);
+var warning = _dereq_(173);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var CHILDREN_PROP = keyOf({ children: null });
-var CHILDREN_PROP = keyOf({children: null});
+var didDeprecatedWarn = false;
/**
* Sometimes you want to change the props of a child passed to you. Usually
@@ -18736,365 +17552,29 @@
* @param {object} props props you'd like to modify. className and style will be
* merged automatically.
* @return {ReactElement} a clone of child with props merged in.
+ * @deprecated
*/
function cloneWithProps(child, props) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- !child.ref,
- 'You are calling cloneWithProps() on a child with a ref. This is ' +
- 'dangerous because you\'re creating a new child which will not be ' +
- 'added as a ref to its parent.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
+ didDeprecatedWarn = true;
+ "development" !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
- if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
- child.props.hasOwnProperty(CHILDREN_PROP)) {
+ if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
- // The current API doesn't retain _owner and _context, which is why this
+ // The current API doesn't retain _owner, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
return ReactElement.createElement(child.type, newProps);
}
module.exports = cloneWithProps;
-
-},{"157":157,"171":171,"63":63,"83":83}],123:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule containsNode
- * @typechecks
- */
-
-var isTextNode = _dereq_(154);
-
-/*jslint bitwise:true */
-
-/**
- * Checks if a given DOM node contains or is another DOM node.
- *
- * @param {?DOMNode} outerNode Outer DOM node.
- * @param {?DOMNode} innerNode Inner DOM node.
- * @return {boolean} True if `outerNode` contains or is `innerNode`.
- */
-function containsNode(outerNode, innerNode) {
- if (!outerNode || !innerNode) {
- return false;
- } else if (outerNode === innerNode) {
- return true;
- } else if (isTextNode(outerNode)) {
- return false;
- } else if (isTextNode(innerNode)) {
- return containsNode(outerNode, innerNode.parentNode);
- } else if (outerNode.contains) {
- return outerNode.contains(innerNode);
- } else if (outerNode.compareDocumentPosition) {
- return !!(outerNode.compareDocumentPosition(innerNode) & 16);
- } else {
- return false;
- }
-}
-
-module.exports = containsNode;
-
-},{"154":154}],124:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createArrayFromMixed
- * @typechecks
- */
-
-var toArray = _dereq_(168);
-
-/**
- * Perform a heuristic test to determine if an object is "array-like".
- *
- * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
- * Joshu replied: "Mu."
- *
- * This function determines if its argument has "array nature": it returns
- * true if the argument is an actual array, an `arguments' object, or an
- * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
- *
- * It will return false for other array-like objects like Filelist.
- *
- * @param {*} obj
- * @return {boolean}
- */
-function hasArrayNature(obj) {
- return (
- // not null/false
- !!obj &&
- // arrays are objects, NodeLists are functions in Safari
- (typeof obj == 'object' || typeof obj == 'function') &&
- // quacks like an array
- ('length' in obj) &&
- // not window
- !('setInterval' in obj) &&
- // no DOM node should be considered an array-like
- // a 'select' element has 'length' and 'item' properties on IE8
- (typeof obj.nodeType != 'number') &&
- (
- // a real array
- (// HTMLCollection/NodeList
- (Array.isArray(obj) ||
- // arguments
- ('callee' in obj) || 'item' in obj))
- )
- );
-}
-
-/**
- * Ensure that the argument is an array by wrapping it in an array if it is not.
- * Creates a copy of the argument if it is already an array.
- *
- * This is mostly useful idiomatically:
- *
- * var createArrayFromMixed = require('createArrayFromMixed');
- *
- * function takesOneOrMoreThings(things) {
- * things = createArrayFromMixed(things);
- * ...
- * }
- *
- * This allows you to treat `things' as an array, but accept scalars in the API.
- *
- * If you need to convert an array-like object, like `arguments`, into an array
- * use toArray instead.
- *
- * @param {*} obj
- * @return {array}
- */
-function createArrayFromMixed(obj) {
- if (!hasArrayNature(obj)) {
- return [obj];
- } else if (Array.isArray(obj)) {
- return obj.slice();
- } else {
- return toArray(obj);
- }
-}
-
-module.exports = createArrayFromMixed;
-
-},{"168":168}],125:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createFullPageComponent
- * @typechecks
- */
-
-'use strict';
-
-// Defeat circular references by requiring this directly.
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var invariant = _dereq_(150);
-
-/**
- * Create a component that will throw an exception when unmounted.
- *
- * Components like <html> <head> and <body> can't be removed or added
- * easily in a cross-browser way, however it's valuable to be able to
- * take advantage of React's reconciliation for styling and <title>
- * management. So we just document it and throw in dangerous cases.
- *
- * @param {string} tag The tag to wrap
- * @return {function} convenience constructor of new component
- */
-function createFullPageComponent(tag) {
- var elementFactory = ReactElement.createFactory(tag);
-
- var FullPageComponent = ReactClass.createClass({
- tagName: tag.toUpperCase(),
- displayName: 'ReactFullPageComponent' + tag,
-
- componentWillUnmount: function() {
- ("production" !== "development" ? invariant(
- false,
- '%s tried to unmount. Because of cross-browser quirks it is ' +
- 'impossible to unmount some top-level components (eg <html>, <head>, ' +
- 'and <body>) reliably and efficiently. To fix this, have a single ' +
- 'top-level component that never unmounts render these elements.',
- this.constructor.displayName
- ) : invariant(false));
- },
-
- render: function() {
- return elementFactory(this.props);
- }
- });
-
- return FullPageComponent;
-}
-
-module.exports = createFullPageComponent;
-
-},{"150":150,"38":38,"63":63}],126:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createNodesFromMarkup
- * @typechecks
- */
-
-/*jslint evil: true, sub: true */
-
-var ExecutionEnvironment = _dereq_(22);
-
-var createArrayFromMixed = _dereq_(124);
-var getMarkupWrap = _dereq_(142);
-var invariant = _dereq_(150);
-
-/**
- * Dummy container used to render all markup.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Pattern used by `getNodeName`.
- */
-var nodeNamePattern = /^\s*<(\w+)/;
-
-/**
- * Extracts the `nodeName` of the first element in a string of markup.
- *
- * @param {string} markup String of markup.
- * @return {?string} Node name of the supplied markup.
- */
-function getNodeName(markup) {
- var nodeNameMatch = markup.match(nodeNamePattern);
- return nodeNameMatch && nodeNameMatch[1].toLowerCase();
-}
-
-/**
- * Creates an array containing the nodes rendered from the supplied markup. The
- * optionally supplied `handleScript` function will be invoked once for each
- * <script> element that is rendered. If no `handleScript` function is supplied,
- * an exception is thrown if any <script> elements are rendered.
- *
- * @param {string} markup A string of valid HTML markup.
- * @param {?function} handleScript Invoked once for each rendered <script>.
- * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
- */
-function createNodesFromMarkup(markup, handleScript) {
- var node = dummyNode;
- ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
- var nodeName = getNodeName(markup);
-
- var wrap = nodeName && getMarkupWrap(nodeName);
- if (wrap) {
- node.innerHTML = wrap[1] + markup + wrap[2];
-
- var wrapDepth = wrap[0];
- while (wrapDepth--) {
- node = node.lastChild;
- }
- } else {
- node.innerHTML = markup;
- }
-
- var scripts = node.getElementsByTagName('script');
- if (scripts.length) {
- ("production" !== "development" ? invariant(
- handleScript,
- 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
- ) : invariant(handleScript));
- createArrayFromMixed(scripts).forEach(handleScript);
- }
-
- var nodes = createArrayFromMixed(node.childNodes);
- while (node.lastChild) {
- node.removeChild(node.lastChild);
- }
- return nodes;
-}
-
-module.exports = createNodesFromMarkup;
-
-},{"124":124,"142":142,"150":150,"22":22}],127:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule cx
- */
-
-/**
- * This function is used to mark string literals representing CSS class names
- * so that they can be transformed statically. This allows for modularization
- * and minification of CSS class names.
- *
- * In static_upstream, this function is actually implemented, but it should
- * eventually be replaced with something more descriptive, and the transform
- * that is used in the main stack should be ported for use elsewhere.
- *
- * @param string|object className to modularize, or an object of key/values.
- * In the object case, the values are conditions that
- * determine if the className keys should be included.
- * @param [string ...] Variable list of classNames in the string case.
- * @return string Renderable space-separated CSS className.
- */
-
-'use strict';
-var warning = _dereq_(171);
-
-var warned = false;
-
-function cx(classNames) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- warned,
- 'React.addons.classSet will be deprecated in a future version. See ' +
- 'http://fb.me/react-addons-classset'
- ) : null);
- warned = true;
- }
-
- if (typeof classNames == 'object') {
- return Object.keys(classNames).filter(function(className) {
- return classNames[className];
- }).join(' ');
- } else {
- return Array.prototype.join.call(arguments, ' ');
- }
-}
-
-module.exports = cx;
-
-},{"171":171}],128:[function(_dereq_,module,exports){
+},{"166":166,"173":173,"57":57,"79":79}],119:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19109,7 +17589,7 @@
'use strict';
-var CSSProperty = _dereq_(5);
+var CSSProperty = _dereq_(4);
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
@@ -19139,8 +17619,7 @@
}
var isNonNumeric = isNaN(value);
- if (isNonNumeric || value === 0 ||
- isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
+ if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
@@ -19151,8 +17630,7 @@
}
module.exports = dangerousStyleValue;
-
-},{"5":5}],129:[function(_dereq_,module,exports){
+},{"4":4}],120:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19161,54 +17639,47 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule emptyFunction
+ * @providesModule deprecated
*/
-function makeEmptyFunction(arg) {
- return function() {
- return arg;
- };
-}
-
-/**
- * This function accepts and discards inputs; it has no side effects. This is
- * primarily useful idiomatically for overridable function endpoints which
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
- */
-function emptyFunction() {}
-
-emptyFunction.thatReturns = makeEmptyFunction;
-emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
-emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
-emptyFunction.thatReturnsNull = makeEmptyFunction(null);
-emptyFunction.thatReturnsThis = function() { return this; };
-emptyFunction.thatReturnsArgument = function(arg) { return arg; };
+'use strict';
-module.exports = emptyFunction;
+var assign = _dereq_(24);
+var warning = _dereq_(173);
-},{}],130:[function(_dereq_,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
+ * This will log a single deprecation notice per function and forward the call
+ * on to the new API.
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule emptyObject
+ * @param {string} fnName The name of the function
+ * @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
+ * @param {function} fn The function to forward on to
+ * @return {function} The function that will warn once and then call fn
*/
+function deprecated(fnName, newModule, newPackage, ctx, fn) {
+ var warned = false;
+ if ("development" !== 'production') {
+ var newFn = function () {
+ "development" !== 'production' ? warning(warned,
+ // Require examples in this string must be split to prevent React's
+ // build tools from mistaking them for real requires.
+ // Otherwise the build tools will attempt to build a '%s' module.
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
+ warned = true;
+ return fn.apply(ctx, arguments);
+ };
+ // We need to make sure all properties of the original fn are copied over.
+ // In particular, this is needed to support PropTypes
+ return assign(newFn, fn);
+ }
-"use strict";
-
-var emptyObject = {};
-
-if ("production" !== "development") {
- Object.freeze(emptyObject);
+ return fn;
}
-module.exports = emptyObject;
-
-},{}],131:[function(_dereq_,module,exports){
+module.exports = deprecated;
+},{"173":173,"24":24}],121:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19247,8 +17718,7 @@
}
module.exports = escapeTextContentForBrowser;
-
-},{}],132:[function(_dereq_,module,exports){
+},{}],122:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19263,63 +17733,42 @@
'use strict';
-var ReactCurrentOwner = _dereq_(45);
-var ReactInstanceMap = _dereq_(73);
-var ReactMount = _dereq_(77);
-
-var invariant = _dereq_(150);
-var isNode = _dereq_(152);
-var warning = _dereq_(171);
+var ReactCurrentOwner = _dereq_(39);
+var ReactInstanceMap = _dereq_(68);
+var ReactMount = _dereq_(72);
+
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
- * @return {DOMElement} The root node of this element.
+ * @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
- ("production" !== "development" ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
+ "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
- if (isNode(componentOrElement)) {
+ if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
- ("production" !== "development" ? invariant(
- componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function',
- 'Component (with keys: %s) contains `render` method ' +
- 'but is not mounted in the DOM',
- Object.keys(componentOrElement)
- ) : invariant(componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function'));
- ("production" !== "development" ? invariant(
- false,
- 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
- Object.keys(componentOrElement)
- ) : invariant(false));
+ !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
+ !false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
-
-},{"150":150,"152":152,"171":171,"45":45,"73":73,"77":77}],133:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"39":39,"68":68,"72":72}],123:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19333,8 +17782,8 @@
'use strict';
-var traverseAllChildren = _dereq_(169);
-var warning = _dereq_(171);
+var traverseAllChildren = _dereq_(142);
+var warning = _dereq_(173);
/**
* @param {function} traverseContext Context passed through traversal.
@@ -19344,15 +17793,9 @@
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
- var keyUnique = !result.hasOwnProperty(name);
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- keyUnique,
- 'flattenChildren(...): 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
- ) : null);
+ var keyUnique = result[name] === undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): 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;
}
if (keyUnique && child != null) {
result[name] = child;
@@ -19374,37 +17817,7 @@
}
module.exports = flattenChildren;
-
-},{"169":169,"171":171}],134:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule focusNode
- */
-
-"use strict";
-
-/**
- * @param {DOMElement} node input/textarea to focus
- */
-function focusNode(node) {
- // IE8 can throw "Can't move focus to the control because it is invisible,
- // not enabled, or of a type that does not accept the focus." for all kinds of
- // reasons that are too expensive and fragile to test.
- try {
- node.focus();
- } catch(e) {
- }
-}
-
-module.exports = focusNode;
-
-},{}],135:[function(_dereq_,module,exports){
+},{"142":142,"173":173}],124:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19419,13 +17832,13 @@
'use strict';
/**
- * @param {array} an "accumulation" of items which is either an Array or
+ * @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
-var forEachAccumulated = function(arr, cb, scope) {
+var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
@@ -19434,37 +17847,7 @@
};
module.exports = forEachAccumulated;
-
-},{}],136:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getActiveElement
- * @typechecks
- */
-
-/**
- * Same as document.activeElement but wraps in a try-catch block. In IE it is
- * not safe to call document.activeElement if there is nothing focused.
- *
- * The activeElement will be null only if the document body is not yet defined.
- */
-function getActiveElement() /*?DOMElement*/ {
- try {
- return document.activeElement || document.body;
- } catch (e) {
- return document.body;
- }
-}
-
-module.exports = getActiveElement;
-
-},{}],137:[function(_dereq_,module,exports){
+},{}],125:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19487,7 +17870,7 @@
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
- * @return {string} Normalized `charCode` property.
+ * @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
@@ -19515,8 +17898,7 @@
}
module.exports = getEventCharCode;
-
-},{}],138:[function(_dereq_,module,exports){
+},{}],126:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19531,7 +17913,7 @@
'use strict';
-var getEventCharCode = _dereq_(137);
+var getEventCharCode = _dereq_(125);
/**
* Normalization of deprecated HTML5 `key` values
@@ -19620,8 +18002,7 @@
}
module.exports = getEventKey;
-
-},{"137":137}],139:[function(_dereq_,module,exports){
+},{"125":125}],127:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19652,7 +18033,6 @@
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
- /*jshint validthis:true */
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
@@ -19667,8 +18047,7 @@
}
module.exports = getEventModifierState;
-
-},{}],140:[function(_dereq_,module,exports){
+},{}],128:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19698,8 +18077,7 @@
}
module.exports = getEventTarget;
-
-},{}],141:[function(_dereq_,module,exports){
+},{}],129:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19733,134 +18111,14 @@
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
- var iteratorFn = maybeIterable && (
- (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
- );
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
-
-},{}],142:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getMarkupWrap
- */
-
-var ExecutionEnvironment = _dereq_(22);
-
-var invariant = _dereq_(150);
-
-/**
- * Dummy container used to detect which wraps are necessary.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Some browsers cannot use `innerHTML` to render certain elements standalone,
- * so we wrap them, render the wrapped nodes, then extract the desired node.
- *
- * In IE8, certain elements cannot render alone, so wrap all elements ('*').
- */
-var shouldWrap = {
- // Force wrapping for SVG elements because if they get created inside a <div>,
- // they will be initialized in the wrong namespace (and will not display).
- 'circle': true,
- 'clipPath': true,
- 'defs': true,
- 'ellipse': true,
- 'g': true,
- 'line': true,
- 'linearGradient': true,
- 'path': true,
- 'polygon': true,
- 'polyline': true,
- 'radialGradient': true,
- 'rect': true,
- 'stop': true,
- 'text': true
-};
-
-var selectWrap = [1, '<select multiple="true">', '</select>'];
-var tableWrap = [1, '<table>', '</table>'];
-var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
-
-var svgWrap = [1, '<svg>', '</svg>'];
-
-var markupWrap = {
- '*': [1, '?<div>', '</div>'],
-
- 'area': [1, '<map>', '</map>'],
- 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
- 'legend': [1, '<fieldset>', '</fieldset>'],
- 'param': [1, '<object>', '</object>'],
- 'tr': [2, '<table><tbody>', '</tbody></table>'],
-
- 'optgroup': selectWrap,
- 'option': selectWrap,
-
- 'caption': tableWrap,
- 'colgroup': tableWrap,
- 'tbody': tableWrap,
- 'tfoot': tableWrap,
- 'thead': tableWrap,
-
- 'td': trWrap,
- 'th': trWrap,
-
- 'circle': svgWrap,
- 'clipPath': svgWrap,
- 'defs': svgWrap,
- 'ellipse': svgWrap,
- 'g': svgWrap,
- 'line': svgWrap,
- 'linearGradient': svgWrap,
- 'path': svgWrap,
- 'polygon': svgWrap,
- 'polyline': svgWrap,
- 'radialGradient': svgWrap,
- 'rect': svgWrap,
- 'stop': svgWrap,
- 'text': svgWrap
-};
-
-/**
- * Gets the markup wrap configuration for the supplied `nodeName`.
- *
- * NOTE: This lazily detects which wraps are necessary for the current browser.
- *
- * @param {string} nodeName Lowercase `nodeName`.
- * @return {?array} Markup wrap configuration, if applicable.
- */
-function getMarkupWrap(nodeName) {
- ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
- if (!markupWrap.hasOwnProperty(nodeName)) {
- nodeName = '*';
- }
- if (!shouldWrap.hasOwnProperty(nodeName)) {
- if (nodeName === '*') {
- dummyNode.innerHTML = '<link />';
- } else {
- dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
- }
- shouldWrap[nodeName] = !dummyNode.firstChild;
- }
- return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
-}
-
-
-module.exports = getMarkupWrap;
-
-},{"150":150,"22":22}],143:[function(_dereq_,module,exports){
+},{}],130:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19934,43 +18192,7 @@
}
module.exports = getNodeForCharacterOffset;
-
-},{}],144:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getReactRootElementInContainer
- */
-
-'use strict';
-
-var DOC_NODE_TYPE = 9;
-
-/**
- * @param {DOMElement|DOMDocument} container DOM element that may contain
- * a React component
- * @return {?*} DOM element that may have the reactRoot ID, or null.
- */
-function getReactRootElementInContainer(container) {
- if (!container) {
- return null;
- }
-
- if (container.nodeType === DOC_NODE_TYPE) {
- return container.documentElement;
- } else {
- return container.firstChild;
- }
-}
-
-module.exports = getReactRootElementInContainer;
-
-},{}],145:[function(_dereq_,module,exports){
+},{}],131:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19984,7 +18206,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
var contentKey = null;
@@ -19998,130 +18220,13 @@
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
- contentKey = 'textContent' in document.documentElement ?
- 'textContent' :
- 'innerText';
+ contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
-
-},{"22":22}],146:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getUnboundedScrollPosition
- * @typechecks
- */
-
-"use strict";
-
-/**
- * Gets the scroll position of the supplied element or window.
- *
- * The return values are unbounded, unlike `getScrollPosition`. This means they
- * may be negative or exceed the element boundaries (which is possible using
- * inertial scrolling).
- *
- * @param {DOMWindow|DOMElement} scrollable
- * @return {object} Map with `x` and `y` keys.
- */
-function getUnboundedScrollPosition(scrollable) {
- if (scrollable === window) {
- return {
- x: window.pageXOffset || document.documentElement.scrollLeft,
- y: window.pageYOffset || document.documentElement.scrollTop
- };
- }
- return {
- x: scrollable.scrollLeft,
- y: scrollable.scrollTop
- };
-}
-
-module.exports = getUnboundedScrollPosition;
-
-},{}],147:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenate
- * @typechecks
- */
-
-var _uppercasePattern = /([A-Z])/g;
-
-/**
- * Hyphenates a camelcased string, for example:
- *
- * > hyphenate('backgroundColor')
- * < "background-color"
- *
- * For CSS style names, use `hyphenateStyleName` instead which works properly
- * with all vendor prefixes, including `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenate(string) {
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
-}
-
-module.exports = hyphenate;
-
-},{}],148:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenateStyleName
- * @typechecks
- */
-
-"use strict";
-
-var hyphenate = _dereq_(147);
-
-var msPattern = /^ms-/;
-
-/**
- * Hyphenates a camelcased CSS property name, for example:
- *
- * > hyphenateStyleName('backgroundColor')
- * < "background-color"
- * > hyphenateStyleName('MozTransition')
- * < "-moz-transition"
- * > hyphenateStyleName('msTransition')
- * < "-ms-transition"
- *
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
- * is converted to `-ms-`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenateStyleName(string) {
- return hyphenate(string).replace(msPattern, '-ms-');
-}
-
-module.exports = hyphenateStyleName;
-
-},{"147":147}],149:[function(_dereq_,module,exports){
+},{"147":147}],132:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20136,23 +18241,29 @@
'use strict';
-var ReactCompositeComponent = _dereq_(43);
-var ReactEmptyComponent = _dereq_(65);
-var ReactNativeComponent = _dereq_(80);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactCompositeComponent = _dereq_(38);
+var ReactEmptyComponent = _dereq_(59);
+var ReactNativeComponent = _dereq_(75);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
// To avoid a cyclic dependency, we create the final class in this module
-var ReactCompositeComponentWrapper = function() { };
-assign(
- ReactCompositeComponentWrapper.prototype,
- ReactCompositeComponent.Mixin,
- {
+var ReactCompositeComponentWrapper = function () {};
+assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
+});
+
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
}
-);
+ return '';
+}
/**
* Check if the type reference is a known internal type. I.e. not a user
@@ -20162,49 +18273,31 @@
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
- return (
- typeof type === 'function' &&
- typeof type.prototype !== 'undefined' &&
- typeof type.prototype.mountComponent === 'function' &&
- typeof type.prototype.receiveComponent === 'function'
- );
+ return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
- * @param {*} parentCompositeType The composite type that resolved this.
* @return {object} A new instance of the element's constructor.
* @protected
*/
-function instantiateReactComponent(node, parentCompositeType) {
+function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
- node = ReactEmptyComponent.emptyElement;
- }
-
- if (typeof node === 'object') {
+ instance = new ReactEmptyComponent(instantiateReactComponent);
+ } else if (typeof node === 'object') {
var element = node;
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- element && (typeof element.type === 'function' ||
- typeof element.type === 'string'),
- 'Only functions or strings can be mounted as React components.'
- ) : null);
- }
+ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "development" !== '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;
// Special case string values
- if (parentCompositeType === element.type &&
- typeof element.type === 'string') {
- // Avoid recursion if the wrapper renders itself.
+ if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
- // All native components are currently wrapped in a composite so we're
- // safe to assume that this is what we should instantiate.
} else if (isInternalComponentType(element.type)) {
// 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.
instance = new element.type(element);
} else {
@@ -20213,21 +18306,11 @@
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
- ("production" !== "development" ? invariant(
- false,
- 'Encountered invalid React node of type %s',
- typeof node
- ) : invariant(false));
+ !false ? "development" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- typeof instance.construct === 'function' &&
- typeof instance.mountComponent === 'function' &&
- typeof instance.receiveComponent === 'function' &&
- typeof instance.unmountComponent === 'function',
- 'Only React Components can be mounted.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
@@ -20239,14 +18322,14 @@
instance._mountIndex = 0;
instance._mountImage = null;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
- if ("production" !== "development") {
+ if ("development" !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
@@ -20256,63 +18339,7 @@
}
module.exports = instantiateReactComponent;
-
-},{"150":150,"171":171,"29":29,"43":43,"65":65,"80":80}],150:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule invariant
- */
-
-"use strict";
-
-/**
- * Use invariant() to assert state which your program assumes to be true.
- *
- * Provide sprintf-style format (only %s is supported) and arguments
- * to provide information about what broke and what you were
- * expecting.
- *
- * The invariant message will be stripped in production, but the invariant
- * will remain to ensure logic does not differ in production.
- */
-
-var invariant = function(condition, format, a, b, c, d, e, f) {
- if ("production" !== "development") {
- if (format === undefined) {
- throw new Error('invariant requires an error message argument');
- }
- }
-
- if (!condition) {
- var error;
- if (format === undefined) {
- error = new Error(
- 'Minified exception occurred; use the non-minified dev environment ' +
- 'for the full error message and additional helpful warnings.'
- );
- } else {
- var args = [a, b, c, d, e, f];
- var argIndex = 0;
- error = new Error(
- 'Invariant Violation: ' +
- format.replace(/%s/g, function() { return args[argIndex++]; })
- );
- }
-
- error.framesToPop = 1; // we don't care about invariant's own frame
- throw error;
- }
-};
-
-module.exports = invariant;
-
-},{}],151:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"24":24,"38":38,"59":59,"75":75}],133:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20326,13 +18353,11 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
- useHasFeature =
- document.implementation &&
- document.implementation.hasFeature &&
+ useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
@@ -20353,13 +18378,12 @@
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
- if (!ExecutionEnvironment.canUseDOM ||
- capture && !('addEventListener' in document)) {
+ if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
- var isSupported = eventName in document;
+ var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');
@@ -20376,35 +18400,7 @@
}
module.exports = isEventSupported;
-
-},{"22":22}],152:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isNode
- * @typechecks
- */
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM node.
- */
-function isNode(object) {
- return !!(object && (
- ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
- typeof object.nodeType === 'number' &&
- typeof object.nodeName === 'string'))
- ));
-}
-
-module.exports = isNode;
-
-},{}],153:[function(_dereq_,module,exports){
+},{"147":147}],134:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20440,255 +18436,12 @@
};
function isTextInputElement(elem) {
- return elem && (
- (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
- );
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;
-
-},{}],154:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isTextNode
- * @typechecks
- */
-
-var isNode = _dereq_(152);
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM text node.
- */
-function isTextNode(object) {
- return isNode(object) && object.nodeType == 3;
-}
-
-module.exports = isTextNode;
-
-},{"152":152}],155:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule joinClasses
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Combines multiple className strings into one.
- * http://jsperf.com/joinclasses-args-vs-array
- *
- * @param {...?string} classes
- * @return {string}
- */
-function joinClasses(className/*, ... */) {
- if (!className) {
- className = '';
- }
- var nextClass;
- var argLength = arguments.length;
- if (argLength > 1) {
- for (var ii = 1; ii < argLength; ii++) {
- nextClass = arguments[ii];
- if (nextClass) {
- className = (className ? className + ' ' : '') + nextClass;
- }
- }
- }
- return className;
-}
-
-module.exports = joinClasses;
-
-},{}],156:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyMirror
- * @typechecks static-only
- */
-
-'use strict';
-
-var invariant = _dereq_(150);
-
-/**
- * Constructs an enumeration with keys equal to their value.
- *
- * For example:
- *
- * var COLORS = keyMirror({blue: null, red: null});
- * var myColor = COLORS.blue;
- * var isColorValid = !!COLORS[myColor];
- *
- * The last line could not be performed if the values of the generated enum were
- * not equal to their keys.
- *
- * Input: {key1: val1, key2: val2}
- * Output: {key1: key1, key2: key2}
- *
- * @param {object} obj
- * @return {object}
- */
-var keyMirror = function(obj) {
- var ret = {};
- var key;
- ("production" !== "development" ? invariant(
- obj instanceof Object && !Array.isArray(obj),
- 'keyMirror(...): Argument must be an object.'
- ) : invariant(obj instanceof Object && !Array.isArray(obj)));
- for (key in obj) {
- if (!obj.hasOwnProperty(key)) {
- continue;
- }
- ret[key] = key;
- }
- return ret;
-};
-
-module.exports = keyMirror;
-
-},{"150":150}],157:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyOf
- */
-
-/**
- * Allows extraction of a minified key. Let's the build system minify keys
- * without loosing the ability to dynamically use key strings as values
- * themselves. Pass in an object with a single key/val pair and it will return
- * you the string key of that single record. Suppose you want to grab the
- * value for a key 'className' inside of an object. Key/val minification may
- * have aliased that key to be 'xa12'. keyOf({className: null}) will return
- * 'xa12' in that case. Resolve keys you want to use once at startup time, then
- * reuse those resolutions.
- */
-var keyOf = function(oneKeyObj) {
- var key;
- for (key in oneKeyObj) {
- if (!oneKeyObj.hasOwnProperty(key)) {
- continue;
- }
- return key;
- }
- return null;
-};
-
-
-module.exports = keyOf;
-
-},{}],158:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule mapObject
- */
-
-'use strict';
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-/**
- * Executes the provided `callback` once for each enumerable own property in the
- * object and constructs a new object from the results. The `callback` is
- * invoked with three arguments:
- *
- * - the property value
- * - the property name
- * - the object being traversed
- *
- * Properties that are added after the call to `mapObject` will not be visited
- * by `callback`. If the values of existing properties are changed, the value
- * passed to `callback` will be the value at the time `mapObject` visits them.
- * Properties that are deleted before being visited are not visited.
- *
- * @grep function objectMap()
- * @grep function objMap()
- *
- * @param {?object} object
- * @param {function} callback
- * @param {*} context
- * @return {?object}
- */
-function mapObject(object, callback, context) {
- if (!object) {
- return null;
- }
- var result = {};
- for (var name in object) {
- if (hasOwnProperty.call(object, name)) {
- result[name] = callback.call(context, object[name], name, object);
- }
- }
- return result;
-}
-
-module.exports = mapObject;
-
-},{}],159:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule memoizeStringOnly
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Memoizes the return value of a function that accepts one string argument.
- *
- * @param {function} callback
- * @return {function}
- */
-function memoizeStringOnly(callback) {
- var cache = {};
- return function(string) {
- if (!cache.hasOwnProperty(string)) {
- cache[string] = callback.call(this, string);
- }
- return cache[string];
- };
-}
-
-module.exports = memoizeStringOnly;
-
-},{}],160:[function(_dereq_,module,exports){
+},{}],135:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20701,9 +18454,9 @@
*/
'use strict';
-var ReactElement = _dereq_(63);
+var ReactElement = _dereq_(57);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* Returns the first child in a collection of children and verifies that there
@@ -20717,16 +18470,12 @@
* structure.
*/
function onlyChild(children) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(children),
- 'onlyChild must be passed a children with exactly one child.'
- ) : invariant(ReactElement.isValidElement(children)));
+ !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}
module.exports = onlyChild;
-
-},{"150":150,"63":63}],161:[function(_dereq_,module,exports){
+},{"161":161,"57":57}],136:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20735,54 +18484,25 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule performance
- * @typechecks
+ * @providesModule quoteAttributeValueForBrowser
*/
-"use strict";
-
-var ExecutionEnvironment = _dereq_(22);
-
-var performance;
+'use strict';
-if (ExecutionEnvironment.canUseDOM) {
- performance =
- window.performance ||
- window.msPerformance ||
- window.webkitPerformance;
-}
+var escapeTextContentForBrowser = _dereq_(121);
-module.exports = performance || {};
-
-},{"22":22}],162:[function(_dereq_,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
+ * Escapes attribute value to prevent scripting attacks.
*
- * @providesModule performanceNow
- * @typechecks
- */
-
-var performance = _dereq_(161);
-
-/**
- * Detect if we can use `window.performance.now()` and gracefully fallback to
- * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
- * because of Facebook's testing infrastructure.
+ * @param {*} value Value to escape.
+ * @return {string} An escaped string.
*/
-if (!performance || !performance.now) {
- performance = Date;
+function quoteAttributeValueForBrowser(value) {
+ return '"' + escapeTextContentForBrowser(value) + '"';
}
-var performanceNow = performance.now.bind(performance);
-
-module.exports = performanceNow;
-
-},{"161":161}],163:[function(_dereq_,module,exports){
+module.exports = quoteAttributeValueForBrowser;
+},{"121":121}],137:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20791,26 +18511,15 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule quoteAttributeValueForBrowser
- */
+* @providesModule renderSubtreeIntoContainer
+*/
'use strict';
-var escapeTextContentForBrowser = _dereq_(131);
-
-/**
- * Escapes attribute value to prevent scripting attacks.
- *
- * @param {*} value Value to escape.
- * @return {string} An escaped string.
- */
-function quoteAttributeValueForBrowser(value) {
- return '"' + escapeTextContentForBrowser(value) + '"';
-}
-
-module.exports = quoteAttributeValueForBrowser;
+var ReactMount = _dereq_(72);
-},{"131":131}],164:[function(_dereq_,module,exports){
+module.exports = ReactMount.renderSubtreeIntoContainer;
+},{"72":72}],138:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20826,7 +18535,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
@@ -20839,14 +18548,14 @@
* @param {string} html
* @internal
*/
-var setInnerHTML = function(node, html) {
+var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
- setInnerHTML = function(node, html) {
- MSApp.execUnsafeLocalFunction(function() {
+ setInnerHTML = function (node, html) {
+ MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
@@ -20862,7 +18571,7 @@
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
- setInnerHTML = function(node, html) {
+ setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
@@ -20876,11 +18585,14 @@
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
- if (WHITESPACE_TEST.test(html) ||
- html[0] === '<' && NONVISIBLE_TEST.test(html)) {
+ if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
- node.innerHTML = '\uFEFF' + html;
+ // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
+ // in hopes that this is preserved even if "\uFEFF" is transformed to
+ // the actual Unicode character (by Babel, for example).
+ // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
+ node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
@@ -20898,8 +18610,7 @@
}
module.exports = setInnerHTML;
-
-},{"22":22}],165:[function(_dereq_,module,exports){
+},{"147":147}],139:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20913,9 +18624,9 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
-var escapeTextContentForBrowser = _dereq_(131);
-var setInnerHTML = _dereq_(164);
+var ExecutionEnvironment = _dereq_(147);
+var escapeTextContentForBrowser = _dereq_(121);
+var setInnerHTML = _dereq_(138);
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
@@ -20927,21 +18638,20 @@
* @param {string} text
* @internal
*/
-var setTextContent = function(node, text) {
+var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
- setTextContent = function(node, text) {
+ setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
-
-},{"131":131,"164":164,"22":22}],166:[function(_dereq_,module,exports){
+},{"121":121,"138":138,"147":147}],140:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20950,42 +18660,23 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule shallowEqual
- */
+* @providesModule shallowCompare
+*/
'use strict';
+var shallowEqual = _dereq_(171);
+
/**
- * Performs equality by iterating through keys on an object and returning
- * false when any key has values which are not strictly equal between
- * objA and objB. Returns true when the values of all keys are strictly equal.
- *
- * @return {boolean}
+ * Does a shallow comparison for props and state.
+ * See ReactComponentWithPureRenderMixin
*/
-function shallowEqual(objA, objB) {
- if (objA === objB) {
- return true;
- }
- var key;
- // Test for A's keys different from B.
- for (key in objA) {
- if (objA.hasOwnProperty(key) &&
- (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
- return false;
- }
- }
- // Test for B's keys missing from A.
- for (key in objB) {
- if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
- return false;
- }
- }
- return true;
+function shallowCompare(instance, nextProps, nextState) {
+ return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
}
-module.exports = shallowEqual;
-
-},{}],167:[function(_dereq_,module,exports){
+module.exports = shallowCompare;
+},{"171":171}],141:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -21000,8 +18691,6 @@
'use strict';
-var warning = _dereq_(171);
-
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
@@ -21014,150 +18703,24 @@
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
- if (prevElement != null && nextElement != null) {
+ 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');
+ return nextType === 'string' || nextType === 'number';
} else {
- if (nextType === 'object' &&
- prevElement.type === nextElement.type &&
- prevElement.key === nextElement.key) {
- var ownersMatch = prevElement._owner === nextElement._owner;
- var prevName = null;
- var nextName = null;
- var nextDisplayName = null;
- if ("production" !== "development") {
- if (!ownersMatch) {
- if (prevElement._owner != null &&
- prevElement._owner.getPublicInstance() != null &&
- prevElement._owner.getPublicInstance().constructor != null) {
- prevName =
- prevElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement._owner != null &&
- nextElement._owner.getPublicInstance() != null &&
- nextElement._owner.getPublicInstance().constructor != null) {
- nextName =
- nextElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement.type != null &&
- nextElement.type.displayName != null) {
- nextDisplayName = nextElement.type.displayName;
- }
- if (nextElement.type != null && typeof nextElement.type === 'string') {
- nextDisplayName = nextElement.type;
- }
- if (typeof nextElement.type !== 'string' ||
- nextElement.type === 'input' ||
- nextElement.type === 'textarea') {
- if ((prevElement._owner != null &&
- prevElement._owner._isOwnerNecessary === false) ||
- (nextElement._owner != null &&
- nextElement._owner._isOwnerNecessary === false)) {
- if (prevElement._owner != null) {
- prevElement._owner._isOwnerNecessary = true;
- }
- if (nextElement._owner != null) {
- nextElement._owner._isOwnerNecessary = true;
- }
- ("production" !== "development" ? warning(
- false,
- '<%s /> is being rendered by both %s and %s using the same ' +
- 'key (%s) in the same place. Currently, this means that ' +
- 'they don\'t preserve state. This behavior should be very ' +
- 'rare so we\'re considering deprecating it. Please contact ' +
- 'the React team and explain your use case so that we can ' +
- 'take that into consideration.',
- nextDisplayName || 'Unknown Component',
- prevName || '[Unknown]',
- nextName || '[Unknown]',
- prevElement.key
- ) : null);
- }
- }
- }
- }
- return ownersMatch;
- }
- }
+ return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}
module.exports = shouldUpdateReactComponent;
-
-},{"171":171}],168:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule toArray
- * @typechecks
- */
-
-var invariant = _dereq_(150);
-
-/**
- * Convert array-like objects to arrays.
- *
- * This API assumes the caller knows the contents of the data type. For less
- * well defined inputs use createArrayFromMixed.
- *
- * @param {object|function|filelist} obj
- * @return {array}
- */
-function toArray(obj) {
- var length = obj.length;
-
- // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
- // old versions of Safari).
- ("production" !== "development" ? invariant(
- !Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function'),
- 'toArray: Array-like object expected'
- ) : invariant(!Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function')));
-
- ("production" !== "development" ? invariant(
- typeof length === 'number',
- 'toArray: Object needs a length property'
- ) : invariant(typeof length === 'number'));
-
- ("production" !== "development" ? invariant(
- length === 0 ||
- (length - 1) in obj,
- 'toArray: Object should have keys for indices'
- ) : invariant(length === 0 ||
- (length - 1) in obj));
-
- // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
- // without method will throw during the slice call and skip straight to the
- // fallback.
- if (obj.hasOwnProperty) {
- try {
- return Array.prototype.slice.call(obj);
- } catch (e) {
- // IE < 9 does not support Array#slice on collections objects
- }
- }
-
- // Fall back to copying key by key. This assumes all keys have a value,
- // so will not preserve sparsely populated inputs.
- var ret = Array(length);
- for (var ii = 0; ii < length; ii++) {
- ret[ii] = obj[ii];
- }
- return ret;
-}
-
-module.exports = toArray;
-
-},{"150":150}],169:[function(_dereq_,module,exports){
+},{}],142:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -21171,13 +18734,13 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactFragment = _dereq_(69);
-var ReactInstanceHandles = _dereq_(72);
-
-var getIteratorFn = _dereq_(141);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactCurrentOwner = _dereq_(39);
+var ReactElement = _dereq_(57);
+var ReactInstanceHandles = _dereq_(67);
+
+var getIteratorFn = _dereq_(129);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
@@ -21220,14 +18783,11 @@
/**
* Escape a component key so that it is safe to use in a reactid.
*
- * @param {*} key Component key to be escaped.
+ * @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
- return ('' + text).replace(
- userProvidedKeyEscapeRegex,
- userProvidedKeyEscaper
- );
+ return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
@@ -21244,19 +18804,12 @@
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
- * @param {!number} indexSoFar Number of children encountered until this point.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
-function traverseAllChildrenImpl(
- children,
- nameSoFar,
- indexSoFar,
- callback,
- traverseContext
-) {
+function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
@@ -21264,39 +18817,24 @@
children = null;
}
- if (children === null ||
- type === 'string' ||
- type === 'number' ||
- ReactElement.isValidElement(children)) {
- callback(
- traverseContext,
- children,
+ if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
+ callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
- indexSoFar
- );
+ nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
- var child, nextName, nextIndex;
+ var child;
+ var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, i)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, i);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
@@ -21307,27 +18845,12 @@
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, ii++)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, ii++);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- didWarnAboutMaps,
- 'Using Maps as children is not yet fully supported. It is an ' +
- 'experimental feature that might be removed. Convert it to a ' +
- 'sequence / iterable of keyed ReactElements instead.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
@@ -21335,49 +18858,29 @@
var entry = step.value;
if (entry) {
child = entry[1];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
- ("production" !== "development" ? invariant(
- children.nodeType !== 1,
- 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
- 'elements are not valid children of React components.'
- ) : invariant(children.nodeType !== 1));
- var fragment = ReactFragment.extract(children);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- child = fragment[key];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(key) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ var addendum = '';
+ if ("development" !== 'production') {
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
+ if (children._isReactElement) {
+ addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
+ if (ReactCurrentOwner.current) {
+ var name = ReactCurrentOwner.current.getName();
+ if (name) {
+ addendum += ' Check the render method of `' + name + '`.';
}
}
}
+ var childrenString = String(children);
+ !false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
+ }
+ }
return subtreeCount;
}
@@ -21403,12 +18906,11 @@
return 0;
}
- return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
+ return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
-
-},{"141":141,"150":150,"171":171,"63":63,"69":69,"72":72}],170:[function(_dereq_,module,exports){
+},{"129":129,"161":161,"173":173,"39":39,"57":57,"67":67}],143:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -21420,14 +18922,14 @@
* @providesModule update
*/
- /* global hasOwnProperty:true */
+/* global hasOwnProperty:true */
'use strict';
-var assign = _dereq_(29);
-var keyOf = _dereq_(157);
-var invariant = _dereq_(150);
-var hasOwnProperty = {}.hasOwnProperty;
+var assign = _dereq_(24);
+var keyOf = _dereq_(166);
+var invariant = _dereq_(161);
+var hasOwnProperty = ({}).hasOwnProperty;
function shallowCopy(x) {
if (Array.isArray(x)) {
@@ -21439,60 +18941,32 @@
}
}
-var COMMAND_PUSH = keyOf({$push: null});
-var COMMAND_UNSHIFT = keyOf({$unshift: null});
-var COMMAND_SPLICE = keyOf({$splice: null});
-var COMMAND_SET = keyOf({$set: null});
-var COMMAND_MERGE = keyOf({$merge: null});
-var COMMAND_APPLY = keyOf({$apply: null});
-
-var ALL_COMMANDS_LIST = [
- COMMAND_PUSH,
- COMMAND_UNSHIFT,
- COMMAND_SPLICE,
- COMMAND_SET,
- COMMAND_MERGE,
- COMMAND_APPLY
-];
+var COMMAND_PUSH = keyOf({ $push: null });
+var COMMAND_UNSHIFT = keyOf({ $unshift: null });
+var COMMAND_SPLICE = keyOf({ $splice: null });
+var COMMAND_SET = keyOf({ $set: null });
+var COMMAND_MERGE = keyOf({ $merge: null });
+var COMMAND_APPLY = keyOf({ $apply: null });
+
+var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
var ALL_COMMANDS_SET = {};
-ALL_COMMANDS_LIST.forEach(function(command) {
+ALL_COMMANDS_LIST.forEach(function (command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
- ("production" !== "development" ? invariant(
- Array.isArray(value),
- 'update(): expected target of %s to be an array; got %s.',
- command,
- value
- ) : invariant(Array.isArray(value)));
+ !Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
var specValue = spec[command];
- ("production" !== "development" ? invariant(
- Array.isArray(specValue),
- 'update(): expected spec of %s to be an array; got %s. ' +
- 'Did you forget to wrap your parameter in an array?',
- command,
- specValue
- ) : invariant(Array.isArray(specValue)));
+ !Array.isArray(specValue) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
}
function update(value, spec) {
- ("production" !== "development" ? invariant(
- typeof spec === 'object',
- 'update(): You provided a key path to update() that did not contain one ' +
- 'of %s. Did you forget to include {%s: ...}?',
- ALL_COMMANDS_LIST.join(', '),
- COMMAND_SET
- ) : invariant(typeof spec === 'object'));
+ !(typeof spec === 'object') ? "development" !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
if (hasOwnProperty.call(spec, COMMAND_SET)) {
- ("production" !== "development" ? invariant(
- Object.keys(spec).length === 1,
- 'Cannot have more than one key in an object with %s',
- COMMAND_SET
- ) : invariant(Object.keys(spec).length === 1));
+ !(Object.keys(spec).length === 1) ? "development" !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
return spec[COMMAND_SET];
}
@@ -21501,68 +18975,36 @@
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
- ("production" !== "development" ? invariant(
- mergeObj && typeof mergeObj === 'object',
- 'update(): %s expects a spec of type \'object\'; got %s',
- COMMAND_MERGE,
- mergeObj
- ) : invariant(mergeObj && typeof mergeObj === 'object'));
- ("production" !== "development" ? invariant(
- nextValue && typeof nextValue === 'object',
- 'update(): %s expects a target of type \'object\'; got %s',
- COMMAND_MERGE,
- nextValue
- ) : invariant(nextValue && typeof nextValue === 'object'));
+ !(mergeObj && typeof mergeObj === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
+ !(nextValue && typeof nextValue === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
assign(nextValue, spec[COMMAND_MERGE]);
}
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
- spec[COMMAND_PUSH].forEach(function(item) {
+ spec[COMMAND_PUSH].forEach(function (item) {
nextValue.push(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
- spec[COMMAND_UNSHIFT].forEach(function(item) {
+ spec[COMMAND_UNSHIFT].forEach(function (item) {
nextValue.unshift(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
- ("production" !== "development" ? invariant(
- Array.isArray(value),
- 'Expected %s target to be an array; got %s',
- COMMAND_SPLICE,
- value
- ) : invariant(Array.isArray(value)));
- ("production" !== "development" ? invariant(
- Array.isArray(spec[COMMAND_SPLICE]),
- 'update(): expected spec of %s to be an array of arrays; got %s. ' +
- 'Did you forget to wrap your parameters in an array?',
- COMMAND_SPLICE,
- spec[COMMAND_SPLICE]
- ) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
- spec[COMMAND_SPLICE].forEach(function(args) {
- ("production" !== "development" ? invariant(
- Array.isArray(args),
- 'update(): expected spec of %s to be an array of arrays; got %s. ' +
- 'Did you forget to wrap your parameters in an array?',
- COMMAND_SPLICE,
- spec[COMMAND_SPLICE]
- ) : invariant(Array.isArray(args)));
+ !Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
+ !Array.isArray(spec[COMMAND_SPLICE]) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
+ spec[COMMAND_SPLICE].forEach(function (args) {
+ !Array.isArray(args) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
nextValue.splice.apply(nextValue, args);
});
}
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
- ("production" !== "development" ? invariant(
- typeof spec[COMMAND_APPLY] === 'function',
- 'update(): expected spec of %s to be a function; got %s.',
- COMMAND_APPLY,
- spec[COMMAND_APPLY]
- ) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
+ !(typeof spec[COMMAND_APPLY] === 'function') ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
nextValue = spec[COMMAND_APPLY](nextValue);
}
@@ -21576,8 +19018,1702 @@
}
module.exports = update;
+},{"161":161,"166":166,"24":24}],144:[function(_dereq_,module,exports){
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule validateDOMNesting
+ */
+
+'use strict';
+
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
+var warning = _dereq_(173);
+
+var validateDOMNesting = emptyFunction;
+
+if ("development" !== 'production') {
+ // This validation code was written based on the HTML5 parsing spec:
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ //
+ // Note: this does not catch all invalid nesting, nor does it try to (as it's
+ // not clear what practical benefit doing so provides); instead, we warn only
+ // for cases where the parser will give a parse tree differing from what React
+ // intended. For example, <b><div></div></b> is invalid but we don't warn
+ // because it still parses correctly; we do warn for other cases like nested
+ // <p> tags where the beginning of the second element implicitly closes the
+ // first, causing a confusing mess.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#special
+ var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
+ // TODO: Distinguish by namespace here -- for <title>, including it here
+ // errs on the side of fewer warnings
+ 'foreignObject', 'desc', 'title'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
+ var buttonScopeTags = inScopeTags.concat(['button']);
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
+ var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
+
+ var emptyAncestorInfo = {
+ parentTag: null,
+
+ formTag: null,
+ aTagInScope: null,
+ buttonTagInScope: null,
+ nobrTagInScope: null,
+ pTagInButtonScope: null,
+
+ listItemTagAutoclosing: null,
+ dlItemTagAutoclosing: null
+ };
+
+ var updatedAncestorInfo = function (oldInfo, tag, instance) {
+ var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
+ var info = { tag: tag, instance: instance };
+
+ if (inScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.aTagInScope = null;
+ ancestorInfo.buttonTagInScope = null;
+ ancestorInfo.nobrTagInScope = null;
+ }
+ if (buttonScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.pTagInButtonScope = null;
+ }
+
+ // See rules for 'li', 'dd', 'dt' start tags in
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
+ ancestorInfo.listItemTagAutoclosing = null;
+ ancestorInfo.dlItemTagAutoclosing = null;
+ }
+
+ ancestorInfo.parentTag = info;
+
+ if (tag === 'form') {
+ ancestorInfo.formTag = info;
+ }
+ if (tag === 'a') {
+ ancestorInfo.aTagInScope = info;
+ }
+ if (tag === 'button') {
+ ancestorInfo.buttonTagInScope = info;
+ }
+ if (tag === 'nobr') {
+ ancestorInfo.nobrTagInScope = info;
+ }
+ if (tag === 'p') {
+ ancestorInfo.pTagInButtonScope = info;
+ }
+ if (tag === 'li') {
+ ancestorInfo.listItemTagAutoclosing = info;
+ }
+ if (tag === 'dd' || tag === 'dt') {
+ ancestorInfo.dlItemTagAutoclosing = info;
+ }
+
+ return ancestorInfo;
+ };
+
+ /**
+ * Returns whether
+ */
+ var isTagValidWithParent = function (tag, parentTag) {
+ // First, let's check if we're in an unusual parsing mode...
+ switch (parentTag) {
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
+ case 'select':
+ return tag === 'option' || tag === 'optgroup' || tag === '#text';
+ case 'optgroup':
+ return tag === 'option' || tag === '#text';
+ // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
+ // but
+ case 'option':
+ return tag === '#text';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
+ // No special behavior since these rules fall back to "in body" mode for
+ // all except special table nodes which cause bad parsing behavior anyway.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
+ case 'tr':
+ return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
+ case 'tbody':
+ case 'thead':
+ case 'tfoot':
+ return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
+ case 'colgroup':
+ return tag === 'col' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
+ case 'table':
+ return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
+ case 'head':
+ return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
+ case 'html':
+ return tag === 'head' || tag === 'body';
+ }
+
+ // Probably in the "in body" parsing mode, so we outlaw only tag combos
+ // where the parsing rules cause implicit opens or closes to be added.
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ switch (tag) {
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
+
+ case 'rp':
+ case 'rt':
+ return impliedEndTags.indexOf(parentTag) === -1;
+
+ case 'caption':
+ case 'col':
+ case 'colgroup':
+ case 'frame':
+ case 'head':
+ case 'tbody':
+ case 'td':
+ case 'tfoot':
+ case 'th':
+ case 'thead':
+ case 'tr':
+ // These tags are only valid with a few parents that have special child
+ // parsing rules -- if we're down here, then none of those matched and
+ // so we allow it only if we don't know what the parent is, as all other
+ // cases are invalid.
+ return parentTag == null;
+ }
+
+ return true;
+ };
+
+ /**
+ * Returns whether
+ */
+ var findInvalidAncestorForTag = function (tag, ancestorInfo) {
+ switch (tag) {
+ case 'address':
+ case 'article':
+ case 'aside':
+ case 'blockquote':
+ case 'center':
+ case 'details':
+ case 'dialog':
+ case 'dir':
+ case 'div':
+ case 'dl':
+ case 'fieldset':
+ case 'figcaption':
+ case 'figure':
+ case 'footer':
+ case 'header':
+ case 'hgroup':
+ case 'main':
+ case 'menu':
+ case 'nav':
+ case 'ol':
+ case 'p':
+ case 'section':
+ case 'summary':
+ case 'ul':
+
+ case 'pre':
+ case 'listing':
+
+ case 'table':
+
+ case 'hr':
+
+ case 'xmp':
+
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return ancestorInfo.pTagInButtonScope;
+
+ case 'form':
+ return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
+
+ case 'li':
+ return ancestorInfo.listItemTagAutoclosing;
+
+ case 'dd':
+ case 'dt':
+ return ancestorInfo.dlItemTagAutoclosing;
+
+ case 'button':
+ return ancestorInfo.buttonTagInScope;
+
+ case 'a':
+ // Spec says something about storing a list of markers, but it sounds
+ // equivalent to this check.
+ return ancestorInfo.aTagInScope;
+
+ case 'nobr':
+ return ancestorInfo.nobrTagInScope;
+ }
+
+ return null;
+ };
+
+ /**
+ * Given a ReactCompositeComponent instance, return a list of its recursive
+ * owners, starting at the root and ending with the instance itself.
+ */
+ var findOwnerStack = function (instance) {
+ if (!instance) {
+ return [];
+ }
+
+ var stack = [];
+ /*eslint-disable space-after-keywords */
+ do {
+ /*eslint-enable space-after-keywords */
+ stack.push(instance);
+ } while (instance = instance._currentElement._owner);
+ stack.reverse();
+ return stack;
+ };
+
+ var didWarn = {};
+
+ validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+
+ var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
+ var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
+ var problematic = invalidParent || invalidAncestor;
+
+ if (problematic) {
+ var ancestorTag = problematic.tag;
+ var ancestorInstance = problematic.instance;
+
+ var childOwner = childInstance && childInstance._currentElement._owner;
+ var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
+
+ var childOwners = findOwnerStack(childOwner);
+ var ancestorOwners = findOwnerStack(ancestorOwner);
+
+ var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
+ var i;
+
+ var deepestCommon = -1;
+ for (i = 0; i < minStackLen; i++) {
+ if (childOwners[i] === ancestorOwners[i]) {
+ deepestCommon = i;
+ } else {
+ break;
+ }
+ }
+
+ var UNKNOWN = '(unknown)';
+ var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ownerInfo = [].concat(
+ // If the parent and child instances have a common owner ancestor, start
+ // with that -- otherwise we just start with the parent's owners.
+ deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
+ // If we're warning about an invalid (non-parent) ancestry, add '...'
+ invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
+
+ var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
+ if (didWarn[warnKey]) {
+ return;
+ }
+ didWarn[warnKey] = true;
+
+ if (invalidParent) {
+ var info = '';
+ if (ancestorTag === 'table' && childTag === 'tr') {
+ info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
+ }
+ "development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
+ } else {
+ "development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
+ }
+ }
+ };
+
+ validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
+
+ validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
+
+ // For testing
+ validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+ return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
+ };
+}
+
+module.exports = validateDOMNesting;
+},{"153":153,"173":173,"24":24}],145:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule CSSCore
+ * @typechecks
+ */
+
+'use strict';
+
+var invariant = _dereq_(161);
+
+/**
+ * The CSSCore module specifies the API (and implements most of the methods)
+ * that should be used when dealing with the display of elements (via their
+ * CSS classes and visibility on screen. It is an API focused on mutating the
+ * display and not reading it as no logical state should be encoded in the
+ * display of elements.
+ */
+
+var CSSCore = {
+
+ /**
+ * Adds the class passed in to the element if it doesn't already have it.
+ *
+ * @param {DOMElement} element the element to set the class on
+ * @param {string} className the CSS className
+ * @return {DOMElement} the element passed in
+ */
+ addClass: function (element, className) {
+ !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
+
+ if (className) {
+ if (element.classList) {
+ element.classList.add(className);
+ } else if (!CSSCore.hasClass(element, className)) {
+ element.className = element.className + ' ' + className;
+ }
+ }
+ return element;
+ },
+
+ /**
+ * Removes the class passed in from the element
+ *
+ * @param {DOMElement} element the element to set the class on
+ * @param {string} className the CSS className
+ * @return {DOMElement} the element passed in
+ */
+ removeClass: function (element, className) {
+ !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
+
+ if (className) {
+ if (element.classList) {
+ element.classList.remove(className);
+ } else if (CSSCore.hasClass(element, className)) {
+ element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one
+ .replace(/^\s*|\s*$/g, ''); // trim the ends
+ }
+ }
+ return element;
+ },
+
+ /**
+ * Helper to add or remove a class from an element based on a condition.
+ *
+ * @param {DOMElement} element the element to set the class on
+ * @param {string} className the CSS className
+ * @param {*} bool condition to whether to add or remove the class
+ * @return {DOMElement} the element passed in
+ */
+ conditionClass: function (element, className, bool) {
+ return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
+ },
+
+ /**
+ * Tests whether the element has the class specified.
+ *
+ * @param {DOMNode|DOMWindow} element the element to set the class on
+ * @param {string} className the CSS className
+ * @return {boolean} true if the element has the class, false if not
+ */
+ hasClass: function (element, className) {
+ !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : undefined;
+ if (element.classList) {
+ return !!className && element.classList.contains(className);
+ }
+ return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
+ }
+
+};
+
+module.exports = CSSCore;
+},{"161":161}],146:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @providesModule EventListener
+ * @typechecks
+ */
+
+'use strict';
+
+var emptyFunction = _dereq_(153);
+
+/**
+ * Upstream version of event listener. Does not take into account specific
+ * nature of platform.
+ */
+var EventListener = {
+ /**
+ * Listen to DOM events during the bubble phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ listen: function (target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, false);
+ return {
+ remove: function () {
+ target.removeEventListener(eventType, callback, false);
+ }
+ };
+ } else if (target.attachEvent) {
+ target.attachEvent('on' + eventType, callback);
+ return {
+ remove: function () {
+ target.detachEvent('on' + eventType, callback);
+ }
+ };
+ }
+ },
+
+ /**
+ * Listen to DOM events during the capture phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ capture: function (target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, true);
+ return {
+ remove: function () {
+ target.removeEventListener(eventType, callback, true);
+ }
+ };
+ } else {
+ if ("development" !== 'production') {
+ console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
+ }
+ return {
+ remove: emptyFunction
+ };
+ }
+ },
+
+ registerDefault: function () {}
+};
+
+module.exports = EventListener;
+},{"153":153}],147:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ExecutionEnvironment
+ */
+
+'use strict';
+
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+/**
+ * Simple, lightweight module assisting with the detection and context of
+ * Worker. Helps avoid circular dependencies and allows code to reason about
+ * whether or not they are in a Worker, even if they never include the main
+ * `ReactWorker` dependency.
+ */
+var ExecutionEnvironment = {
+
+ canUseDOM: canUseDOM,
+
+ canUseWorkers: typeof Worker !== 'undefined',
+
+ canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
+
+ canUseViewport: canUseDOM && !!window.screen,
+
+ isInWorker: !canUseDOM // For now, this is true - might change in the future.
+
+};
+
+module.exports = ExecutionEnvironment;
+},{}],148:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule camelize
+ * @typechecks
+ */
+
+"use strict";
+
+var _hyphenPattern = /-(.)/g;
+
+/**
+ * Camelcases a hyphenated string, for example:
+ *
+ * > camelize('background-color')
+ * < "backgroundColor"
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function camelize(string) {
+ return string.replace(_hyphenPattern, function (_, character) {
+ return character.toUpperCase();
+ });
+}
+
+module.exports = camelize;
+},{}],149:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule camelizeStyleName
+ * @typechecks
+ */
+
+'use strict';
+
+var camelize = _dereq_(148);
+
+var msPattern = /^-ms-/;
+
+/**
+ * Camelcases a hyphenated CSS property name, for example:
+ *
+ * > camelizeStyleName('background-color')
+ * < "backgroundColor"
+ * > camelizeStyleName('-moz-transition')
+ * < "MozTransition"
+ * > camelizeStyleName('-ms-transition')
+ * < "msTransition"
+ *
+ * As Andi Smith suggests
+ * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
+ * is converted to lowercase `ms`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function camelizeStyleName(string) {
+ return camelize(string.replace(msPattern, 'ms-'));
+}
+
+module.exports = camelizeStyleName;
+},{"148":148}],150:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule containsNode
+ * @typechecks
+ */
+
+'use strict';
+
+var isTextNode = _dereq_(163);
+
+/*eslint-disable no-bitwise */
+
+/**
+ * Checks if a given DOM node contains or is another DOM node.
+ *
+ * @param {?DOMNode} outerNode Outer DOM node.
+ * @param {?DOMNode} innerNode Inner DOM node.
+ * @return {boolean} True if `outerNode` contains or is `innerNode`.
+ */
+function containsNode(_x, _x2) {
+ var _again = true;
+
+ _function: while (_again) {
+ var outerNode = _x,
+ innerNode = _x2;
+ _again = false;
+
+ if (!outerNode || !innerNode) {
+ return false;
+ } else if (outerNode === innerNode) {
+ return true;
+ } else if (isTextNode(outerNode)) {
+ return false;
+ } else if (isTextNode(innerNode)) {
+ _x = outerNode;
+ _x2 = innerNode.parentNode;
+ _again = true;
+ continue _function;
+ } else if (outerNode.contains) {
+ return outerNode.contains(innerNode);
+ } else if (outerNode.compareDocumentPosition) {
+ return !!(outerNode.compareDocumentPosition(innerNode) & 16);
+ } else {
+ return false;
+ }
+ }
+}
+
+module.exports = containsNode;
+},{"163":163}],151:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createArrayFromMixed
+ * @typechecks
+ */
+
+'use strict';
+
+var toArray = _dereq_(172);
+
+/**
+ * Perform a heuristic test to determine if an object is "array-like".
+ *
+ * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
+ * Joshu replied: "Mu."
+ *
+ * This function determines if its argument has "array nature": it returns
+ * true if the argument is an actual array, an `arguments' object, or an
+ * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
+ *
+ * It will return false for other array-like objects like Filelist.
+ *
+ * @param {*} obj
+ * @return {boolean}
+ */
+function hasArrayNature(obj) {
+ return(
+ // not null/false
+ !!obj && (
+ // arrays are objects, NodeLists are functions in Safari
+ typeof obj == 'object' || typeof obj == 'function') &&
+ // quacks like an array
+ 'length' in obj &&
+ // not window
+ !('setInterval' in obj) &&
+ // no DOM node should be considered an array-like
+ // a 'select' element has 'length' and 'item' properties on IE8
+ typeof obj.nodeType != 'number' && (
+ // a real array
+ Array.isArray(obj) ||
+ // arguments
+ 'callee' in obj ||
+ // HTMLCollection/NodeList
+ 'item' in obj)
+ );
+}
+
+/**
+ * Ensure that the argument is an array by wrapping it in an array if it is not.
+ * Creates a copy of the argument if it is already an array.
+ *
+ * This is mostly useful idiomatically:
+ *
+ * var createArrayFromMixed = require('createArrayFromMixed');
+ *
+ * function takesOneOrMoreThings(things) {
+ * things = createArrayFromMixed(things);
+ * ...
+ * }
+ *
+ * This allows you to treat `things' as an array, but accept scalars in the API.
+ *
+ * If you need to convert an array-like object, like `arguments`, into an array
+ * use toArray instead.
+ *
+ * @param {*} obj
+ * @return {array}
+ */
+function createArrayFromMixed(obj) {
+ if (!hasArrayNature(obj)) {
+ return [obj];
+ } else if (Array.isArray(obj)) {
+ return obj.slice();
+ } else {
+ return toArray(obj);
+ }
+}
+
+module.exports = createArrayFromMixed;
+},{"172":172}],152:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createNodesFromMarkup
+ * @typechecks
+ */
+
+/*eslint-disable fb-www/unsafe-html*/
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(147);
+
+var createArrayFromMixed = _dereq_(151);
+var getMarkupWrap = _dereq_(157);
+var invariant = _dereq_(161);
+
+/**
+ * Dummy container used to render all markup.
+ */
+var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
+
+/**
+ * Pattern used by `getNodeName`.
+ */
+var nodeNamePattern = /^\s*<(\w+)/;
+
+/**
+ * Extracts the `nodeName` of the first element in a string of markup.
+ *
+ * @param {string} markup String of markup.
+ * @return {?string} Node name of the supplied markup.
+ */
+function getNodeName(markup) {
+ var nodeNameMatch = markup.match(nodeNamePattern);
+ return nodeNameMatch && nodeNameMatch[1].toLowerCase();
+}
+
+/**
+ * Creates an array containing the nodes rendered from the supplied markup. The
+ * optionally supplied `handleScript` function will be invoked once for each
+ * <script> element that is rendered. If no `handleScript` function is supplied,
+ * an exception is thrown if any <script> elements are rendered.
+ *
+ * @param {string} markup A string of valid HTML markup.
+ * @param {?function} handleScript Invoked once for each rendered <script>.
+ * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
+ */
+function createNodesFromMarkup(markup, handleScript) {
+ var node = dummyNode;
+ !!!dummyNode ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
+ var nodeName = getNodeName(markup);
+
+ var wrap = nodeName && getMarkupWrap(nodeName);
+ if (wrap) {
+ node.innerHTML = wrap[1] + markup + wrap[2];
+
+ var wrapDepth = wrap[0];
+ while (wrapDepth--) {
+ node = node.lastChild;
+ }
+ } else {
+ node.innerHTML = markup;
+ }
+
+ var scripts = node.getElementsByTagName('script');
+ if (scripts.length) {
+ !handleScript ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
+ createArrayFromMixed(scripts).forEach(handleScript);
+ }
+
+ var nodes = createArrayFromMixed(node.childNodes);
+ while (node.lastChild) {
+ node.removeChild(node.lastChild);
+ }
+ return nodes;
+}
+
+module.exports = createNodesFromMarkup;
+},{"147":147,"151":151,"157":157,"161":161}],153:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule emptyFunction
+ */
+
+"use strict";
+
+function makeEmptyFunction(arg) {
+ return function () {
+ return arg;
+ };
+}
+
+/**
+ * This function accepts and discards inputs; it has no side effects. This is
+ * primarily useful idiomatically for overridable function endpoints which
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
+ */
+function emptyFunction() {}
+
+emptyFunction.thatReturns = makeEmptyFunction;
+emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
+emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
+emptyFunction.thatReturnsNull = makeEmptyFunction(null);
+emptyFunction.thatReturnsThis = function () {
+ return this;
+};
+emptyFunction.thatReturnsArgument = function (arg) {
+ return arg;
+};
+
+module.exports = emptyFunction;
+},{}],154:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule emptyObject
+ */
+
+'use strict';
+
+var emptyObject = {};
+
+if ("development" !== 'production') {
+ Object.freeze(emptyObject);
+}
+
+module.exports = emptyObject;
+},{}],155:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule focusNode
+ */
+
+'use strict';
+
+/**
+ * @param {DOMElement} node input/textarea to focus
+ */
+function focusNode(node) {
+ // IE8 can throw "Can't move focus to the control because it is invisible,
+ // not enabled, or of a type that does not accept the focus." for all kinds of
+ // reasons that are too expensive and fragile to test.
+ try {
+ node.focus();
+ } catch (e) {}
+}
+
+module.exports = focusNode;
+},{}],156:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getActiveElement
+ * @typechecks
+ */
+
+/* eslint-disable fb-www/typeof-undefined */
+
+/**
+ * Same as document.activeElement but wraps in a try-catch block. In IE it is
+ * not safe to call document.activeElement if there is nothing focused.
+ *
+ * The activeElement will be null only if the document or document body is not
+ * yet defined.
+ */
+'use strict';
+
+function getActiveElement() /*?DOMElement*/{
+ if (typeof document === 'undefined') {
+ return null;
+ }
+ try {
+ return document.activeElement || document.body;
+ } catch (e) {
+ return document.body;
+ }
+}
+
+module.exports = getActiveElement;
+},{}],157:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getMarkupWrap
+ */
+
+/*eslint-disable fb-www/unsafe-html */
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(147);
+
+var invariant = _dereq_(161);
+
+/**
+ * Dummy container used to detect which wraps are necessary.
+ */
+var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
+
+/**
+ * Some browsers cannot use `innerHTML` to render certain elements standalone,
+ * so we wrap them, render the wrapped nodes, then extract the desired node.
+ *
+ * In IE8, certain elements cannot render alone, so wrap all elements ('*').
+ */
+
+var shouldWrap = {};
+
+var selectWrap = [1, '<select multiple="true">', '</select>'];
+var tableWrap = [1, '<table>', '</table>'];
+var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
+
+var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
+
+var markupWrap = {
+ '*': [1, '?<div>', '</div>'],
+
+ 'area': [1, '<map>', '</map>'],
+ 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
+ 'legend': [1, '<fieldset>', '</fieldset>'],
+ 'param': [1, '<object>', '</object>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+
+ 'optgroup': selectWrap,
+ 'option': selectWrap,
+
+ 'caption': tableWrap,
+ 'colgroup': tableWrap,
+ 'tbody': tableWrap,
+ 'tfoot': tableWrap,
+ 'thead': tableWrap,
+
+ 'td': trWrap,
+ 'th': trWrap
+};
+
+// Initialize the SVG elements since we know they'll always need to be wrapped
+// consistently. If they are created inside a <div> they will be initialized in
+// the wrong namespace (and will not display).
+var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
+svgElements.forEach(function (nodeName) {
+ markupWrap[nodeName] = svgWrap;
+ shouldWrap[nodeName] = true;
+});
+
+/**
+ * Gets the markup wrap configuration for the supplied `nodeName`.
+ *
+ * NOTE: This lazily detects which wraps are necessary for the current browser.
+ *
+ * @param {string} nodeName Lowercase `nodeName`.
+ * @return {?array} Markup wrap configuration, if applicable.
+ */
+function getMarkupWrap(nodeName) {
+ !!!dummyNode ? "development" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
+ if (!markupWrap.hasOwnProperty(nodeName)) {
+ nodeName = '*';
+ }
+ if (!shouldWrap.hasOwnProperty(nodeName)) {
+ if (nodeName === '*') {
+ dummyNode.innerHTML = '<link />';
+ } else {
+ dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
+ }
+ shouldWrap[nodeName] = !dummyNode.firstChild;
+ }
+ return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
+}
+
+module.exports = getMarkupWrap;
+},{"147":147,"161":161}],158:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getUnboundedScrollPosition
+ * @typechecks
+ */
+
+'use strict';
+
+/**
+ * Gets the scroll position of the supplied element or window.
+ *
+ * The return values are unbounded, unlike `getScrollPosition`. This means they
+ * may be negative or exceed the element boundaries (which is possible using
+ * inertial scrolling).
+ *
+ * @param {DOMWindow|DOMElement} scrollable
+ * @return {object} Map with `x` and `y` keys.
+ */
+function getUnboundedScrollPosition(scrollable) {
+ if (scrollable === window) {
+ return {
+ x: window.pageXOffset || document.documentElement.scrollLeft,
+ y: window.pageYOffset || document.documentElement.scrollTop
+ };
+ }
+ return {
+ x: scrollable.scrollLeft,
+ y: scrollable.scrollTop
+ };
+}
+
+module.exports = getUnboundedScrollPosition;
+},{}],159:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule hyphenate
+ * @typechecks
+ */
+
+'use strict';
+
+var _uppercasePattern = /([A-Z])/g;
+
+/**
+ * Hyphenates a camelcased string, for example:
+ *
+ * > hyphenate('backgroundColor')
+ * < "background-color"
+ *
+ * For CSS style names, use `hyphenateStyleName` instead which works properly
+ * with all vendor prefixes, including `ms`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenate(string) {
+ return string.replace(_uppercasePattern, '-$1').toLowerCase();
+}
+
+module.exports = hyphenate;
+},{}],160:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule hyphenateStyleName
+ * @typechecks
+ */
+
+'use strict';
+
+var hyphenate = _dereq_(159);
+
+var msPattern = /^ms-/;
+
+/**
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenateStyleName(string) {
+ return hyphenate(string).replace(msPattern, '-ms-');
+}
+
+module.exports = hyphenateStyleName;
+},{"159":159}],161:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule invariant
+ */
+
+'use strict';
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ if ("development" !== 'production') {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+module.exports = invariant;
+},{}],162:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule isNode
+ * @typechecks
+ */
+
+/**
+ * @param {*} object The object to check.
+ * @return {boolean} Whether or not the object is a DOM node.
+ */
+'use strict';
+
+function isNode(object) {
+ return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
+}
+
+module.exports = isNode;
+},{}],163:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule isTextNode
+ * @typechecks
+ */
+
+'use strict';
+
+var isNode = _dereq_(162);
+
+/**
+ * @param {*} object The object to check.
+ * @return {boolean} Whether or not the object is a DOM text node.
+ */
+function isTextNode(object) {
+ return isNode(object) && object.nodeType == 3;
+}
+
+module.exports = isTextNode;
+},{"162":162}],164:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule joinClasses
+ * @typechecks static-only
+ */
-},{"150":150,"157":157,"29":29}],171:[function(_dereq_,module,exports){
+'use strict';
+
+/**
+ * Combines multiple className strings into one.
+ * http://jsperf.com/joinclasses-args-vs-array
+ *
+ * @param {...?string} className
+ * @return {string}
+ */
+function joinClasses(className /*, ... */) {
+ if (!className) {
+ className = '';
+ }
+ var nextClass;
+ var argLength = arguments.length;
+ if (argLength > 1) {
+ for (var ii = 1; ii < argLength; ii++) {
+ nextClass = arguments[ii];
+ if (nextClass) {
+ className = (className ? className + ' ' : '') + nextClass;
+ }
+ }
+ }
+ return className;
+}
+
+module.exports = joinClasses;
+},{}],165:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule keyMirror
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var invariant = _dereq_(161);
+
+/**
+ * Constructs an enumeration with keys equal to their value.
+ *
+ * For example:
+ *
+ * var COLORS = keyMirror({blue: null, red: null});
+ * var myColor = COLORS.blue;
+ * var isColorValid = !!COLORS[myColor];
+ *
+ * The last line could not be performed if the values of the generated enum were
+ * not equal to their keys.
+ *
+ * Input: {key1: val1, key2: val2}
+ * Output: {key1: key1, key2: key2}
+ *
+ * @param {object} obj
+ * @return {object}
+ */
+var keyMirror = function (obj) {
+ var ret = {};
+ var key;
+ !(obj instanceof Object && !Array.isArray(obj)) ? "development" !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
+ for (key in obj) {
+ if (!obj.hasOwnProperty(key)) {
+ continue;
+ }
+ ret[key] = key;
+ }
+ return ret;
+};
+
+module.exports = keyMirror;
+},{"161":161}],166:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule keyOf
+ */
+
+/**
+ * Allows extraction of a minified key. Let's the build system minify keys
+ * without losing the ability to dynamically use key strings as values
+ * themselves. Pass in an object with a single key/val pair and it will return
+ * you the string key of that single record. Suppose you want to grab the
+ * value for a key 'className' inside of an object. Key/val minification may
+ * have aliased that key to be 'xa12'. keyOf({className: null}) will return
+ * 'xa12' in that case. Resolve keys you want to use once at startup time, then
+ * reuse those resolutions.
+ */
+"use strict";
+
+var keyOf = function (oneKeyObj) {
+ var key;
+ for (key in oneKeyObj) {
+ if (!oneKeyObj.hasOwnProperty(key)) {
+ continue;
+ }
+ return key;
+ }
+ return null;
+};
+
+module.exports = keyOf;
+},{}],167:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule mapObject
+ */
+
+'use strict';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Executes the provided `callback` once for each enumerable own property in the
+ * object and constructs a new object from the results. The `callback` is
+ * invoked with three arguments:
+ *
+ * - the property value
+ * - the property name
+ * - the object being traversed
+ *
+ * Properties that are added after the call to `mapObject` will not be visited
+ * by `callback`. If the values of existing properties are changed, the value
+ * passed to `callback` will be the value at the time `mapObject` visits them.
+ * Properties that are deleted before being visited are not visited.
+ *
+ * @grep function objectMap()
+ * @grep function objMap()
+ *
+ * @param {?object} object
+ * @param {function} callback
+ * @param {*} context
+ * @return {?object}
+ */
+function mapObject(object, callback, context) {
+ if (!object) {
+ return null;
+ }
+ var result = {};
+ for (var name in object) {
+ if (hasOwnProperty.call(object, name)) {
+ result[name] = callback.call(context, object[name], name, object);
+ }
+ }
+ return result;
+}
+
+module.exports = mapObject;
+},{}],168:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule memoizeStringOnly
+ * @typechecks static-only
+ */
+
+'use strict';
+
+/**
+ * Memoizes the return value of a function that accepts one string argument.
+ *
+ * @param {function} callback
+ * @return {function}
+ */
+function memoizeStringOnly(callback) {
+ var cache = {};
+ return function (string) {
+ if (!cache.hasOwnProperty(string)) {
+ cache[string] = callback.call(this, string);
+ }
+ return cache[string];
+ };
+}
+
+module.exports = memoizeStringOnly;
+},{}],169:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule performance
+ * @typechecks
+ */
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(147);
+
+var performance;
+
+if (ExecutionEnvironment.canUseDOM) {
+ performance = window.performance || window.msPerformance || window.webkitPerformance;
+}
+
+module.exports = performance || {};
+},{"147":147}],170:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule performanceNow
+ * @typechecks
+ */
+
+'use strict';
+
+var performance = _dereq_(169);
+
+var performanceNow;
+
+/**
+ * Detect if we can use `window.performance.now()` and gracefully fallback to
+ * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
+ * because of Facebook's testing infrastructure.
+ */
+if (performance.now) {
+ performanceNow = function () {
+ return performance.now();
+ };
+} else {
+ performanceNow = function () {
+ return Date.now();
+ };
+}
+
+module.exports = performanceNow;
+},{"169":169}],171:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule shallowEqual
+ * @typechecks
+ *
+ */
+
+'use strict';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Performs equality by iterating through keys on an object and returning false
+ * when any key has values which are not strictly equal between the arguments.
+ * Returns true when the values of all keys are strictly equal.
+ */
+function shallowEqual(objA, objB) {
+ if (objA === objB) {
+ return true;
+ }
+
+ if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
+ return false;
+ }
+
+ var keysA = Object.keys(objA);
+ var keysB = Object.keys(objB);
+
+ if (keysA.length !== keysB.length) {
+ return false;
+ }
+
+ // Test for A's keys different from B.
+ var bHasOwnProperty = hasOwnProperty.bind(objB);
+ for (var i = 0; i < keysA.length; i++) {
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+module.exports = shallowEqual;
+},{}],172:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule toArray
+ * @typechecks
+ */
+
+'use strict';
+
+var invariant = _dereq_(161);
+
+/**
+ * Convert array-like objects to arrays.
+ *
+ * This API assumes the caller knows the contents of the data type. For less
+ * well defined inputs use createArrayFromMixed.
+ *
+ * @param {object|function|filelist} obj
+ * @return {array}
+ */
+function toArray(obj) {
+ var length = obj.length;
+
+ // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
+ // old versions of Safari).
+ !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "development" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
+
+ !(typeof length === 'number') ? "development" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
+
+ !(length === 0 || length - 1 in obj) ? "development" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
+
+ // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
+ // without method will throw during the slice call and skip straight to the
+ // fallback.
+ if (obj.hasOwnProperty) {
+ try {
+ return Array.prototype.slice.call(obj);
+ } catch (e) {
+ // IE < 9 does not support Array#slice on collections objects
+ }
+ }
+
+ // Fall back to copying key by key. This assumes all keys have a value,
+ // so will not preserve sparsely populated inputs.
+ var ret = Array(length);
+ for (var ii = 0; ii < length; ii++) {
+ ret[ii] = obj[ii];
+ }
+ return ret;
+}
+
+module.exports = toArray;
+},{"161":161}],173:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -21589,9 +20725,9 @@
* @providesModule warning
*/
-"use strict";
+'use strict';
-var emptyFunction = _dereq_(129);
+var emptyFunction = _dereq_(153);
/**
* Similar to invariant but only logs a warning if the condition is not met.
@@ -21602,20 +20738,14 @@
var warning = emptyFunction;
-if ("production" !== "development") {
- warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
- if (format === undefined) {
- throw new Error(
- '`warning(condition, format, ...args)` requires a warning ' +
- 'message argument'
- );
+if ("development" !== 'production') {
+ warning = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
}
- if (format.length < 10 || /^[s\W]*$/.test(format)) {
- throw new Error(
- 'The warning format should be able to uniquely identify this ' +
- 'warning. Please, use a more descriptive format than: ' + format
- );
+ if (format === undefined) {
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
@@ -21624,19 +20754,22 @@
if (!condition) {
var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
- console.warn(message);
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.error(message);
+ }
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
- } catch(x) {}
+ } catch (x) {}
}
};
}
module.exports = warning;
-
-},{"129":129}]},{},[1])(1)
+},{"153":153}]},{},[1])(1)
});
\ No newline at end of file