reactjs-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c80158e264672a4be39cfed7ae0c6b067f04be3
4
- data.tar.gz: e4438f67373f225d45e73bc30034a21be75320f6
3
+ metadata.gz: 4a5d7a6f3940f90478b3bd1df9759523bbcd0ea9
4
+ data.tar.gz: 28fcf2af3590903ec731a8e24bc24e785b359b1b
5
5
  SHA512:
6
- metadata.gz: 2d45e42bb9b7acc887a0bcb2dcff01a4272201c91b4f2daf5a77c03f3f1c8ad76ee4b0ad4b98fa183bb51a2571a6e2f2f77a51f8cf00a71eb5537913970ef919
7
- data.tar.gz: e7d94d1201cba25ca17f25ea85db7520cc3cac825dcbd57a379fcbfabafabd7961960c3aea130c544a34e1c50e22f3497086a9bc567a2ac9fcbe00e0e1a3be99
6
+ metadata.gz: 60de7daf3fa323ec895dc0d02a5930755f1a5df7d0a737b3a7c0feaefbb24eda2fd4cb31500c59daf2d8e736a12f05b9fa520771d4aacd4d25f83ecdf0d2cc7c
7
+ data.tar.gz: a1c0663566c39ac78cb1fff43ca338bd291b2c39107dba9ff355502aff1cb4c3e3dd1c7938a1ca63519e32a5693f3b33ea3e1dc19921bfb0fbe178237c1de3c9
data/README.md CHANGED
@@ -14,7 +14,7 @@ And then execute:
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install reactjs-rails
17
+ $ gem install reactjs-rails
18
18
 
19
19
 
20
20
  # Usage
@@ -22,11 +22,6 @@ Or install it yourself as:
22
22
  Add the following to your `app/assets/javascripts/application.js`:
23
23
 
24
24
  //= require react
25
-
26
- or
27
-
28
- //= require react.min
29
-
30
25
  //= require jsxtransformer
31
26
 
32
27
  ## Contributing
@@ -1,7 +1,7 @@
1
- require "reactjs-rails/version"
1
+ require 'reactjs-rails/version'
2
2
 
3
3
  module Reactjs
4
4
  module Rails
5
- require "reactjs-rails/engine"
5
+ require 'reactjs-rails/engine'
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Reactjs
2
2
  module Rails
3
- VERSION = "0.4.0"
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSXTransformer v0.4.0
2
+ * JSXTransformer v0.4.1
3
3
  */
4
4
  (function(e){if("function"==typeof bootstrap)bootstrap("jsxtransformer",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJSXTransformer=e}else"undefined"!=typeof window?window.JSXTransformer=e():global.JSXTransformer=e()})(function(){var define,ses,bootstrap,module,exports;
5
5
  return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
@@ -6886,7 +6886,7 @@ define(function (require, exports, module) {
6886
6886
  var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
6887
6887
  var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
6888
6888
  var mappings = util.getArg(sourceMap, 'mappings');
6889
- var file = util.getArg(sourceMap, 'file');
6889
+ var file = util.getArg(sourceMap, 'file', null);
6890
6890
 
6891
6891
  if (version !== this._version) {
6892
6892
  throw new Error('Unsupported version: ' + version);
@@ -8450,13 +8450,13 @@ module.exports = amdefine;
8450
8450
 
8451
8451
  'use strict';
8452
8452
  var runScripts;
8453
+ var headEl;
8453
8454
 
8454
8455
  var transform = require('./fbtransform/lib/transform').transform;
8455
8456
  var visitors = require('./fbtransform/visitors').transformVisitors;
8456
8457
  var transform = transform.bind(null, visitors.react);
8457
8458
  var docblock = require('./fbtransform/lib/docblock');
8458
8459
 
8459
- var headEl = document.getElementsByTagName('head')[0];
8460
8460
 
8461
8461
  exports.transform = transform;
8462
8462
 
@@ -8464,6 +8464,11 @@ exports.exec = function(code) {
8464
8464
  return eval(transform(code));
8465
8465
  };
8466
8466
 
8467
+ if (typeof window === "undefined" || window === null) {
8468
+ return;
8469
+ }
8470
+ headEl = document.getElementsByTagName('head')[0];
8471
+
8467
8472
  var run = exports.run = function(code) {
8468
8473
  var jsx = docblock.parseAsObject(docblock.extract(code)).jsx;
8469
8474
 
@@ -8474,10 +8479,6 @@ var run = exports.run = function(code) {
8474
8479
  headEl.appendChild(scriptEl);
8475
8480
  };
8476
8481
 
8477
- if (typeof window === "undefined" || window === null) {
8478
- return;
8479
- }
8480
-
8481
8482
  var load = exports.load = function(url, callback) {
8482
8483
  var xhr;
8483
8484
  xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React v0.4.0
2
+ * React v0.4.1
3
3
  */
4
4
  (function(e){if("function"==typeof bootstrap)bootstrap("react",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeReact=e}else"undefined"!=typeof window?window.React=e():global.React=e()})(function(){var define,ses,bootstrap,module,exports;
5
5
  return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
@@ -50,7 +50,7 @@ function $(id) {
50
50
 
51
51
  module.exports = $;
52
52
 
53
- },{"./ex":66,"./ge":69}],2:[function(require,module,exports){
53
+ },{"./ex":68,"./ge":71}],2:[function(require,module,exports){
54
54
  /**
55
55
  * Copyright 2013 Facebook, Inc.
56
56
  *
@@ -240,7 +240,7 @@ var CSSPropertyOperations = {
240
240
 
241
241
  module.exports = CSSPropertyOperations;
242
242
 
243
- },{"./CSSProperty":2,"./dangerousStyleValue":63,"./escapeTextForBrowser":65,"./hyphenate":73,"./memoizeStringOnly":80}],4:[function(require,module,exports){
243
+ },{"./CSSProperty":2,"./dangerousStyleValue":65,"./escapeTextForBrowser":67,"./hyphenate":76,"./memoizeStringOnly":83}],4:[function(require,module,exports){
244
244
  /**
245
245
  * Copyright 2013 Facebook, Inc.
246
246
  *
@@ -730,7 +730,7 @@ var ChangeEventPlugin = {
730
730
  module.exports = ChangeEventPlugin;
731
731
 
732
732
  })()
733
- },{"./EventConstants":13,"./EventPluginHub":15,"./EventPropagators":18,"./ExecutionEnvironment":19,"./SyntheticEvent":50,"./isEventSupported":76,"./keyOf":79}],6:[function(require,module,exports){
733
+ },{"./EventConstants":13,"./EventPluginHub":15,"./EventPropagators":18,"./ExecutionEnvironment":19,"./SyntheticEvent":51,"./isEventSupported":79,"./keyOf":82}],6:[function(require,module,exports){
734
734
  (function(){/**
735
735
  * Copyright 2013 Facebook, Inc.
736
736
  *
@@ -877,7 +877,7 @@ var DOMChildrenOperations = {
877
877
  module.exports = DOMChildrenOperations;
878
878
 
879
879
  })()
880
- },{"./Danger":9,"./insertNodeAt":74,"./keyOf":79,"./throwIf":86}],7:[function(require,module,exports){
880
+ },{"./Danger":9,"./insertNodeAt":77,"./keyOf":82,"./throwIf":89}],7:[function(require,module,exports){
881
881
  /**
882
882
  * Copyright 2013 Facebook, Inc.
883
883
  *
@@ -1112,7 +1112,7 @@ var DOMProperty = {
1112
1112
 
1113
1113
  module.exports = DOMProperty;
1114
1114
 
1115
- },{"./invariant":75}],8:[function(require,module,exports){
1115
+ },{"./invariant":78}],8:[function(require,module,exports){
1116
1116
  /**
1117
1117
  * Copyright 2013 Facebook, Inc.
1118
1118
  *
@@ -1232,7 +1232,7 @@ var DOMPropertyOperations = {
1232
1232
 
1233
1233
  module.exports = DOMPropertyOperations;
1234
1234
 
1235
- },{"./DOMProperty":7,"./escapeTextForBrowser":65,"./memoizeStringOnly":80}],9:[function(require,module,exports){
1235
+ },{"./DOMProperty":7,"./escapeTextForBrowser":67,"./memoizeStringOnly":83}],9:[function(require,module,exports){
1236
1236
  /**
1237
1237
  * Copyright 2013 Facebook, Inc.
1238
1238
  *
@@ -1464,7 +1464,7 @@ var Danger = {
1464
1464
 
1465
1465
  module.exports = Danger;
1466
1466
 
1467
- },{"./ExecutionEnvironment":19,"./throwIf":86}],10:[function(require,module,exports){
1467
+ },{"./ExecutionEnvironment":19,"./throwIf":89}],10:[function(require,module,exports){
1468
1468
  /**
1469
1469
  * Copyright 2013 Facebook, Inc.
1470
1470
  *
@@ -1505,6 +1505,7 @@ var DefaultDOMPropertyConfig = {
1505
1505
  action: null,
1506
1506
  ajaxify: MUST_USE_ATTRIBUTE,
1507
1507
  allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
1508
+ allowTransparency: MUST_USE_ATTRIBUTE,
1508
1509
  alt: null,
1509
1510
  autoComplete: null,
1510
1511
  autoFocus: HAS_BOOLEAN_VALUE,
@@ -1523,6 +1524,7 @@ var DefaultDOMPropertyConfig = {
1523
1524
  disabled: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
1524
1525
  draggable: null,
1525
1526
  encType: null,
1527
+ frameBorder: MUST_USE_ATTRIBUTE,
1526
1528
  height: MUST_USE_ATTRIBUTE,
1527
1529
  hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
1528
1530
  href: null,
@@ -1661,12 +1663,13 @@ var DefaultEventPluginOrder = [
1661
1663
  keyOf({TapEventPlugin: null}),
1662
1664
  keyOf({EnterLeaveEventPlugin: null}),
1663
1665
  keyOf({ChangeEventPlugin: null}),
1664
- keyOf({AnalyticsEventPlugin: null})
1666
+ keyOf({AnalyticsEventPlugin: null}),
1667
+ keyOf({MobileSafariClickEventPlugin: null})
1665
1668
  ];
1666
1669
 
1667
1670
  module.exports = DefaultEventPluginOrder;
1668
1671
 
1669
- },{"./keyOf":79}],12:[function(require,module,exports){
1672
+ },{"./keyOf":82}],12:[function(require,module,exports){
1670
1673
  (function(){/**
1671
1674
  * Copyright 2013 Facebook, Inc.
1672
1675
  *
@@ -1691,14 +1694,13 @@ module.exports = DefaultEventPluginOrder;
1691
1694
  var EventConstants = require("./EventConstants");
1692
1695
  var EventPropagators = require("./EventPropagators");
1693
1696
  var ExecutionEnvironment = require("./ExecutionEnvironment");
1694
- var ReactInstanceHandles = require("./ReactInstanceHandles");
1695
1697
  var SyntheticMouseEvent = require("./SyntheticMouseEvent");
1696
1698
 
1697
- var ReactID = require("./ReactID");
1699
+ var ReactMount = require("./ReactMount");
1698
1700
  var keyOf = require("./keyOf");
1699
1701
 
1700
1702
  var topLevelTypes = EventConstants.topLevelTypes;
1701
- var getFirstReactDOM = ReactInstanceHandles.getFirstReactDOM;
1703
+ var getFirstReactDOM = ReactMount.getFirstReactDOM;
1702
1704
 
1703
1705
  var eventTypes = {
1704
1706
  mouseEnter: {registrationName: keyOf({onMouseEnter: null})},
@@ -1754,8 +1756,8 @@ var EnterLeaveEventPlugin = {
1754
1756
  return null;
1755
1757
  }
1756
1758
 
1757
- var fromID = from ? ReactID.getID(from) : '';
1758
- var toID = to ? ReactID.getID(to) : '';
1759
+ var fromID = from ? ReactMount.getID(from) : '';
1760
+ var toID = to ? ReactMount.getID(to) : '';
1759
1761
 
1760
1762
  var leave = SyntheticMouseEvent.getPooled(
1761
1763
  eventTypes.mouseLeave,
@@ -1777,7 +1779,7 @@ var EnterLeaveEventPlugin = {
1777
1779
  module.exports = EnterLeaveEventPlugin;
1778
1780
 
1779
1781
  })()
1780
- },{"./EventConstants":13,"./EventPropagators":18,"./ExecutionEnvironment":19,"./ReactID":35,"./ReactInstanceHandles":37,"./SyntheticMouseEvent":53,"./keyOf":79}],13:[function(require,module,exports){
1782
+ },{"./EventConstants":13,"./EventPropagators":18,"./ExecutionEnvironment":19,"./ReactMount":39,"./SyntheticMouseEvent":54,"./keyOf":82}],13:[function(require,module,exports){
1781
1783
  /**
1782
1784
  * Copyright 2013 Facebook, Inc.
1783
1785
  *
@@ -1846,7 +1848,7 @@ var EventConstants = {
1846
1848
 
1847
1849
  module.exports = EventConstants;
1848
1850
 
1849
- },{"./keyMirror":78}],14:[function(require,module,exports){
1851
+ },{"./keyMirror":81}],14:[function(require,module,exports){
1850
1852
  /**
1851
1853
  * Copyright 2013 Facebook, Inc.
1852
1854
  *
@@ -2101,7 +2103,7 @@ if (ExecutionEnvironment.canUseDOM) {
2101
2103
 
2102
2104
  module.exports = EventPluginHub;
2103
2105
 
2104
- },{"./CallbackRegistry":4,"./EventPluginRegistry":16,"./EventPluginUtils":17,"./EventPropagators":18,"./ExecutionEnvironment":19,"./accumulate":60,"./forEachAccumulated":68,"./invariant":75}],16:[function(require,module,exports){
2106
+ },{"./CallbackRegistry":4,"./EventPluginRegistry":16,"./EventPluginUtils":17,"./EventPropagators":18,"./ExecutionEnvironment":19,"./accumulate":61,"./forEachAccumulated":70,"./invariant":78}],16:[function(require,module,exports){
2105
2107
  /**
2106
2108
  * Copyright 2013 Facebook, Inc.
2107
2109
  *
@@ -2347,7 +2349,7 @@ var EventPluginRegistry = {
2347
2349
 
2348
2350
  module.exports = EventPluginRegistry;
2349
2351
 
2350
- },{"./invariant":75}],17:[function(require,module,exports){
2352
+ },{"./invariant":78}],17:[function(require,module,exports){
2351
2353
  /**
2352
2354
  * Copyright 2013 Facebook, Inc.
2353
2355
  *
@@ -2534,7 +2536,7 @@ var EventPluginUtils = {
2534
2536
 
2535
2537
  module.exports = EventPluginUtils;
2536
2538
 
2537
- },{"./EventConstants":13,"./invariant":75}],18:[function(require,module,exports){
2539
+ },{"./EventConstants":13,"./invariant":78}],18:[function(require,module,exports){
2538
2540
  /**
2539
2541
  * Copyright 2013 Facebook, Inc.
2540
2542
  *
@@ -2715,7 +2717,7 @@ var EventPropagators = {
2715
2717
 
2716
2718
  module.exports = EventPropagators;
2717
2719
 
2718
- },{"./CallbackRegistry":4,"./EventConstants":13,"./accumulate":60,"./forEachAccumulated":68}],19:[function(require,module,exports){
2720
+ },{"./CallbackRegistry":4,"./EventConstants":13,"./accumulate":61,"./forEachAccumulated":70}],19:[function(require,module,exports){
2719
2721
  (function(){/**
2720
2722
  * Copyright 2013 Facebook, Inc.
2721
2723
  *
@@ -2762,6 +2764,71 @@ module.exports = ExecutionEnvironment;
2762
2764
 
2763
2765
  })()
2764
2766
  },{}],20:[function(require,module,exports){
2767
+ /**
2768
+ * Copyright 2013 Facebook, Inc.
2769
+ *
2770
+ * Licensed under the Apache License, Version 2.0 (the "License");
2771
+ * you may not use this file except in compliance with the License.
2772
+ * You may obtain a copy of the License at
2773
+ *
2774
+ * http://www.apache.org/licenses/LICENSE-2.0
2775
+ *
2776
+ * Unless required by applicable law or agreed to in writing, software
2777
+ * distributed under the License is distributed on an "AS IS" BASIS,
2778
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2779
+ * See the License for the specific language governing permissions and
2780
+ * limitations under the License.
2781
+ *
2782
+ * @providesModule MobileSafariClickEventPlugin
2783
+ * @typechecks static-only
2784
+ */
2785
+
2786
+ "use strict";
2787
+
2788
+ var EventConstants = require("./EventConstants");
2789
+
2790
+ var emptyFunction = require("./emptyFunction");
2791
+
2792
+ var topLevelTypes = EventConstants.topLevelTypes;
2793
+
2794
+ /**
2795
+ * Mobile Safari does not fire properly bubble click events on non-interactive
2796
+ * elements, which means delegated click listeners do not fire. The workaround
2797
+ * for this bug involves attaching an empty click listener on the target node.
2798
+ *
2799
+ * This particular plugin works around the bug by attaching an empty click
2800
+ * listener on `touchstart` (which does fire on every element).
2801
+ */
2802
+ var MobileSafariClickEventPlugin = {
2803
+
2804
+ eventTypes: null,
2805
+
2806
+ /**
2807
+ * @param {string} topLevelType Record from `EventConstants`.
2808
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
2809
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
2810
+ * @param {object} nativeEvent Native browser event.
2811
+ * @return {*} An accumulation of synthetic events.
2812
+ * @see {EventPluginHub.extractEvents}
2813
+ */
2814
+ extractEvents: function(
2815
+ topLevelType,
2816
+ topLevelTarget,
2817
+ topLevelTargetID,
2818
+ nativeEvent) {
2819
+ if (topLevelType === topLevelTypes.topTouchStart) {
2820
+ var target = nativeEvent.target;
2821
+ if (target && !target.onclick) {
2822
+ target.onclick = emptyFunction;
2823
+ }
2824
+ }
2825
+ }
2826
+
2827
+ };
2828
+
2829
+ module.exports = MobileSafariClickEventPlugin;
2830
+
2831
+ },{"./EventConstants":13,"./emptyFunction":66}],21:[function(require,module,exports){
2765
2832
  /**
2766
2833
  * Copyright 2013 Facebook, Inc.
2767
2834
  *
@@ -2876,7 +2943,7 @@ var PooledClass = {
2876
2943
 
2877
2944
  module.exports = PooledClass;
2878
2945
 
2879
- },{}],21:[function(require,module,exports){
2946
+ },{}],22:[function(require,module,exports){
2880
2947
  /**
2881
2948
  * Copyright 2013 Facebook, Inc.
2882
2949
  *
@@ -2926,7 +2993,7 @@ var React = {
2926
2993
 
2927
2994
  module.exports = React;
2928
2995
 
2929
- },{"./ReactComponent":22,"./ReactCompositeComponent":23,"./ReactDOM":25,"./ReactDefaultInjection":32,"./ReactMount":38,"./ReactPropTypes":44,"./ReactServerRendering":46}],22:[function(require,module,exports){
2996
+ },{"./ReactComponent":23,"./ReactCompositeComponent":24,"./ReactDOM":26,"./ReactDefaultInjection":33,"./ReactMount":39,"./ReactPropTypes":45,"./ReactServerRendering":47}],23:[function(require,module,exports){
2930
2997
  /**
2931
2998
  * Copyright 2013 Facebook, Inc.
2932
2999
  *
@@ -2949,9 +3016,10 @@ module.exports = React;
2949
3016
 
2950
3017
  "use strict";
2951
3018
 
3019
+ var getReactRootElementInContainer = require("./getReactRootElementInContainer");
2952
3020
  var ReactCurrentOwner = require("./ReactCurrentOwner");
2953
3021
  var ReactDOMIDOperations = require("./ReactDOMIDOperations");
2954
- var ReactID = require("./ReactID");
3022
+ var ReactMarkupChecksum = require("./ReactMarkupChecksum");
2955
3023
  var ReactMount = require("./ReactMount");
2956
3024
  var ReactOwner = require("./ReactOwner");
2957
3025
  var ReactReconcileTransaction = require("./ReactReconcileTransaction");
@@ -3184,7 +3252,7 @@ var ReactComponent = {
3184
3252
  this.isMounted(),
3185
3253
  'getDOMNode(): A component must be mounted to have a DOM node.'
3186
3254
  );
3187
- return ReactID.getNode(this._rootNodeID);
3255
+ return ReactMount.getNode(this._rootNodeID);
3188
3256
  },
3189
3257
 
3190
3258
  /**
@@ -3310,7 +3378,7 @@ var ReactComponent = {
3310
3378
  if (props.ref != null) {
3311
3379
  ReactOwner.removeComponentAsRefFrom(this, props.ref, props[OWNER]);
3312
3380
  }
3313
- ReactID.purgeID(this._rootNodeID);
3381
+ ReactMount.purgeID(this._rootNodeID);
3314
3382
  this._rootNodeID = null;
3315
3383
  this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
3316
3384
  },
@@ -3427,15 +3495,28 @@ var ReactComponent = {
3427
3495
  container && container.nodeType === 1,
3428
3496
  'mountComponentIntoNode(...): Target container is not a DOM element.'
3429
3497
  );
3430
- var renderStart = Date.now();
3431
3498
  var markup = this.mountComponent(rootID, transaction);
3432
- ReactMount.totalInstantiationTime += (Date.now() - renderStart);
3433
3499
 
3434
3500
  if (shouldReuseMarkup) {
3435
- return;
3501
+ if (ReactMarkupChecksum.canReuseMarkup(
3502
+ markup,
3503
+ getReactRootElementInContainer(container))) {
3504
+ return;
3505
+ } else {
3506
+ if (true) {
3507
+ console.warn(
3508
+ 'React attempted to use reuse markup in a container but the ' +
3509
+ 'checksum was invalid. This generally means that you are using ' +
3510
+ 'server rendering and the markup generated on the server was ' +
3511
+ 'not what the client was expecting. React injected new markup ' +
3512
+ 'to compensate which works but you have lost many of the ' +
3513
+ 'benefits of server rendering. Instead, figure out why the ' +
3514
+ 'markup being generated is different on the client or server.'
3515
+ );
3516
+ }
3517
+ }
3436
3518
  }
3437
3519
 
3438
- var injectionStart = Date.now();
3439
3520
  // Asynchronously inject markup by ensuring that the container is not in
3440
3521
  // the document when settings its `innerHTML`.
3441
3522
  var parent = container.parentNode;
@@ -3451,7 +3532,6 @@ var ReactComponent = {
3451
3532
  } else {
3452
3533
  container.innerHTML = markup;
3453
3534
  }
3454
- ReactMount.totalInjectionTime += (Date.now() - injectionStart);
3455
3535
  },
3456
3536
 
3457
3537
  /**
@@ -3504,7 +3584,7 @@ var ReactComponent = {
3504
3584
 
3505
3585
  module.exports = ReactComponent;
3506
3586
 
3507
- },{"./ReactCurrentOwner":24,"./ReactDOMIDOperations":27,"./ReactID":35,"./ReactMount":38,"./ReactOwner":42,"./ReactReconcileTransaction":45,"./ReactUpdates":48,"./invariant":75,"./keyMirror":78,"./merge":81}],23:[function(require,module,exports){
3587
+ },{"./ReactCurrentOwner":25,"./ReactDOMIDOperations":28,"./ReactMarkupChecksum":38,"./ReactMount":39,"./ReactOwner":43,"./ReactReconcileTransaction":46,"./ReactUpdates":49,"./getReactRootElementInContainer":73,"./invariant":78,"./keyMirror":81,"./merge":84}],24:[function(require,module,exports){
3508
3588
  (function(){/**
3509
3589
  * Copyright 2013 Facebook, Inc.
3510
3590
  *
@@ -4422,7 +4502,7 @@ var ReactCompositeComponent = {
4422
4502
  module.exports = ReactCompositeComponent;
4423
4503
 
4424
4504
  })()
4425
- },{"./ReactComponent":22,"./ReactCurrentOwner":24,"./ReactOwner":42,"./ReactPropTransferer":43,"./ReactUpdates":48,"./invariant":75,"./keyMirror":78,"./merge":81,"./mixInto":84}],24:[function(require,module,exports){
4505
+ },{"./ReactComponent":23,"./ReactCurrentOwner":25,"./ReactOwner":43,"./ReactPropTransferer":44,"./ReactUpdates":49,"./invariant":78,"./keyMirror":81,"./merge":84,"./mixInto":87}],25:[function(require,module,exports){
4426
4506
  /**
4427
4507
  * Copyright 2013 Facebook, Inc.
4428
4508
  *
@@ -4463,7 +4543,7 @@ var ReactCurrentOwner = {
4463
4543
 
4464
4544
  module.exports = ReactCurrentOwner;
4465
4545
 
4466
- },{}],25:[function(require,module,exports){
4546
+ },{}],26:[function(require,module,exports){
4467
4547
  /**
4468
4548
  * Copyright 2013 Facebook, Inc.
4469
4549
  *
@@ -4658,7 +4738,7 @@ ReactDOM.injection = injection;
4658
4738
 
4659
4739
  module.exports = ReactDOM;
4660
4740
 
4661
- },{"./ReactNativeComponent":40,"./mergeInto":83,"./objMapKeyVal":85}],26:[function(require,module,exports){
4741
+ },{"./ReactNativeComponent":41,"./mergeInto":86,"./objMapKeyVal":88}],27:[function(require,module,exports){
4662
4742
  /**
4663
4743
  * Copyright 2013 Facebook, Inc.
4664
4744
  *
@@ -4712,7 +4792,7 @@ var ReactDOMForm = ReactCompositeComponent.createClass({
4712
4792
 
4713
4793
  module.exports = ReactDOMForm;
4714
4794
 
4715
- },{"./EventConstants":13,"./ReactCompositeComponent":23,"./ReactDOM":25,"./ReactEventEmitter":33}],27:[function(require,module,exports){
4795
+ },{"./EventConstants":13,"./ReactCompositeComponent":24,"./ReactDOM":26,"./ReactEventEmitter":34}],28:[function(require,module,exports){
4716
4796
  (function(){/**
4717
4797
  * Copyright 2013 Facebook, Inc.
4718
4798
  *
@@ -4739,7 +4819,7 @@ module.exports = ReactDOMForm;
4739
4819
  var CSSPropertyOperations = require("./CSSPropertyOperations");
4740
4820
  var DOMChildrenOperations = require("./DOMChildrenOperations");
4741
4821
  var DOMPropertyOperations = require("./DOMPropertyOperations");
4742
- var ReactID = require("./ReactID");
4822
+ var ReactMount = require("./ReactMount");
4743
4823
 
4744
4824
  var getTextContentAccessor = require("./getTextContentAccessor");
4745
4825
  var invariant = require("./invariant");
@@ -4780,13 +4860,21 @@ var ReactDOMIDOperations = {
4780
4860
  * @internal
4781
4861
  */
4782
4862
  updatePropertyByID: function(id, name, value) {
4783
- var node = ReactID.getNode(id);
4863
+ var node = ReactMount.getNode(id);
4784
4864
  invariant(
4785
4865
  !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
4786
4866
  'updatePropertyByID(...): %s',
4787
4867
  INVALID_PROPERTY_ERRORS[name]
4788
4868
  );
4789
- DOMPropertyOperations.setValueForProperty(node, name, value);
4869
+
4870
+ // If we're updating to null or undefined, we should remove the property
4871
+ // from the DOM node instead of inadvertantly setting to a string. This
4872
+ // brings us in line with the same behavior we have on initial render.
4873
+ if (value != null) {
4874
+ DOMPropertyOperations.setValueForProperty(node, name, value);
4875
+ } else {
4876
+ DOMPropertyOperations.deleteValueForProperty(node, name);
4877
+ }
4790
4878
  },
4791
4879
 
4792
4880
  /**
@@ -4798,7 +4886,7 @@ var ReactDOMIDOperations = {
4798
4886
  * @internal
4799
4887
  */
4800
4888
  deletePropertyByID: function(id, name, value) {
4801
- var node = ReactID.getNode(id);
4889
+ var node = ReactMount.getNode(id);
4802
4890
  invariant(
4803
4891
  !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
4804
4892
  'updatePropertyByID(...): %s',
@@ -4835,7 +4923,7 @@ var ReactDOMIDOperations = {
4835
4923
  * @internal
4836
4924
  */
4837
4925
  updateStylesByID: function(id, styles) {
4838
- var node = ReactID.getNode(id);
4926
+ var node = ReactMount.getNode(id);
4839
4927
  CSSPropertyOperations.setValueForStyles(node, styles);
4840
4928
  },
4841
4929
 
@@ -4847,7 +4935,7 @@ var ReactDOMIDOperations = {
4847
4935
  * @internal
4848
4936
  */
4849
4937
  updateInnerHTMLByID: function(id, html) {
4850
- var node = ReactID.getNode(id);
4938
+ var node = ReactMount.getNode(id);
4851
4939
  // HACK: IE8- normalize whitespace in innerHTML, removing leading spaces.
4852
4940
  // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
4853
4941
  node.innerHTML = (html && html.__html || '').replace(/^ /g, '&nbsp;');
@@ -4861,7 +4949,7 @@ var ReactDOMIDOperations = {
4861
4949
  * @internal
4862
4950
  */
4863
4951
  updateTextContentByID: function(id, content) {
4864
- var node = ReactID.getNode(id);
4952
+ var node = ReactMount.getNode(id);
4865
4953
  node[textContentAccessor] = content;
4866
4954
  },
4867
4955
 
@@ -4874,7 +4962,7 @@ var ReactDOMIDOperations = {
4874
4962
  * @see {Danger.dangerouslyReplaceNodeWithMarkup}
4875
4963
  */
4876
4964
  dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
4877
- var node = ReactID.getNode(id);
4965
+ var node = ReactMount.getNode(id);
4878
4966
  DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
4879
4967
  },
4880
4968
 
@@ -4883,7 +4971,7 @@ var ReactDOMIDOperations = {
4883
4971
  * Detect if any elements were removed instead of blindly purging.
4884
4972
  */
4885
4973
  manageChildrenByParentID: function(parentID, domOperations) {
4886
- var parent = ReactID.getNode(parentID);
4974
+ var parent = ReactMount.getNode(parentID);
4887
4975
  DOMChildrenOperations.manageChildren(parent, domOperations);
4888
4976
  }
4889
4977
 
@@ -4892,7 +4980,7 @@ var ReactDOMIDOperations = {
4892
4980
  module.exports = ReactDOMIDOperations;
4893
4981
 
4894
4982
  })()
4895
- },{"./CSSPropertyOperations":3,"./DOMChildrenOperations":6,"./DOMPropertyOperations":8,"./ReactID":35,"./getTextContentAccessor":71,"./invariant":75}],28:[function(require,module,exports){
4983
+ },{"./CSSPropertyOperations":3,"./DOMChildrenOperations":6,"./DOMPropertyOperations":8,"./ReactMount":39,"./getTextContentAccessor":74,"./invariant":78}],29:[function(require,module,exports){
4896
4984
  /**
4897
4985
  * Copyright 2013 Facebook, Inc.
4898
4986
  *
@@ -5009,7 +5097,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
5009
5097
 
5010
5098
  module.exports = ReactDOMInput;
5011
5099
 
5012
- },{"./DOMPropertyOperations":8,"./ReactCompositeComponent":23,"./ReactDOM":25,"./merge":81}],29:[function(require,module,exports){
5100
+ },{"./DOMPropertyOperations":8,"./ReactCompositeComponent":24,"./ReactDOM":26,"./merge":84}],30:[function(require,module,exports){
5013
5101
  /**
5014
5102
  * Copyright 2013 Facebook, Inc.
5015
5103
  *
@@ -5061,7 +5149,7 @@ var ReactDOMOption = ReactCompositeComponent.createClass({
5061
5149
 
5062
5150
  module.exports = ReactDOMOption;
5063
5151
 
5064
- },{"./ReactCompositeComponent":23,"./ReactDOM":25}],30:[function(require,module,exports){
5152
+ },{"./ReactCompositeComponent":24,"./ReactDOM":26}],31:[function(require,module,exports){
5065
5153
  /**
5066
5154
  * Copyright 2013 Facebook, Inc.
5067
5155
  *
@@ -5221,7 +5309,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
5221
5309
 
5222
5310
  module.exports = ReactDOMSelect;
5223
5311
 
5224
- },{"./ReactCompositeComponent":23,"./ReactDOM":25,"./invariant":75,"./merge":81}],31:[function(require,module,exports){
5312
+ },{"./ReactCompositeComponent":24,"./ReactDOM":26,"./invariant":78,"./merge":84}],32:[function(require,module,exports){
5225
5313
  /**
5226
5314
  * Copyright 2013 Facebook, Inc.
5227
5315
  *
@@ -5361,7 +5449,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
5361
5449
 
5362
5450
  module.exports = ReactDOMTextarea;
5363
5451
 
5364
- },{"./DOMPropertyOperations":8,"./ReactCompositeComponent":23,"./ReactDOM":25,"./invariant":75,"./merge":81}],32:[function(require,module,exports){
5452
+ },{"./DOMPropertyOperations":8,"./ReactCompositeComponent":24,"./ReactDOM":26,"./invariant":78,"./merge":84}],33:[function(require,module,exports){
5365
5453
  /**
5366
5454
  * Copyright 2013 Facebook, Inc.
5367
5455
  *
@@ -5388,6 +5476,8 @@ var ReactDOMInput = require("./ReactDOMInput");
5388
5476
  var ReactDOMOption = require("./ReactDOMOption");
5389
5477
  var ReactDOMSelect = require("./ReactDOMSelect");
5390
5478
  var ReactDOMTextarea = require("./ReactDOMTextarea");
5479
+ var ReactEventEmitter = require("./ReactEventEmitter");
5480
+ var ReactEventTopLevelCallback = require("./ReactEventTopLevelCallback");
5391
5481
 
5392
5482
  var DefaultDOMPropertyConfig = require("./DefaultDOMPropertyConfig");
5393
5483
  var DOMProperty = require("./DOMProperty");
@@ -5398,8 +5488,10 @@ var ChangeEventPlugin = require("./ChangeEventPlugin");
5398
5488
  var EventPluginHub = require("./EventPluginHub");
5399
5489
  var ReactInstanceHandles = require("./ReactInstanceHandles");
5400
5490
  var SimpleEventPlugin = require("./SimpleEventPlugin");
5491
+ var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
5401
5492
 
5402
5493
  function inject() {
5494
+ ReactEventEmitter.TopLevelCallbackCreator = ReactEventTopLevelCallback;
5403
5495
  /**
5404
5496
  * Inject module for resolving DOM hierarchy and plugin ordering.
5405
5497
  */
@@ -5413,7 +5505,8 @@ function inject() {
5413
5505
  EventPluginHub.injection.injectEventPluginsByName({
5414
5506
  'SimpleEventPlugin': SimpleEventPlugin,
5415
5507
  'EnterLeaveEventPlugin': EnterLeaveEventPlugin,
5416
- 'ChangeEventPlugin': ChangeEventPlugin
5508
+ 'ChangeEventPlugin': ChangeEventPlugin,
5509
+ 'MobileSafariClickEventPlugin': MobileSafariClickEventPlugin
5417
5510
  });
5418
5511
 
5419
5512
  ReactDOM.injection.injectComponentClasses({
@@ -5431,7 +5524,7 @@ module.exports = {
5431
5524
  inject: inject
5432
5525
  };
5433
5526
 
5434
- },{"./ChangeEventPlugin":5,"./DOMProperty":7,"./DefaultDOMPropertyConfig":10,"./DefaultEventPluginOrder":11,"./EnterLeaveEventPlugin":12,"./EventPluginHub":15,"./ReactDOM":25,"./ReactDOMForm":26,"./ReactDOMInput":28,"./ReactDOMOption":29,"./ReactDOMSelect":30,"./ReactDOMTextarea":31,"./ReactInstanceHandles":37,"./SimpleEventPlugin":49}],33:[function(require,module,exports){
5527
+ },{"./ChangeEventPlugin":5,"./DOMProperty":7,"./DefaultDOMPropertyConfig":10,"./DefaultEventPluginOrder":11,"./EnterLeaveEventPlugin":12,"./EventPluginHub":15,"./MobileSafariClickEventPlugin":20,"./ReactDOM":26,"./ReactDOMForm":27,"./ReactDOMInput":29,"./ReactDOMOption":30,"./ReactDOMSelect":31,"./ReactDOMTextarea":32,"./ReactEventEmitter":34,"./ReactEventTopLevelCallback":35,"./ReactInstanceHandles":37,"./SimpleEventPlugin":50}],34:[function(require,module,exports){
5435
5528
  (function(){/**
5436
5529
  * Copyright 2013 Facebook, Inc.
5437
5530
  *
@@ -5678,7 +5771,7 @@ var ReactEventEmitter = {
5678
5771
 
5679
5772
  /**
5680
5773
  * React references `ReactEventTopLevelCallback` using this property in order
5681
- * to allow dependency injection via `ensureListening`.
5774
+ * to allow dependency injection.
5682
5775
  */
5683
5776
  TopLevelCallbackCreator: null,
5684
5777
 
@@ -5691,17 +5784,20 @@ var ReactEventEmitter = {
5691
5784
  * reason, and only in some cases).
5692
5785
  *
5693
5786
  * @param {boolean} touchNotMouse Listen to touch events instead of mouse.
5694
- * @param {object} TopLevelCallbackCreator
5695
5787
  */
5696
- ensureListening: function(touchNotMouse, TopLevelCallbackCreator) {
5788
+ ensureListening: function(touchNotMouse) {
5697
5789
  invariant(
5698
5790
  ExecutionEnvironment.canUseDOM,
5699
5791
  'ensureListening(...): Cannot toggle event listening in a Worker ' +
5700
5792
  'thread. This is likely a bug in the framework. Please report ' +
5701
5793
  'immediately.'
5702
5794
  );
5795
+ invariant(
5796
+ ReactEventEmitter.TopLevelCallbackCreator,
5797
+ 'ensureListening(...): Cannot be called without a top level callback ' +
5798
+ 'creator being injected.'
5799
+ );
5703
5800
  if (!_isListening) {
5704
- ReactEventEmitter.TopLevelCallbackCreator = TopLevelCallbackCreator;
5705
5801
  listenAtTopLevel(touchNotMouse);
5706
5802
  _isListening = true;
5707
5803
  }
@@ -5780,7 +5876,7 @@ var ReactEventEmitter = {
5780
5876
  module.exports = ReactEventEmitter;
5781
5877
 
5782
5878
  })()
5783
- },{"./EventConstants":13,"./EventListener":14,"./EventPluginHub":15,"./ExecutionEnvironment":19,"./ReactUpdates":48,"./ViewportMetrics":59,"./invariant":75,"./isEventSupported":76}],34:[function(require,module,exports){
5879
+ },{"./EventConstants":13,"./EventListener":14,"./EventPluginHub":15,"./ExecutionEnvironment":19,"./ReactUpdates":49,"./ViewportMetrics":60,"./invariant":78,"./isEventSupported":79}],35:[function(require,module,exports){
5784
5880
  (function(){/**
5785
5881
  * Copyright 2013 Facebook, Inc.
5786
5882
  *
@@ -5804,8 +5900,7 @@ module.exports = ReactEventEmitter;
5804
5900
 
5805
5901
  var ExecutionEnvironment = require("./ExecutionEnvironment");
5806
5902
  var ReactEventEmitter = require("./ReactEventEmitter");
5807
- var ReactID = require("./ReactID");
5808
- var ReactInstanceHandles = require("./ReactInstanceHandles");
5903
+ var ReactMount = require("./ReactMount");
5809
5904
 
5810
5905
  var getEventTarget = require("./getEventTarget");
5811
5906
 
@@ -5817,7 +5912,7 @@ var _topLevelListenersEnabled = true;
5817
5912
 
5818
5913
  /**
5819
5914
  * Top-level callback creator used to implement event handling using delegation.
5820
- * This is used via dependency injection in `ReactEventEmitter.ensureListening`.
5915
+ * This is used via dependency injection.
5821
5916
  */
5822
5917
  var ReactEventTopLevelCallback = {
5823
5918
 
@@ -5856,10 +5951,10 @@ var ReactEventTopLevelCallback = {
5856
5951
  nativeEvent.srcElement !== nativeEvent.target) {
5857
5952
  nativeEvent.target = nativeEvent.srcElement;
5858
5953
  }
5859
- var topLevelTarget = ReactInstanceHandles.getFirstReactDOM(
5954
+ var topLevelTarget = ReactMount.getFirstReactDOM(
5860
5955
  getEventTarget(nativeEvent)
5861
5956
  ) || ExecutionEnvironment.global;
5862
- var topLevelTargetID = ReactID.getID(topLevelTarget) || '';
5957
+ var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
5863
5958
  ReactEventEmitter.handleTopLevel(
5864
5959
  topLevelType,
5865
5960
  topLevelTarget,
@@ -5874,175 +5969,7 @@ var ReactEventTopLevelCallback = {
5874
5969
  module.exports = ReactEventTopLevelCallback;
5875
5970
 
5876
5971
  })()
5877
- },{"./ExecutionEnvironment":19,"./ReactEventEmitter":33,"./ReactID":35,"./ReactInstanceHandles":37,"./getEventTarget":70}],35:[function(require,module,exports){
5878
- /**
5879
- * Copyright 2013 Facebook, Inc.
5880
- *
5881
- * Licensed under the Apache License, Version 2.0 (the "License");
5882
- * you may not use this file except in compliance with the License.
5883
- * You may obtain a copy of the License at
5884
- *
5885
- * http://www.apache.org/licenses/LICENSE-2.0
5886
- *
5887
- * Unless required by applicable law or agreed to in writing, software
5888
- * distributed under the License is distributed on an "AS IS" BASIS,
5889
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5890
- * See the License for the specific language governing permissions and
5891
- * limitations under the License.
5892
- *
5893
- * @providesModule ReactID
5894
- * @typechecks static-only
5895
- */
5896
-
5897
- "use strict";
5898
-
5899
- var invariant = require("./invariant");
5900
- var ReactMount = require("./ReactMount");
5901
- var ATTR_NAME = 'data-reactid';
5902
- var nodeCache = {};
5903
-
5904
- /**
5905
- * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
5906
- * element can return its control whose name or ID equals ATTR_NAME. All
5907
- * DOM nodes support `getAttributeNode` but this can also get called on
5908
- * other objects so just return '' if we're given something other than a
5909
- * DOM node (such as window).
5910
- *
5911
- * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
5912
- * @return {string} ID of the supplied `domNode`.
5913
- */
5914
- function getID(node) {
5915
- var id = internalGetID(node);
5916
- if (id) {
5917
- if (nodeCache.hasOwnProperty(id)) {
5918
- var cached = nodeCache[id];
5919
- if (cached !== node) {
5920
- invariant(
5921
- !isValid(cached, id),
5922
- 'ReactID: Two valid but unequal nodes with the same `%s`: %s',
5923
- ATTR_NAME, id
5924
- );
5925
-
5926
- nodeCache[id] = node;
5927
- }
5928
- } else {
5929
- nodeCache[id] = node;
5930
- }
5931
- }
5932
-
5933
- return id;
5934
- }
5935
-
5936
- function internalGetID(node) {
5937
- if (node && node.getAttributeNode) {
5938
- var attributeNode = node.getAttributeNode(ATTR_NAME);
5939
- if (attributeNode) {
5940
- return attributeNode.value || '';
5941
- }
5942
- }
5943
- return '';
5944
- }
5945
-
5946
- /**
5947
- * Sets the React-specific ID of the given node.
5948
- *
5949
- * @param {DOMElement} node The DOM node whose ID will be set.
5950
- * @param {string} id The value of the ID attribute.
5951
- */
5952
- function setID(node, id) {
5953
- var oldID = internalGetID(node);
5954
- if (oldID !== id) {
5955
- delete nodeCache[oldID];
5956
- }
5957
- node.setAttribute(ATTR_NAME, id);
5958
- nodeCache[id] = node;
5959
- }
5960
-
5961
- /**
5962
- * Finds the node with the supplied React-generated DOM ID.
5963
- *
5964
- * @param {string} id A React-generated DOM ID.
5965
- * @return {DOMElement} DOM node with the suppled `id`.
5966
- * @internal
5967
- */
5968
- function getNode(id) {
5969
- if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
5970
- nodeCache[id] = ReactMount.findReactNodeByID(id);
5971
- }
5972
- return nodeCache[id];
5973
- }
5974
-
5975
- /**
5976
- * A node is "valid" if it is contained by a currently mounted container.
5977
- *
5978
- * This means that the node does not have to be contained by a document in
5979
- * order to be considered valid.
5980
- *
5981
- * @param {?DOMElement} node The candidate DOM node.
5982
- * @param {string} id The expected ID of the node.
5983
- * @return {boolean} Whether the node is contained by a mounted container.
5984
- */
5985
- function isValid(node, id) {
5986
- if (node) {
5987
- invariant(
5988
- internalGetID(node) === id,
5989
- 'ReactID: Unexpected modification of `%s`',
5990
- ATTR_NAME
5991
- );
5992
-
5993
- var container = ReactMount.findReactContainerForID(id);
5994
- if (container && contains(container, node)) {
5995
- return true;
5996
- }
5997
- }
5998
-
5999
- return false;
6000
- }
6001
-
6002
- function contains(ancestor, descendant) {
6003
- if (ancestor.contains) {
6004
- // Supported natively in virtually all browsers, but not in jsdom.
6005
- return ancestor.contains(descendant);
6006
- }
6007
-
6008
- if (descendant === ancestor) {
6009
- return true;
6010
- }
6011
-
6012
- if (descendant.nodeType === 3) {
6013
- // If descendant is a text node, start from descendant.parentNode
6014
- // instead, so that we can assume all ancestors worth considering are
6015
- // element nodes with nodeType === 1.
6016
- descendant = descendant.parentNode;
6017
- }
6018
-
6019
- while (descendant && descendant.nodeType === 1) {
6020
- if (descendant === ancestor) {
6021
- return true;
6022
- }
6023
- descendant = descendant.parentNode;
6024
- }
6025
-
6026
- return false;
6027
- }
6028
-
6029
- /**
6030
- * Causes the cache to forget about one React-specific ID.
6031
- *
6032
- * @param {string} id The ID to forget.
6033
- */
6034
- function purgeID(id) {
6035
- delete nodeCache[id];
6036
- }
6037
-
6038
- exports.ATTR_NAME = ATTR_NAME;
6039
- exports.getID = getID;
6040
- exports.rawGetID = internalGetID;
6041
- exports.setID = setID;
6042
- exports.getNode = getNode;
6043
- exports.purgeID = purgeID;
6044
-
6045
- },{"./ReactMount":38,"./invariant":75}],36:[function(require,module,exports){
5972
+ },{"./ExecutionEnvironment":19,"./ReactEventEmitter":34,"./ReactMount":39,"./getEventTarget":72}],36:[function(require,module,exports){
6046
5973
  /**
6047
5974
  * Copyright 2013 Facebook, Inc.
6048
5975
  *
@@ -6250,8 +6177,6 @@ module.exports = ReactInputSelection;
6250
6177
 
6251
6178
  "use strict";
6252
6179
 
6253
- var ReactID = require("./ReactID");
6254
-
6255
6180
  var invariant = require("./invariant");
6256
6181
 
6257
6182
  var SEPARATOR = '.';
@@ -6471,127 +6396,30 @@ var ReactInstanceHandles = {
6471
6396
  },
6472
6397
 
6473
6398
  /**
6474
- * True if the supplied `node` is rendered by React.
6399
+ * Gets the DOM ID of the React component that is the root of the tree that
6400
+ * contains the React component with the supplied DOM ID.
6475
6401
  *
6476
- * @param {*} node DOM Element to check.
6477
- * @return {boolean} True if the DOM Element appears to be rendered by React.
6402
+ * @param {string} id DOM ID of a React component.
6403
+ * @return {?string} DOM ID of the React component that is the root.
6478
6404
  * @internal
6479
6405
  */
6480
- isRenderedByReact: function(node) {
6481
- if (node.nodeType !== 1) {
6482
- // Not a DOMElement, therefore not a React component
6483
- return false;
6484
- }
6485
- var id = ReactID.getID(node);
6486
- return id ? id.charAt(0) === SEPARATOR : false;
6406
+ getReactRootIDFromNodeID: function(id) {
6407
+ var regexResult = /\.r\[[^\]]+\]/.exec(id);
6408
+ return regexResult && regexResult[0];
6487
6409
  },
6488
6410
 
6489
6411
  /**
6490
- * Traverses up the ancestors of the supplied node to find a node that is a
6491
- * DOM representation of a React component.
6412
+ * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
6413
+ * should would receive a `mouseEnter` or `mouseLeave` event.
6492
6414
  *
6493
- * @param {*} node
6494
- * @return {?DOMEventTarget}
6495
- * @internal
6496
- */
6497
- getFirstReactDOM: function(node) {
6498
- var current = node;
6499
- while (current && current.parentNode !== current) {
6500
- if (ReactInstanceHandles.isRenderedByReact(current)) {
6501
- return current;
6502
- }
6503
- current = current.parentNode;
6504
- }
6505
- return null;
6506
- },
6507
-
6508
- /**
6509
- * Finds a node with the supplied `id` inside of the supplied `ancestorNode`.
6510
- * Exploits the ID naming scheme to perform the search quickly.
6511
- *
6512
- * @param {DOMEventTarget} ancestorNode Search from this root.
6513
- * @pararm {string} id ID of the DOM representation of the component.
6514
- * @return {DOMEventTarget} DOM node with the supplied `id`.
6515
- * @internal
6516
- */
6517
- findComponentRoot: function(ancestorNode, id) {
6518
- var firstChildren = [ancestorNode.firstChild];
6519
- var childIndex = 0;
6520
-
6521
- while (childIndex < firstChildren.length) {
6522
- var child = firstChildren[childIndex++];
6523
- while (child) {
6524
- var childID = ReactID.getID(child);
6525
- if (childID) {
6526
- if (id === childID) {
6527
- return child;
6528
- } else if (isAncestorIDOf(childID, id)) {
6529
- // If we find a child whose ID is an ancestor of the given ID,
6530
- // then we can be sure that we only want to search the subtree
6531
- // rooted at this child, so we can throw out the rest of the
6532
- // search state.
6533
- firstChildren.length = childIndex = 0;
6534
- firstChildren.push(child.firstChild);
6535
- break;
6536
- } else {
6537
- // TODO This should not be necessary if the ID hierarchy is
6538
- // correct, but is occasionally necessary if the DOM has been
6539
- // modified in unexpected ways.
6540
- firstChildren.push(child.firstChild);
6541
- }
6542
- } else {
6543
- // If this child had no ID, then there's a chance that it was
6544
- // injected automatically by the browser, as when a `<table>`
6545
- // element sprouts an extra `<tbody>` child as a side effect of
6546
- // `.innerHTML` parsing. Optimistically continue down this
6547
- // branch, but not before examining the other siblings.
6548
- firstChildren.push(child.firstChild);
6549
- }
6550
- child = child.nextSibling;
6551
- }
6552
- }
6553
-
6554
- if (true) {
6555
- console.error(
6556
- 'Error while invoking `findComponentRoot` with the following ' +
6557
- 'ancestor node:',
6558
- ancestorNode
6559
- );
6560
- }
6561
- invariant(
6562
- false,
6563
- 'findComponentRoot(..., %s): Unable to find element. This probably ' +
6564
- 'means the DOM was unexpectedly mutated (e.g. by the browser).',
6565
- id,
6566
- ReactID.getID(ancestorNode)
6567
- );
6568
- },
6569
-
6570
- /**
6571
- * Gets the DOM ID of the React component that is the root of the tree that
6572
- * contains the React component with the supplied DOM ID.
6573
- *
6574
- * @param {string} id DOM ID of a React component.
6575
- * @return {?string} DOM ID of the React component that is the root.
6576
- * @internal
6577
- */
6578
- getReactRootIDFromNodeID: function(id) {
6579
- var regexResult = /\.r\[[^\]]+\]/.exec(id);
6580
- return regexResult && regexResult[0];
6581
- },
6582
-
6583
- /**
6584
- * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
6585
- * should would receive a `mouseEnter` or `mouseLeave` event.
6586
- *
6587
- * NOTE: Does not invoke the callback on the nearest common ancestor because
6588
- * nothing "entered" or "left" that element.
6589
- *
6590
- * @param {string} leaveID ID being left.
6591
- * @param {string} enterID ID being entered.
6592
- * @param {function} cb Callback to invoke on each entered/left ID.
6593
- * @param {*} upArg Argument to invoke the callback with on left IDs.
6594
- * @param {*} downArg Argument to invoke the callback with on entered IDs.
6415
+ * NOTE: Does not invoke the callback on the nearest common ancestor because
6416
+ * nothing "entered" or "left" that element.
6417
+ *
6418
+ * @param {string} leaveID ID being left.
6419
+ * @param {string} enterID ID being entered.
6420
+ * @param {function} cb Callback to invoke on each entered/left ID.
6421
+ * @param {*} upArg Argument to invoke the callback with on left IDs.
6422
+ * @param {*} downArg Argument to invoke the callback with on entered IDs.
6595
6423
  * @internal
6596
6424
  */
6597
6425
  traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
@@ -6631,13 +6459,72 @@ var ReactInstanceHandles = {
6631
6459
  * Exposed for unit testing.
6632
6460
  * @private
6633
6461
  */
6634
- _getNextDescendantID: getNextDescendantID
6462
+ _getNextDescendantID: getNextDescendantID,
6463
+
6464
+ isAncestorIDOf: isAncestorIDOf,
6465
+
6466
+ SEPARATOR: SEPARATOR
6635
6467
 
6636
6468
  };
6637
6469
 
6638
6470
  module.exports = ReactInstanceHandles;
6639
6471
 
6640
- },{"./ReactID":35,"./invariant":75}],38:[function(require,module,exports){
6472
+ },{"./invariant":78}],38:[function(require,module,exports){
6473
+ /**
6474
+ * Copyright 2013 Facebook, Inc.
6475
+ *
6476
+ * Licensed under the Apache License, Version 2.0 (the "License");
6477
+ * you may not use this file except in compliance with the License.
6478
+ * You may obtain a copy of the License at
6479
+ *
6480
+ * http://www.apache.org/licenses/LICENSE-2.0
6481
+ *
6482
+ * Unless required by applicable law or agreed to in writing, software
6483
+ * distributed under the License is distributed on an "AS IS" BASIS,
6484
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6485
+ * See the License for the specific language governing permissions and
6486
+ * limitations under the License.
6487
+ *
6488
+ * @providesModule ReactMarkupChecksum
6489
+ */
6490
+
6491
+ "use strict";
6492
+
6493
+ var adler32 = require("./adler32");
6494
+
6495
+ var ReactMarkupChecksum = {
6496
+ CHECKSUM_ATTR_NAME: 'data-react-checksum',
6497
+
6498
+ /**
6499
+ * @param {string} markup Markup string
6500
+ * @return {string} Markup string with checksum attribute attached
6501
+ */
6502
+ addChecksumToMarkup: function(markup) {
6503
+ var checksum = adler32(markup);
6504
+ return markup.replace(
6505
+ '>',
6506
+ ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
6507
+ );
6508
+ },
6509
+
6510
+ /**
6511
+ * @param {string} markup to use
6512
+ * @param {DOMElement} element root React element
6513
+ * @returns {boolean} whether or not the markup is the same
6514
+ */
6515
+ canReuseMarkup: function(markup, element) {
6516
+ var existingChecksum = element.getAttribute(
6517
+ ReactMarkupChecksum.CHECKSUM_ATTR_NAME
6518
+ );
6519
+ existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
6520
+ var markupChecksum = adler32(markup);
6521
+ return markupChecksum === existingChecksum;
6522
+ }
6523
+ };
6524
+
6525
+ module.exports = ReactMarkupChecksum;
6526
+
6527
+ },{"./adler32":62}],39:[function(require,module,exports){
6641
6528
  (function(){/**
6642
6529
  * Copyright 2013 Facebook, Inc.
6643
6530
  *
@@ -6659,10 +6546,14 @@ module.exports = ReactInstanceHandles;
6659
6546
  "use strict";
6660
6547
 
6661
6548
  var invariant = require("./invariant");
6549
+ var getReactRootElementInContainer = require("./getReactRootElementInContainer");
6662
6550
  var ReactEventEmitter = require("./ReactEventEmitter");
6663
6551
  var ReactInstanceHandles = require("./ReactInstanceHandles");
6664
- var ReactEventTopLevelCallback = require("./ReactEventTopLevelCallback");
6665
- var ReactID = require("./ReactID");
6552
+
6553
+ var SEPARATOR = ReactInstanceHandles.SEPARATOR;
6554
+
6555
+ var ATTR_NAME = 'data-reactid';
6556
+ var nodeCache = {};
6666
6557
 
6667
6558
  var $ = require("./$");
6668
6559
 
@@ -6677,21 +6568,144 @@ if (true) {
6677
6568
  var rootElementsByReactRootID = {};
6678
6569
  }
6679
6570
 
6680
- /**
6681
- * @param {DOMElement} container DOM element that may contain a React component
6682
- * @return {?*} DOM element that may have the reactRoot ID, or null.
6683
- */
6684
- function getReactRootElementInContainer(container) {
6685
- return container && container.firstChild;
6686
- }
6687
-
6688
6571
  /**
6689
6572
  * @param {DOMElement} container DOM element that may contain a React component.
6690
6573
  * @return {?string} A "reactRoot" ID, if a React component is rendered.
6691
6574
  */
6692
6575
  function getReactRootID(container) {
6693
6576
  var rootElement = getReactRootElementInContainer(container);
6694
- return rootElement && ReactID.getID(rootElement);
6577
+ return rootElement && ReactMount.getID(rootElement);
6578
+ }
6579
+
6580
+ /**
6581
+ * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
6582
+ * element can return its control whose name or ID equals ATTR_NAME. All
6583
+ * DOM nodes support `getAttributeNode` but this can also get called on
6584
+ * other objects so just return '' if we're given something other than a
6585
+ * DOM node (such as window).
6586
+ *
6587
+ * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
6588
+ * @return {string} ID of the supplied `domNode`.
6589
+ */
6590
+ function getID(node) {
6591
+ var id = internalGetID(node);
6592
+ if (id) {
6593
+ if (nodeCache.hasOwnProperty(id)) {
6594
+ var cached = nodeCache[id];
6595
+ if (cached !== node) {
6596
+ invariant(
6597
+ !isValid(cached, id),
6598
+ 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
6599
+ ATTR_NAME, id
6600
+ );
6601
+
6602
+ nodeCache[id] = node;
6603
+ }
6604
+ } else {
6605
+ nodeCache[id] = node;
6606
+ }
6607
+ }
6608
+
6609
+ return id;
6610
+ }
6611
+
6612
+ function internalGetID(node) {
6613
+ // If node is something like a window, document, or text node, none of
6614
+ // which support attributes or a .getAttribute method, gracefully return
6615
+ // the empty string, as if the attribute were missing.
6616
+ return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
6617
+ }
6618
+
6619
+ /**
6620
+ * Sets the React-specific ID of the given node.
6621
+ *
6622
+ * @param {DOMElement} node The DOM node whose ID will be set.
6623
+ * @param {string} id The value of the ID attribute.
6624
+ */
6625
+ function setID(node, id) {
6626
+ var oldID = internalGetID(node);
6627
+ if (oldID !== id) {
6628
+ delete nodeCache[oldID];
6629
+ }
6630
+ node.setAttribute(ATTR_NAME, id);
6631
+ nodeCache[id] = node;
6632
+ }
6633
+
6634
+ /**
6635
+ * Finds the node with the supplied React-generated DOM ID.
6636
+ *
6637
+ * @param {string} id A React-generated DOM ID.
6638
+ * @return {DOMElement} DOM node with the suppled `id`.
6639
+ * @internal
6640
+ */
6641
+ function getNode(id) {
6642
+ if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
6643
+ nodeCache[id] = ReactMount.findReactNodeByID(id);
6644
+ }
6645
+ return nodeCache[id];
6646
+ }
6647
+
6648
+ /**
6649
+ * A node is "valid" if it is contained by a currently mounted container.
6650
+ *
6651
+ * This means that the node does not have to be contained by a document in
6652
+ * order to be considered valid.
6653
+ *
6654
+ * @param {?DOMElement} node The candidate DOM node.
6655
+ * @param {string} id The expected ID of the node.
6656
+ * @return {boolean} Whether the node is contained by a mounted container.
6657
+ */
6658
+ function isValid(node, id) {
6659
+ if (node) {
6660
+ invariant(
6661
+ internalGetID(node) === id,
6662
+ 'ReactMount: Unexpected modification of `%s`',
6663
+ ATTR_NAME
6664
+ );
6665
+
6666
+ var container = ReactMount.findReactContainerForID(id);
6667
+ if (container && contains(container, node)) {
6668
+ return true;
6669
+ }
6670
+ }
6671
+
6672
+ return false;
6673
+ }
6674
+
6675
+ function contains(ancestor, descendant) {
6676
+ if (ancestor.contains) {
6677
+ // Supported natively in virtually all browsers, but not in jsdom.
6678
+ return ancestor.contains(descendant);
6679
+ }
6680
+
6681
+ if (descendant === ancestor) {
6682
+ return true;
6683
+ }
6684
+
6685
+ if (descendant.nodeType === 3) {
6686
+ // If descendant is a text node, start from descendant.parentNode
6687
+ // instead, so that we can assume all ancestors worth considering are
6688
+ // element nodes with nodeType === 1.
6689
+ descendant = descendant.parentNode;
6690
+ }
6691
+
6692
+ while (descendant && descendant.nodeType === 1) {
6693
+ if (descendant === ancestor) {
6694
+ return true;
6695
+ }
6696
+ descendant = descendant.parentNode;
6697
+ }
6698
+
6699
+ return false;
6700
+ }
6701
+
6702
+ /**
6703
+ * Causes the cache to forget about one React-specific ID.
6704
+ *
6705
+ * @param {string} id The ID to forget.
6706
+ */
6707
+ function purgeID(id) {
6708
+ delete nodeCache[id];
6695
6709
  }
6696
6710
 
6697
6711
  /**
@@ -6736,14 +6750,10 @@ var ReactMount = {
6736
6750
  * Ensures that the top-level event delegation listener is set up. This will
6737
6751
  * be invoked some time before the first time any React component is rendered.
6738
6752
  *
6739
- * @param {object} TopLevelCallbackCreator
6740
6753
  * @private
6741
6754
  */
6742
- prepareTopLevelEvents: function(TopLevelCallbackCreator) {
6743
- ReactEventEmitter.ensureListening(
6744
- ReactMount.useTouchEvents,
6745
- TopLevelCallbackCreator
6746
- );
6755
+ prepareTopLevelEvents: function() {
6756
+ ReactEventEmitter.ensureListening(ReactMount.useTouchEvents);
6747
6757
  },
6748
6758
 
6749
6759
  /**
@@ -6779,7 +6789,7 @@ var ReactMount = {
6779
6789
  * @return {string} reactRoot ID prefix
6780
6790
  */
6781
6791
  _registerComponent: function(nextComponent, container) {
6782
- ReactMount.prepareTopLevelEvents(ReactEventTopLevelCallback);
6792
+ ReactMount.prepareTopLevelEvents();
6783
6793
 
6784
6794
  var reactRootID = ReactMount.registerContainer(container);
6785
6795
  instanceByReactRootID[reactRootID] = nextComponent;
@@ -6843,8 +6853,7 @@ var ReactMount = {
6843
6853
 
6844
6854
  var reactRootElement = getReactRootElementInContainer(container);
6845
6855
  var containerHasReactMarkup =
6846
- reactRootElement &&
6847
- ReactInstanceHandles.isRenderedByReact(reactRootElement);
6856
+ reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
6848
6857
 
6849
6858
  var shouldReuseMarkup = containerHasReactMarkup && !registeredComponent;
6850
6859
 
@@ -6931,60 +6940,173 @@ var ReactMount = {
6931
6940
  * Finds the container DOM element that contains React component to which the
6932
6941
  * supplied DOM `id` belongs.
6933
6942
  *
6934
- * @param {string} id The ID of an element rendered by a React component.
6935
- * @return {?DOMElement} DOM element that contains the `id`.
6943
+ * @param {string} id The ID of an element rendered by a React component.
6944
+ * @return {?DOMElement} DOM element that contains the `id`.
6945
+ */
6946
+ findReactContainerForID: function(id) {
6947
+ var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
6948
+ var container = containersByReactRootID[reactRootID];
6949
+
6950
+ if (true) {
6951
+ var rootElement = rootElementsByReactRootID[reactRootID];
6952
+ if (rootElement && rootElement.parentNode !== container) {
6953
+ invariant(
6954
+ // Call internalGetID here because getID calls isValid which calls
6955
+ // findReactContainerForID (this function).
6956
+ internalGetID(rootElement) === reactRootID,
6957
+ 'ReactMount: Root element ID differed from reactRootID.'
6958
+ );
6959
+
6960
+ var containerChild = container.firstChild;
6961
+ if (containerChild &&
6962
+ reactRootID === internalGetID(containerChild)) {
6963
+ // If the container has a new child with the same ID as the old
6964
+ // root element, then rootElementsByReactRootID[reactRootID] is
6965
+ // just stale and needs to be updated. The case that deserves a
6966
+ // warning is when the container is empty.
6967
+ rootElementsByReactRootID[reactRootID] = containerChild;
6968
+ } else {
6969
+ console.warn(
6970
+ 'ReactMount: Root element has been removed from its original ' +
6971
+ 'container. New container:', rootElement.parentNode
6972
+ );
6973
+ }
6974
+ }
6975
+ }
6976
+
6977
+ return container;
6978
+ },
6979
+
6980
+ /**
6981
+ * Finds an element rendered by React with the supplied ID.
6982
+ *
6983
+ * @param {string} id ID of a DOM node in the React component.
6984
+ * @return {DOMElement} Root DOM node of the React component.
6985
+ */
6986
+ findReactNodeByID: function(id) {
6987
+ var reactRoot = ReactMount.findReactContainerForID(id);
6988
+ return ReactMount.findComponentRoot(reactRoot, id);
6989
+ },
6990
+
6991
+ /**
6992
+ * True if the supplied `node` is rendered by React.
6993
+ *
6994
+ * @param {*} node DOM Element to check.
6995
+ * @return {boolean} True if the DOM Element appears to be rendered by React.
6996
+ * @internal
6997
+ */
6998
+ isRenderedByReact: function(node) {
6999
+ if (node.nodeType !== 1) {
7000
+ // Not a DOMElement, therefore not a React component
7001
+ return false;
7002
+ }
7003
+ var id = ReactMount.getID(node);
7004
+ return id ? id.charAt(0) === SEPARATOR : false;
7005
+ },
7006
+
7007
+ /**
7008
+ * Traverses up the ancestors of the supplied node to find a node that is a
7009
+ * DOM representation of a React component.
7010
+ *
7011
+ * @param {*} node
7012
+ * @return {?DOMEventTarget}
7013
+ * @internal
7014
+ */
7015
+ getFirstReactDOM: function(node) {
7016
+ var current = node;
7017
+ while (current && current.parentNode !== current) {
7018
+ if (ReactMount.isRenderedByReact(current)) {
7019
+ return current;
7020
+ }
7021
+ current = current.parentNode;
7022
+ }
7023
+ return null;
7024
+ },
7025
+
7026
+ /**
7027
+ * Finds a node with the supplied `id` inside of the supplied `ancestorNode`.
7028
+ * Exploits the ID naming scheme to perform the search quickly.
7029
+ *
7030
+ * @param {DOMEventTarget} ancestorNode Search from this root.
7031
+ * @pararm {string} id ID of the DOM representation of the component.
7032
+ * @return {DOMEventTarget} DOM node with the supplied `id`.
7033
+ * @internal
6936
7034
  */
6937
- findReactContainerForID: function(id) {
6938
- var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
6939
- var container = containersByReactRootID[reactRootID];
6940
-
6941
- if (true) {
6942
- var rootElement = rootElementsByReactRootID[reactRootID];
6943
- if (rootElement && rootElement.parentNode !== container) {
6944
- invariant(
6945
- // Call rawGetID here because getID calls isValid which calls
6946
- // findReactContainerForID (this function).
6947
- ReactID.rawGetID(rootElement) === reactRootID,
6948
- 'ReactMount: Root element ID differed from reactRootID.'
6949
- );
7035
+ findComponentRoot: function(ancestorNode, id) {
7036
+ var firstChildren = [ancestorNode.firstChild];
7037
+ var childIndex = 0;
6950
7038
 
6951
- var containerChild = container.firstChild;
6952
- if (containerChild &&
6953
- reactRootID === ReactID.rawGetID(containerChild)) {
6954
- // If the container has a new child with the same ID as the old
6955
- // root element, then rootElementsByReactRootID[reactRootID] is
6956
- // just stale and needs to be updated. The case that deserves a
6957
- // warning is when the container is empty.
6958
- rootElementsByReactRootID[reactRootID] = containerChild;
7039
+ while (childIndex < firstChildren.length) {
7040
+ var child = firstChildren[childIndex++];
7041
+ while (child) {
7042
+ var childID = ReactMount.getID(child);
7043
+ if (childID) {
7044
+ if (id === childID) {
7045
+ return child;
7046
+ } else if (ReactInstanceHandles.isAncestorIDOf(childID, id)) {
7047
+ // If we find a child whose ID is an ancestor of the given ID,
7048
+ // then we can be sure that we only want to search the subtree
7049
+ // rooted at this child, so we can throw out the rest of the
7050
+ // search state.
7051
+ firstChildren.length = childIndex = 0;
7052
+ firstChildren.push(child.firstChild);
7053
+ break;
7054
+ } else {
7055
+ // TODO This should not be necessary if the ID hierarchy is
7056
+ // correct, but is occasionally necessary if the DOM has been
7057
+ // modified in unexpected ways.
7058
+ firstChildren.push(child.firstChild);
7059
+ }
6959
7060
  } else {
6960
- console.warn(
6961
- 'ReactMount: Root element has been removed from its original ' +
6962
- 'container. New container:', rootElement.parentNode
6963
- );
7061
+ // If this child had no ID, then there's a chance that it was
7062
+ // injected automatically by the browser, as when a `<table>`
7063
+ // element sprouts an extra `<tbody>` child as a side effect of
7064
+ // `.innerHTML` parsing. Optimistically continue down this
7065
+ // branch, but not before examining the other siblings.
7066
+ firstChildren.push(child.firstChild);
6964
7067
  }
7068
+ child = child.nextSibling;
6965
7069
  }
6966
7070
  }
6967
7071
 
6968
- return container;
7072
+ if (true) {
7073
+ console.error(
7074
+ 'Error while invoking `findComponentRoot` with the following ' +
7075
+ 'ancestor node:',
7076
+ ancestorNode
7077
+ );
7078
+ }
7079
+ invariant(
7080
+ false,
7081
+ 'findComponentRoot(..., %s): Unable to find element. This probably ' +
7082
+ 'means the DOM was unexpectedly mutated (e.g. by the browser).',
7083
+ id,
7084
+ ReactMount.getID(ancestorNode)
7085
+ );
6969
7086
  },
6970
7087
 
7088
+
6971
7089
  /**
6972
- * Finds an element rendered by React with the supplied ID.
6973
- *
6974
- * @param {string} id ID of a DOM node in the React component.
6975
- * @return {DOMElement} Root DOM node of the React component.
7090
+ * React ID utilities.
6976
7091
  */
6977
- findReactNodeByID: function(id) {
6978
- var reactRoot = ReactMount.findReactContainerForID(id);
6979
- return ReactInstanceHandles.findComponentRoot(reactRoot, id);
6980
- }
6981
7092
 
7093
+ ATTR_NAME: ATTR_NAME,
7094
+
7095
+ getID: getID,
7096
+
7097
+ setID: setID,
7098
+
7099
+ getNode: getNode,
7100
+
7101
+ purgeID: purgeID,
7102
+
7103
+ injection: {}
6982
7104
  };
6983
7105
 
6984
7106
  module.exports = ReactMount;
6985
7107
 
6986
7108
  })()
6987
- },{"./$":1,"./ReactEventEmitter":33,"./ReactEventTopLevelCallback":34,"./ReactID":35,"./ReactInstanceHandles":37,"./invariant":75}],39:[function(require,module,exports){
7109
+ },{"./$":1,"./ReactEventEmitter":34,"./ReactInstanceHandles":37,"./getReactRootElementInContainer":73,"./invariant":78}],40:[function(require,module,exports){
6988
7110
  (function(){/**
6989
7111
  * Copyright 2013 Facebook, Inc.
6990
7112
  *
@@ -7194,7 +7316,7 @@ var ReactMultiChild = {
7194
7316
  module.exports = ReactMultiChild;
7195
7317
 
7196
7318
  })()
7197
- },{"./ReactComponent":22}],40:[function(require,module,exports){
7319
+ },{"./ReactComponent":23}],41:[function(require,module,exports){
7198
7320
  /**
7199
7321
  * Copyright 2013 Facebook, Inc.
7200
7322
  *
@@ -7222,7 +7344,7 @@ var DOMPropertyOperations = require("./DOMPropertyOperations");
7222
7344
  var ReactComponent = require("./ReactComponent");
7223
7345
  var ReactEventEmitter = require("./ReactEventEmitter");
7224
7346
  var ReactMultiChild = require("./ReactMultiChild");
7225
- var ReactID = require("./ReactID");
7347
+ var ReactMount = require("./ReactMount");
7226
7348
 
7227
7349
  var escapeTextForBrowser = require("./escapeTextForBrowser");
7228
7350
  var flattenChildren = require("./flattenChildren");
@@ -7333,7 +7455,7 @@ ReactNativeComponent.Mixin = {
7333
7455
  }
7334
7456
 
7335
7457
  var escapedID = escapeTextForBrowser(this._rootNodeID);
7336
- return ret + ' ' + ReactID.ATTR_NAME + '="' + escapedID + '">';
7458
+ return ret + ' ' + ReactMount.ATTR_NAME + '="' + escapedID + '">';
7337
7459
  },
7338
7460
 
7339
7461
  /**
@@ -7557,7 +7679,7 @@ mixInto(ReactNativeComponent, ReactMultiChild.Mixin);
7557
7679
 
7558
7680
  module.exports = ReactNativeComponent;
7559
7681
 
7560
- },{"./CSSPropertyOperations":3,"./DOMProperty":7,"./DOMPropertyOperations":8,"./ReactComponent":22,"./ReactEventEmitter":33,"./ReactID":35,"./ReactMultiChild":39,"./escapeTextForBrowser":65,"./flattenChildren":67,"./invariant":75,"./keyOf":79,"./merge":81,"./mixInto":84}],41:[function(require,module,exports){
7682
+ },{"./CSSPropertyOperations":3,"./DOMProperty":7,"./DOMPropertyOperations":8,"./ReactComponent":23,"./ReactEventEmitter":34,"./ReactMount":39,"./ReactMultiChild":40,"./escapeTextForBrowser":67,"./flattenChildren":69,"./invariant":78,"./keyOf":82,"./merge":84,"./mixInto":87}],42:[function(require,module,exports){
7561
7683
  /**
7562
7684
  * Copyright 2013 Facebook, Inc.
7563
7685
  *
@@ -7654,7 +7776,7 @@ PooledClass.addPoolingTo(ReactOnDOMReady);
7654
7776
 
7655
7777
  module.exports = ReactOnDOMReady;
7656
7778
 
7657
- },{"./PooledClass":20,"./mixInto":84}],42:[function(require,module,exports){
7779
+ },{"./PooledClass":21,"./mixInto":87}],43:[function(require,module,exports){
7658
7780
  /**
7659
7781
  * Copyright 2013 Facebook, Inc.
7660
7782
  *
@@ -7802,7 +7924,7 @@ var ReactOwner = {
7802
7924
 
7803
7925
  module.exports = ReactOwner;
7804
7926
 
7805
- },{"./invariant":75}],43:[function(require,module,exports){
7927
+ },{"./invariant":78}],44:[function(require,module,exports){
7806
7928
  /**
7807
7929
  * Copyright 2013 Facebook, Inc.
7808
7930
  *
@@ -7922,7 +8044,7 @@ var ReactPropTransferer = {
7922
8044
 
7923
8045
  module.exports = ReactPropTransferer;
7924
8046
 
7925
- },{"./emptyFunction":64,"./joinClasses":77,"./merge":81}],44:[function(require,module,exports){
8047
+ },{"./emptyFunction":66,"./joinClasses":80,"./merge":84}],45:[function(require,module,exports){
7926
8048
  /**
7927
8049
  * Copyright 2013 Facebook, Inc.
7928
8050
  *
@@ -8082,7 +8204,7 @@ function createChainableTypeChecker(validate) {
8082
8204
 
8083
8205
  module.exports = Props;
8084
8206
 
8085
- },{"./createObjectFrom":62,"./invariant":75}],45:[function(require,module,exports){
8207
+ },{"./createObjectFrom":64,"./invariant":78}],46:[function(require,module,exports){
8086
8208
  /**
8087
8209
  * Copyright 2013 Facebook, Inc.
8088
8210
  *
@@ -8245,7 +8367,7 @@ PooledClass.addPoolingTo(ReactReconcileTransaction);
8245
8367
 
8246
8368
  module.exports = ReactReconcileTransaction;
8247
8369
 
8248
- },{"./ExecutionEnvironment":19,"./PooledClass":20,"./ReactEventEmitter":33,"./ReactInputSelection":36,"./ReactOnDOMReady":41,"./Transaction":58,"./mixInto":84}],46:[function(require,module,exports){
8370
+ },{"./ExecutionEnvironment":19,"./PooledClass":21,"./ReactEventEmitter":34,"./ReactInputSelection":36,"./ReactOnDOMReady":42,"./Transaction":59,"./mixInto":87}],47:[function(require,module,exports){
8249
8371
  /**
8250
8372
  * Copyright 2013 Facebook, Inc.
8251
8373
  *
@@ -8266,6 +8388,7 @@ module.exports = ReactReconcileTransaction;
8266
8388
  */
8267
8389
  "use strict";
8268
8390
 
8391
+ var ReactMarkupChecksum = require("./ReactMarkupChecksum");
8269
8392
  var ReactReconcileTransaction = require("./ReactReconcileTransaction");
8270
8393
  var ReactInstanceHandles = require("./ReactInstanceHandles");
8271
8394
 
@@ -8281,7 +8404,9 @@ function renderComponentToString(component, callback) {
8281
8404
  transaction.reinitializeTransaction();
8282
8405
  try {
8283
8406
  transaction.perform(function() {
8284
- callback(component.mountComponent(id, transaction));
8407
+ var markup = component.mountComponent(id, transaction);
8408
+ markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
8409
+ callback(markup);
8285
8410
  }, null);
8286
8411
  } finally {
8287
8412
  ReactReconcileTransaction.release(transaction);
@@ -8292,7 +8417,7 @@ module.exports = {
8292
8417
  renderComponentToString: renderComponentToString
8293
8418
  };
8294
8419
 
8295
- },{"./ReactInstanceHandles":37,"./ReactReconcileTransaction":45}],47:[function(require,module,exports){
8420
+ },{"./ReactInstanceHandles":37,"./ReactMarkupChecksum":38,"./ReactReconcileTransaction":46}],48:[function(require,module,exports){
8296
8421
  /**
8297
8422
  * Copyright 2013 Facebook, Inc.
8298
8423
  *
@@ -8315,7 +8440,7 @@ module.exports = {
8315
8440
  "use strict";
8316
8441
 
8317
8442
  var ReactComponent = require("./ReactComponent");
8318
- var ReactID = require("./ReactID");
8443
+ var ReactMount = require("./ReactMount");
8319
8444
 
8320
8445
  var escapeTextForBrowser = require("./escapeTextForBrowser");
8321
8446
  var mixInto = require("./mixInto");
@@ -8353,7 +8478,7 @@ mixInto(ReactTextComponent, {
8353
8478
  mountComponent: function(rootID) {
8354
8479
  ReactComponent.Mixin.mountComponent.call(this, rootID);
8355
8480
  return (
8356
- '<span ' + ReactID.ATTR_NAME + '="' + rootID + '">' +
8481
+ '<span ' + ReactMount.ATTR_NAME + '="' + rootID + '">' +
8357
8482
  escapeTextForBrowser(this.props.text) +
8358
8483
  '</span>'
8359
8484
  );
@@ -8380,7 +8505,7 @@ mixInto(ReactTextComponent, {
8380
8505
 
8381
8506
  module.exports = ReactTextComponent;
8382
8507
 
8383
- },{"./ReactComponent":22,"./ReactID":35,"./escapeTextForBrowser":65,"./mixInto":84}],48:[function(require,module,exports){
8508
+ },{"./ReactComponent":23,"./ReactMount":39,"./escapeTextForBrowser":67,"./mixInto":87}],49:[function(require,module,exports){
8384
8509
  /**
8385
8510
  * Copyright 2013 Facebook, Inc.
8386
8511
  *
@@ -8437,7 +8562,7 @@ function batchedUpdates(callback) {
8437
8562
  component.performUpdateIfNecessary();
8438
8563
  if (callbacks) {
8439
8564
  for (var j = 0; j < callbacks.length; j++) {
8440
- callbacks[j]();
8565
+ callbacks[j].call(component);
8441
8566
  }
8442
8567
  }
8443
8568
  }
@@ -8487,7 +8612,7 @@ var ReactUpdates = {
8487
8612
 
8488
8613
  module.exports = ReactUpdates;
8489
8614
 
8490
- },{"./invariant":75}],49:[function(require,module,exports){
8615
+ },{"./invariant":78}],50:[function(require,module,exports){
8491
8616
  /**
8492
8617
  * Copyright 2013 Facebook, Inc.
8493
8618
  *
@@ -8824,7 +8949,7 @@ var SimpleEventPlugin = {
8824
8949
 
8825
8950
  module.exports = SimpleEventPlugin;
8826
8951
 
8827
- },{"./EventConstants":13,"./EventPropagators":18,"./SyntheticEvent":50,"./SyntheticFocusEvent":51,"./SyntheticKeyboardEvent":52,"./SyntheticMouseEvent":53,"./SyntheticMutationEvent":54,"./SyntheticTouchEvent":55,"./SyntheticUIEvent":56,"./SyntheticWheelEvent":57,"./invariant":75,"./keyOf":79}],50:[function(require,module,exports){
8952
+ },{"./EventConstants":13,"./EventPropagators":18,"./SyntheticEvent":51,"./SyntheticFocusEvent":52,"./SyntheticKeyboardEvent":53,"./SyntheticMouseEvent":54,"./SyntheticMutationEvent":55,"./SyntheticTouchEvent":56,"./SyntheticUIEvent":57,"./SyntheticWheelEvent":58,"./invariant":78,"./keyOf":82}],51:[function(require,module,exports){
8828
8953
  /**
8829
8954
  * Copyright 2013 Facebook, Inc.
8830
8955
  *
@@ -8895,6 +9020,9 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
8895
9020
 
8896
9021
  var Interface = this.constructor.Interface;
8897
9022
  for (var propName in Interface) {
9023
+ if (!Interface.hasOwnProperty(propName)) {
9024
+ continue;
9025
+ }
8898
9026
  var normalize = Interface[propName];
8899
9027
  if (normalize) {
8900
9028
  this[propName] = normalize(nativeEvent);
@@ -8983,7 +9111,7 @@ PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
8983
9111
 
8984
9112
  module.exports = SyntheticEvent;
8985
9113
 
8986
- },{"./PooledClass":20,"./emptyFunction":64,"./getEventTarget":70,"./merge":81,"./mergeInto":83}],51:[function(require,module,exports){
9114
+ },{"./PooledClass":21,"./emptyFunction":66,"./getEventTarget":72,"./merge":84,"./mergeInto":86}],52:[function(require,module,exports){
8987
9115
  /**
8988
9116
  * Copyright 2013 Facebook, Inc.
8989
9117
  *
@@ -9029,7 +9157,7 @@ SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
9029
9157
 
9030
9158
  module.exports = SyntheticFocusEvent;
9031
9159
 
9032
- },{"./SyntheticUIEvent":56}],52:[function(require,module,exports){
9160
+ },{"./SyntheticUIEvent":57}],53:[function(require,module,exports){
9033
9161
  /**
9034
9162
  * Copyright 2013 Facebook, Inc.
9035
9163
  *
@@ -9087,7 +9215,7 @@ SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
9087
9215
 
9088
9216
  module.exports = SyntheticKeyboardEvent;
9089
9217
 
9090
- },{"./SyntheticUIEvent":56}],53:[function(require,module,exports){
9218
+ },{"./SyntheticUIEvent":57}],54:[function(require,module,exports){
9091
9219
  /**
9092
9220
  * Copyright 2013 Facebook, Inc.
9093
9221
  *
@@ -9174,7 +9302,7 @@ SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
9174
9302
 
9175
9303
  module.exports = SyntheticMouseEvent;
9176
9304
 
9177
- },{"./SyntheticUIEvent":56,"./ViewportMetrics":59}],54:[function(require,module,exports){
9305
+ },{"./SyntheticUIEvent":57,"./ViewportMetrics":60}],55:[function(require,module,exports){
9178
9306
  /**
9179
9307
  * Copyright 2013 Facebook, Inc.
9180
9308
  *
@@ -9224,7 +9352,7 @@ SyntheticEvent.augmentClass(SyntheticMutationEvent, MutationEventInterface);
9224
9352
 
9225
9353
  module.exports = SyntheticMutationEvent;
9226
9354
 
9227
- },{"./SyntheticEvent":50}],55:[function(require,module,exports){
9355
+ },{"./SyntheticEvent":51}],56:[function(require,module,exports){
9228
9356
  /**
9229
9357
  * Copyright 2013 Facebook, Inc.
9230
9358
  *
@@ -9276,7 +9404,7 @@ SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
9276
9404
 
9277
9405
  module.exports = SyntheticTouchEvent;
9278
9406
 
9279
- },{"./SyntheticUIEvent":56}],56:[function(require,module,exports){
9407
+ },{"./SyntheticUIEvent":57}],57:[function(require,module,exports){
9280
9408
  /**
9281
9409
  * Copyright 2013 Facebook, Inc.
9282
9410
  *
@@ -9323,7 +9451,7 @@ SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
9323
9451
 
9324
9452
  module.exports = SyntheticUIEvent;
9325
9453
 
9326
- },{"./SyntheticEvent":50}],57:[function(require,module,exports){
9454
+ },{"./SyntheticEvent":51}],58:[function(require,module,exports){
9327
9455
  /**
9328
9456
  * Copyright 2013 Facebook, Inc.
9329
9457
  *
@@ -9388,7 +9516,7 @@ SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
9388
9516
 
9389
9517
  module.exports = SyntheticWheelEvent;
9390
9518
 
9391
- },{"./SyntheticMouseEvent":53}],58:[function(require,module,exports){
9519
+ },{"./SyntheticMouseEvent":54}],59:[function(require,module,exports){
9392
9520
  (function(){/**
9393
9521
  * Copyright 2013 Facebook, Inc.
9394
9522
  *
@@ -9409,23 +9537,7 @@ module.exports = SyntheticWheelEvent;
9409
9537
 
9410
9538
  "use strict";
9411
9539
 
9412
- var throwIf = require("./throwIf");
9413
-
9414
- var DUAL_TRANSACTION = 'DUAL_TRANSACTION';
9415
- var MISSING_TRANSACTION = 'MISSING_TRANSACTION';
9416
- if (true) {
9417
- DUAL_TRANSACTION =
9418
- 'Cannot initialize transaction when there is already an outstanding ' +
9419
- 'transaction. Common causes of this are trying to render a component ' +
9420
- 'when you are already rendering a component or attempting a state ' +
9421
- 'transition while in a render function. Another possibility is that ' +
9422
- 'you are rendering new content (or state transitioning) in a ' +
9423
- 'componentDidRender callback. If this is not the case, please report the ' +
9424
- 'issue immediately.';
9425
-
9426
- MISSING_TRANSACTION =
9427
- 'Cannot close transaction when there is none open.';
9428
- }
9540
+ var invariant = require("./invariant");
9429
9541
 
9430
9542
  /**
9431
9543
  * `Transaction` creates a black box that is able to wrap any method such that
@@ -9547,26 +9659,33 @@ var Mixin = {
9547
9659
  * @return Return value from `method`.
9548
9660
  */
9549
9661
  perform: function(method, scope, a, b, c, d, e, f) {
9550
- throwIf(this.isInTransaction(), DUAL_TRANSACTION);
9662
+ invariant(
9663
+ !this.isInTransaction(),
9664
+ 'Transaction.perform(...): Cannot initialize a transaction when there ' +
9665
+ 'is already an outstanding transaction.'
9666
+ );
9551
9667
  var memberStart = Date.now();
9552
- var err = null;
9668
+ var errorToThrow = null;
9553
9669
  var ret;
9554
9670
  try {
9555
9671
  this.initializeAll();
9556
9672
  ret = method.call(scope, a, b, c, d, e, f);
9557
- } catch (ie_requires_catch) {
9558
- err = ie_requires_catch;
9673
+ } catch (error) {
9674
+ // IE8 requires `catch` in order to use `finally`.
9675
+ errorToThrow = error;
9559
9676
  } finally {
9560
9677
  var memberEnd = Date.now();
9561
9678
  this.methodInvocationTime += (memberEnd - memberStart);
9562
9679
  try {
9563
9680
  this.closeAll();
9564
- } catch (closeAllErr) {
9565
- err = err || closeAllErr;
9681
+ } catch (closeError) {
9682
+ // If `method` throws, prefer to show that stack trace over any thrown
9683
+ // by invoking `closeAll`.
9684
+ errorToThrow = errorToThrow || closeError;
9566
9685
  }
9567
9686
  }
9568
- if (err) {
9569
- throw err;
9687
+ if (errorToThrow) {
9688
+ throw errorToThrow;
9570
9689
  }
9571
9690
  return ret;
9572
9691
  },
@@ -9575,15 +9694,17 @@ var Mixin = {
9575
9694
  this._isInTransaction = true;
9576
9695
  var transactionWrappers = this.transactionWrappers;
9577
9696
  var wrapperInitTimes = this.timingMetrics.wrapperInitTimes;
9578
- var err = null;
9697
+ var errorToThrow = null;
9579
9698
  for (var i = 0; i < transactionWrappers.length; i++) {
9580
9699
  var initStart = Date.now();
9581
9700
  var wrapper = transactionWrappers[i];
9582
9701
  try {
9583
- this.wrapperInitData[i] =
9584
- wrapper.initialize ? wrapper.initialize.call(this) : null;
9585
- } catch (initErr) {
9586
- err = err || initErr; // Remember the first error.
9702
+ this.wrapperInitData[i] = wrapper.initialize ?
9703
+ wrapper.initialize.call(this) :
9704
+ null;
9705
+ } catch (initError) {
9706
+ // Prefer to show the stack trace of the first error.
9707
+ errorToThrow = errorToThrow || initError;
9587
9708
  this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
9588
9709
  } finally {
9589
9710
  var curInitTime = wrapperInitTimes[i];
@@ -9591,8 +9712,8 @@ var Mixin = {
9591
9712
  wrapperInitTimes[i] = (curInitTime || 0) + (initEnd - initStart);
9592
9713
  }
9593
9714
  }
9594
- if (err) {
9595
- throw err;
9715
+ if (errorToThrow) {
9716
+ throw errorToThrow;
9596
9717
  }
9597
9718
  },
9598
9719
 
@@ -9603,10 +9724,13 @@ var Mixin = {
9603
9724
  * invoked).
9604
9725
  */
9605
9726
  closeAll: function() {
9606
- throwIf(!this.isInTransaction(), MISSING_TRANSACTION);
9727
+ invariant(
9728
+ this.isInTransaction(),
9729
+ 'Transaction.closeAll(): Cannot close transaction when none are open.'
9730
+ );
9607
9731
  var transactionWrappers = this.transactionWrappers;
9608
9732
  var wrapperCloseTimes = this.timingMetrics.wrapperCloseTimes;
9609
- var err = null;
9733
+ var errorToThrow = null;
9610
9734
  for (var i = 0; i < transactionWrappers.length; i++) {
9611
9735
  var wrapper = transactionWrappers[i];
9612
9736
  var closeStart = Date.now();
@@ -9615,8 +9739,9 @@ var Mixin = {
9615
9739
  if (initData !== Transaction.OBSERVED_ERROR) {
9616
9740
  wrapper.close && wrapper.close.call(this, initData);
9617
9741
  }
9618
- } catch (closeErr) {
9619
- err = err || closeErr; // Remember the first error.
9742
+ } catch (closeError) {
9743
+ // Prefer to show the stack trace of the first error.
9744
+ errorToThrow = errorToThrow || closeError;
9620
9745
  } finally {
9621
9746
  var closeEnd = Date.now();
9622
9747
  var curCloseTime = wrapperCloseTimes[i];
@@ -9625,14 +9750,16 @@ var Mixin = {
9625
9750
  }
9626
9751
  this.wrapperInitData.length = 0;
9627
9752
  this._isInTransaction = false;
9628
- if (err) {
9629
- throw err;
9753
+ if (errorToThrow) {
9754
+ throw errorToThrow;
9630
9755
  }
9631
9756
  }
9632
9757
  };
9633
9758
 
9634
9759
  var Transaction = {
9760
+
9635
9761
  Mixin: Mixin,
9762
+
9636
9763
  /**
9637
9764
  * Token to look for to determine if an error occured.
9638
9765
  */
@@ -9643,7 +9770,7 @@ var Transaction = {
9643
9770
  module.exports = Transaction;
9644
9771
 
9645
9772
  })()
9646
- },{"./throwIf":86}],59:[function(require,module,exports){
9773
+ },{"./invariant":78}],60:[function(require,module,exports){
9647
9774
  /**
9648
9775
  * Copyright 2013 Facebook, Inc.
9649
9776
  *
@@ -9681,7 +9808,7 @@ var ViewportMetrics = {
9681
9808
 
9682
9809
  module.exports = ViewportMetrics;
9683
9810
 
9684
- },{}],60:[function(require,module,exports){
9811
+ },{}],61:[function(require,module,exports){
9685
9812
  /**
9686
9813
  * Copyright 2013 Facebook, Inc.
9687
9814
  *
@@ -9702,50 +9829,34 @@ module.exports = ViewportMetrics;
9702
9829
 
9703
9830
  "use strict";
9704
9831
 
9705
- var throwIf = require("./throwIf");
9706
-
9707
- var INVALID_ARGS = 'INVALID_ACCUM_ARGS';
9708
-
9709
- if (true) {
9710
- INVALID_ARGS =
9711
- 'accumulate requires non empty (non-null, defined) next ' +
9712
- 'values. All arrays accumulated must not contain any empty items.';
9713
- }
9832
+ var invariant = require("./invariant");
9714
9833
 
9715
9834
  /**
9716
- * Accumulates items that must never be empty, into a result in a manner that
9717
- * conserves memory - avoiding allocation of arrays until they are needed. The
9718
- * accumulation may start and/or end up being a single element or an array
9719
- * depending on the total count (if greater than one, an array is allocated).
9720
- * Handles most common case first (starting with an empty current value and
9721
- * acquiring one).
9722
- * @return {Accumulation} An accumulation which is either a single item or an
9723
- * Array of items.
9835
+ * Accumulates items that must not be null or undefined.
9836
+ *
9837
+ * This is used to conserve memory by avoiding array allocations.
9838
+ *
9839
+ * @return {*|array<*>} An accumulation of items.
9724
9840
  */
9725
- function accumulate(cur, next) {
9726
- var curValIsEmpty = cur == null; // Will test for emptiness (null/undef)
9727
- var nextValIsEmpty = next === null;
9728
- if (true) {
9729
- throwIf(nextValIsEmpty, INVALID_ARGS);
9730
- }
9731
- if (nextValIsEmpty) {
9732
- return cur;
9841
+ function accumulate(current, next) {
9842
+ invariant(
9843
+ next != null,
9844
+ 'accumulate(...): Accumulated items must be not be null or undefined.'
9845
+ );
9846
+ if (current == null) {
9847
+ return next;
9733
9848
  } else {
9734
- if (curValIsEmpty) {
9735
- return next;
9849
+ // Both are not empty. Warning: Never call x.concat(y) when you are not
9850
+ // certain that x is an Array (x could be a string with concat method).
9851
+ var currentIsArray = Array.isArray(current);
9852
+ var nextIsArray = Array.isArray(next);
9853
+ if (currentIsArray) {
9854
+ return current.concat(next);
9736
9855
  } else {
9737
- // Both are not empty. Warning: Never call x.concat(y) when you are not
9738
- // certain that x is an Array (x could be a string with concat method).
9739
- var curIsArray = Array.isArray(cur);
9740
- var nextIsArray = Array.isArray(next);
9741
- if (curIsArray) {
9742
- return cur.concat(next);
9856
+ if (nextIsArray) {
9857
+ return [current].concat(next);
9743
9858
  } else {
9744
- if (nextIsArray) {
9745
- return [cur].concat(next);
9746
- } else {
9747
- return [cur, next];
9748
- }
9859
+ return [current, next];
9749
9860
  }
9750
9861
  }
9751
9862
  }
@@ -9753,7 +9864,46 @@ function accumulate(cur, next) {
9753
9864
 
9754
9865
  module.exports = accumulate;
9755
9866
 
9756
- },{"./throwIf":86}],61:[function(require,module,exports){
9867
+ },{"./invariant":78}],62:[function(require,module,exports){
9868
+ /**
9869
+ * Copyright 2013 Facebook, Inc.
9870
+ *
9871
+ * Licensed under the Apache License, Version 2.0 (the "License");
9872
+ * you may not use this file except in compliance with the License.
9873
+ * You may obtain a copy of the License at
9874
+ *
9875
+ * http://www.apache.org/licenses/LICENSE-2.0
9876
+ *
9877
+ * Unless required by applicable law or agreed to in writing, software
9878
+ * distributed under the License is distributed on an "AS IS" BASIS,
9879
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9880
+ * See the License for the specific language governing permissions and
9881
+ * limitations under the License.
9882
+ *
9883
+ * @providesModule adler32
9884
+ */
9885
+
9886
+ "use strict";
9887
+
9888
+ var MOD = 65521;
9889
+
9890
+ // This is a clean-room implementation of adler32 designed for detecting
9891
+ // if markup is not what we expect it to be. It does not need to be
9892
+ // cryptographically strong, only reasonable good at detecting if markup
9893
+ // generated on the server is different than that on the client.
9894
+ function adler32(data) {
9895
+ var a = 1;
9896
+ var b = 0;
9897
+ for (var i = 0; i < data.length; i++) {
9898
+ a = (a + data.charCodeAt(i)) % MOD;
9899
+ b = (b + a) % MOD;
9900
+ }
9901
+ return a | (b << 16);
9902
+ }
9903
+
9904
+ module.exports = adler32;
9905
+
9906
+ },{}],63:[function(require,module,exports){
9757
9907
  /**
9758
9908
  * Copyright 2013 Facebook, Inc.
9759
9909
  *
@@ -9809,7 +9959,7 @@ function copyProperties(obj, a, b, c, d, e, f) {
9809
9959
 
9810
9960
  module.exports = copyProperties;
9811
9961
 
9812
- },{}],62:[function(require,module,exports){
9962
+ },{}],64:[function(require,module,exports){
9813
9963
  /**
9814
9964
  * Copyright 2013 Facebook, Inc.
9815
9965
  *
@@ -9874,7 +10024,7 @@ function createObjectFrom(keys, values /* = true */) {
9874
10024
 
9875
10025
  module.exports = createObjectFrom;
9876
10026
 
9877
- },{"./hasArrayNature":72}],63:[function(require,module,exports){
10027
+ },{"./hasArrayNature":75}],65:[function(require,module,exports){
9878
10028
  /**
9879
10029
  * Copyright 2013 Facebook, Inc.
9880
10030
  *
@@ -9933,7 +10083,7 @@ function dangerousStyleValue(styleName, value) {
9933
10083
 
9934
10084
  module.exports = dangerousStyleValue;
9935
10085
 
9936
- },{"./CSSProperty":2}],64:[function(require,module,exports){
10086
+ },{"./CSSProperty":2}],66:[function(require,module,exports){
9937
10087
  /**
9938
10088
  * Copyright 2013 Facebook, Inc.
9939
10089
  *
@@ -9978,7 +10128,7 @@ copyProperties(emptyFunction, {
9978
10128
 
9979
10129
  module.exports = emptyFunction;
9980
10130
 
9981
- },{"./copyProperties":61}],65:[function(require,module,exports){
10131
+ },{"./copyProperties":63}],67:[function(require,module,exports){
9982
10132
  /**
9983
10133
  * Copyright 2013 Facebook, Inc.
9984
10134
  *
@@ -9995,19 +10145,12 @@ module.exports = emptyFunction;
9995
10145
  * limitations under the License.
9996
10146
  *
9997
10147
  * @providesModule escapeTextForBrowser
10148
+ * @typechecks static-only
9998
10149
  */
9999
10150
 
10000
10151
  "use strict";
10001
10152
 
10002
- var throwIf = require("./throwIf");
10003
-
10004
- var ESCAPE_TYPE_ERR;
10005
-
10006
- if (true) {
10007
- ESCAPE_TYPE_ERR =
10008
- 'The React core has attempted to escape content that is of a ' +
10009
- 'mysterious type (object etc) Escaping only works on numbers and strings';
10010
- }
10153
+ var invariant = require("./invariant");
10011
10154
 
10012
10155
  var ESCAPE_LOOKUP = {
10013
10156
  "&": "&amp;",
@@ -10022,13 +10165,19 @@ function escaper(match) {
10022
10165
  return ESCAPE_LOOKUP[match];
10023
10166
  }
10024
10167
 
10025
- var escapeTextForBrowser = function (text) {
10168
+ /**
10169
+ * Escapes text to prevent scripting attacks.
10170
+ *
10171
+ * @param {number|string} text Text value to escape.
10172
+ * @return {string} An escaped string.
10173
+ */
10174
+ function escapeTextForBrowser(text) {
10026
10175
  var type = typeof text;
10027
- var invalid = type === 'object';
10028
- if (true) {
10029
- throwIf(invalid, ESCAPE_TYPE_ERR);
10030
- }
10031
- if (text === '' || invalid) {
10176
+ invariant(
10177
+ type !== 'object',
10178
+ 'escapeTextForBrowser(...): Attempted to escape an object.'
10179
+ );
10180
+ if (text === '') {
10032
10181
  return '';
10033
10182
  } else {
10034
10183
  if (type === 'string') {
@@ -10037,11 +10186,11 @@ var escapeTextForBrowser = function (text) {
10037
10186
  return (''+text).replace(/[&><"'\/]/g, escaper);
10038
10187
  }
10039
10188
  }
10040
- };
10189
+ }
10041
10190
 
10042
10191
  module.exports = escapeTextForBrowser;
10043
10192
 
10044
- },{"./throwIf":86}],66:[function(require,module,exports){
10193
+ },{"./invariant":78}],68:[function(require,module,exports){
10045
10194
  /**
10046
10195
  * Copyright 2013 Facebook, Inc.
10047
10196
  *
@@ -10092,7 +10241,7 @@ ex._suffix = ']]>';
10092
10241
 
10093
10242
  module.exports = ex;
10094
10243
 
10095
- },{}],67:[function(require,module,exports){
10244
+ },{}],69:[function(require,module,exports){
10096
10245
  /**
10097
10246
  * Copyright 2013 Facebook, Inc.
10098
10247
  *
@@ -10113,7 +10262,7 @@ module.exports = ex;
10113
10262
 
10114
10263
  "use strict";
10115
10264
 
10116
- var throwIf = require("./throwIf");
10265
+ var invariant = require("./invariant");
10117
10266
  var traverseAllChildren = require("./traverseAllChildren");
10118
10267
 
10119
10268
  /**
@@ -10122,14 +10271,14 @@ var traverseAllChildren = require("./traverseAllChildren");
10122
10271
  * @param {!string} name String name of key path to child.
10123
10272
  */
10124
10273
  function flattenSingleChildIntoContext(traverseContext, child, name) {
10125
- // We found a component instance
10274
+ // We found a component instance.
10126
10275
  var result = traverseContext;
10127
- if (true) {
10128
- throwIf(
10129
- result.hasOwnProperty(name),
10130
- traverseAllChildren.DUPLICATE_KEY_ERROR
10131
- );
10132
- }
10276
+ invariant(
10277
+ !result.hasOwnProperty(name),
10278
+ 'flattenChildren(...): Encountered two children with the same key, `%s`. ' +
10279
+ 'Children keys must be unique.',
10280
+ name
10281
+ );
10133
10282
  result[name] = child;
10134
10283
  }
10135
10284
 
@@ -10138,7 +10287,7 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
10138
10287
  * @return {!object} flattened children keyed by name.
10139
10288
  */
10140
10289
  function flattenChildren(children) {
10141
- if (children === null || children === undefined) {
10290
+ if (children == null) {
10142
10291
  return children;
10143
10292
  }
10144
10293
  var result = {};
@@ -10148,7 +10297,7 @@ function flattenChildren(children) {
10148
10297
 
10149
10298
  module.exports = flattenChildren;
10150
10299
 
10151
- },{"./throwIf":86,"./traverseAllChildren":87}],68:[function(require,module,exports){
10300
+ },{"./invariant":78,"./traverseAllChildren":90}],70:[function(require,module,exports){
10152
10301
  /**
10153
10302
  * Copyright 2013 Facebook, Inc.
10154
10303
  *
@@ -10186,7 +10335,7 @@ var forEachAccumulated = function(arr, cb, scope) {
10186
10335
 
10187
10336
  module.exports = forEachAccumulated;
10188
10337
 
10189
- },{}],69:[function(require,module,exports){
10338
+ },{}],71:[function(require,module,exports){
10190
10339
  /**
10191
10340
  * Copyright 2013 Facebook, Inc.
10192
10341
  *
@@ -10264,7 +10413,7 @@ function _getNodeID(node) {
10264
10413
 
10265
10414
  module.exports = ge;
10266
10415
 
10267
- },{}],70:[function(require,module,exports){
10416
+ },{}],72:[function(require,module,exports){
10268
10417
  (function(){/**
10269
10418
  * Copyright 2013 Facebook, Inc.
10270
10419
  *
@@ -10308,7 +10457,38 @@ function getEventTarget(nativeEvent) {
10308
10457
  module.exports = getEventTarget;
10309
10458
 
10310
10459
  })()
10311
- },{"./ExecutionEnvironment":19}],71:[function(require,module,exports){
10460
+ },{"./ExecutionEnvironment":19}],73:[function(require,module,exports){
10461
+ /**
10462
+ * Copyright 2013 Facebook, Inc.
10463
+ *
10464
+ * Licensed under the Apache License, Version 2.0 (the "License");
10465
+ * you may not use this file except in compliance with the License.
10466
+ * You may obtain a copy of the License at
10467
+ *
10468
+ * http://www.apache.org/licenses/LICENSE-2.0
10469
+ *
10470
+ * Unless required by applicable law or agreed to in writing, software
10471
+ * distributed under the License is distributed on an "AS IS" BASIS,
10472
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10473
+ * See the License for the specific language governing permissions and
10474
+ * limitations under the License.
10475
+ *
10476
+ * @providesModule getReactRootElementInContainer
10477
+ */
10478
+
10479
+ "use strict";
10480
+
10481
+ /**
10482
+ * @param {DOMElement} container DOM element that may contain a React component
10483
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
10484
+ */
10485
+ function getReactRootElementInContainer(container) {
10486
+ return container && container.firstChild;
10487
+ }
10488
+
10489
+ module.exports = getReactRootElementInContainer;
10490
+
10491
+ },{}],74:[function(require,module,exports){
10312
10492
  /**
10313
10493
  * Copyright 2013 Facebook, Inc.
10314
10494
  *
@@ -10350,7 +10530,7 @@ function getTextContentAccessor() {
10350
10530
 
10351
10531
  module.exports = getTextContentAccessor;
10352
10532
 
10353
- },{"./ExecutionEnvironment":19}],72:[function(require,module,exports){
10533
+ },{"./ExecutionEnvironment":19}],75:[function(require,module,exports){
10354
10534
  /**
10355
10535
  * Copyright 2013 Facebook, Inc.
10356
10536
  *
@@ -10407,7 +10587,7 @@ function hasArrayNature(obj) {
10407
10587
 
10408
10588
  module.exports = hasArrayNature;
10409
10589
 
10410
- },{}],73:[function(require,module,exports){
10590
+ },{}],76:[function(require,module,exports){
10411
10591
  /**
10412
10592
  * Copyright 2013 Facebook, Inc.
10413
10593
  *
@@ -10444,7 +10624,7 @@ function hyphenate(string) {
10444
10624
 
10445
10625
  module.exports = hyphenate;
10446
10626
 
10447
- },{}],74:[function(require,module,exports){
10627
+ },{}],77:[function(require,module,exports){
10448
10628
  /**
10449
10629
  * Copyright 2013 Facebook, Inc.
10450
10630
  *
@@ -10492,7 +10672,7 @@ function insertNodeAt(root, node, atIndex) {
10492
10672
 
10493
10673
  module.exports = insertNodeAt;
10494
10674
 
10495
- },{}],75:[function(require,module,exports){
10675
+ },{}],78:[function(require,module,exports){
10496
10676
  /**
10497
10677
  * Copyright 2013 Facebook, Inc.
10498
10678
  *
@@ -10548,7 +10728,7 @@ if (true) {
10548
10728
  module.exports = invariantDev;
10549
10729
  }
10550
10730
 
10551
- },{}],76:[function(require,module,exports){
10731
+ },{}],79:[function(require,module,exports){
10552
10732
  /**
10553
10733
  * Copyright 2013 Facebook, Inc.
10554
10734
  *
@@ -10624,7 +10804,7 @@ function isEventSupported(eventNameSuffix, capture) {
10624
10804
 
10625
10805
  module.exports = isEventSupported;
10626
10806
 
10627
- },{"./ExecutionEnvironment":19}],77:[function(require,module,exports){
10807
+ },{"./ExecutionEnvironment":19}],80:[function(require,module,exports){
10628
10808
  /**
10629
10809
  * Copyright 2013 Facebook, Inc.
10630
10810
  *
@@ -10670,7 +10850,7 @@ function joinClasses(className/*, ... */) {
10670
10850
 
10671
10851
  module.exports = joinClasses;
10672
10852
 
10673
- },{}],78:[function(require,module,exports){
10853
+ },{}],81:[function(require,module,exports){
10674
10854
  /**
10675
10855
  * Copyright 2013 Facebook, Inc.
10676
10856
  *
@@ -10687,36 +10867,38 @@ module.exports = joinClasses;
10687
10867
  * limitations under the License.
10688
10868
  *
10689
10869
  * @providesModule keyMirror
10870
+ * @typechecks static-only
10690
10871
  */
10691
10872
 
10692
10873
  "use strict";
10693
10874
 
10694
- var throwIf = require("./throwIf");
10695
-
10696
- var NOT_OBJECT_ERROR = 'NOT_OBJECT_ERROR';
10697
- if (true) {
10698
- NOT_OBJECT_ERROR = 'keyMirror only works on objects';
10699
- }
10875
+ var invariant = require("./invariant");
10700
10876
 
10701
10877
  /**
10702
- * Utility for constructing enums with keys being equal to the associated
10703
- * values, even when using advanced key crushing. This is useful for debugging,
10704
- * but also for using the values themselves as lookups into the enum.
10705
- * Example:
10706
- * var COLORS = keyMirror({blue: null, red: null});
10707
- * var myColor = COLORS.blue;
10708
- * var isColorValid = !!COLORS[myColor]
10878
+ * Constructs an enumeration with keys equal to their value.
10879
+ *
10880
+ * For example:
10881
+ *
10882
+ * var COLORS = keyMirror({blue: null, red: null});
10883
+ * var myColor = COLORS.blue;
10884
+ * var isColorValid = !!COLORS[myColor];
10885
+ *
10709
10886
  * The last line could not be performed if the values of the generated enum were
10710
10887
  * not equal to their keys.
10711
- * Input: {key1: val1, key2: val2}
10712
- * Output: {key1: key1, key2: key2}
10888
+ *
10889
+ * Input: {key1: val1, key2: val2}
10890
+ * Output: {key1: key1, key2: key2}
10891
+ *
10892
+ * @param {object} obj
10893
+ * @return {object}
10713
10894
  */
10714
10895
  var keyMirror = function(obj) {
10715
10896
  var ret = {};
10716
10897
  var key;
10717
-
10718
- throwIf(!(obj instanceof Object) || Array.isArray(obj), NOT_OBJECT_ERROR);
10719
-
10898
+ invariant(
10899
+ obj instanceof Object && !Array.isArray(obj),
10900
+ 'keyMirror(...): Argument must be an object.'
10901
+ );
10720
10902
  for (key in obj) {
10721
10903
  if (!obj.hasOwnProperty(key)) {
10722
10904
  continue;
@@ -10728,7 +10910,7 @@ var keyMirror = function(obj) {
10728
10910
 
10729
10911
  module.exports = keyMirror;
10730
10912
 
10731
- },{"./throwIf":86}],79:[function(require,module,exports){
10913
+ },{"./invariant":78}],82:[function(require,module,exports){
10732
10914
  /**
10733
10915
  * Copyright 2013 Facebook, Inc.
10734
10916
  *
@@ -10771,7 +10953,7 @@ var keyOf = function(oneKeyObj) {
10771
10953
 
10772
10954
  module.exports = keyOf;
10773
10955
 
10774
- },{}],80:[function(require,module,exports){
10956
+ },{}],83:[function(require,module,exports){
10775
10957
  /**
10776
10958
  * Copyright 2013 Facebook, Inc.
10777
10959
  *
@@ -10812,7 +10994,7 @@ function memoizeStringOnly(callback) {
10812
10994
 
10813
10995
  module.exports = memoizeStringOnly;
10814
10996
 
10815
- },{}],81:[function(require,module,exports){
10997
+ },{}],84:[function(require,module,exports){
10816
10998
  /**
10817
10999
  * Copyright 2013 Facebook, Inc.
10818
11000
  *
@@ -10851,7 +11033,7 @@ var merge = function(one, two) {
10851
11033
 
10852
11034
  module.exports = merge;
10853
11035
 
10854
- },{"./mergeInto":83}],82:[function(require,module,exports){
11036
+ },{"./mergeInto":86}],85:[function(require,module,exports){
10855
11037
  /**
10856
11038
  * Copyright 2013 Facebook, Inc.
10857
11039
  *
@@ -10874,8 +11056,8 @@ module.exports = merge;
10874
11056
 
10875
11057
  "use strict";
10876
11058
 
11059
+ var invariant = require("./invariant");
10877
11060
  var keyMirror = require("./keyMirror");
10878
- var throwIf = require("./throwIf");
10879
11061
 
10880
11062
  /**
10881
11063
  * Maximum number of levels to traverse. Will catch circular structures.
@@ -10883,41 +11065,6 @@ var throwIf = require("./throwIf");
10883
11065
  */
10884
11066
  var MAX_MERGE_DEPTH = 36;
10885
11067
 
10886
- var ERRORS = keyMirror({
10887
- MERGE_ARRAY_FAIL: null,
10888
- MERGE_CORE_FAILURE: null,
10889
- MERGE_TYPE_USAGE_FAILURE: null,
10890
- MERGE_DEEP_MAX_LEVELS: null,
10891
- MERGE_DEEP_NO_ARR_STRATEGY: null
10892
- });
10893
-
10894
- if (true) {
10895
- ERRORS = {
10896
- MERGE_ARRAY_FAIL:
10897
- 'Unsupported type passed to a merge function. You may have passed a ' +
10898
- 'structure that contains an array and the merge function does not know ' +
10899
- 'how to merge arrays. ',
10900
-
10901
- MERGE_CORE_FAILURE:
10902
- 'Critical assumptions about the merge functions have been violated. ' +
10903
- 'This is the fault of the merge functions themselves, not necessarily ' +
10904
- 'the callers.',
10905
-
10906
- MERGE_TYPE_USAGE_FAILURE:
10907
- 'Calling merge function with invalid types. You may call merge ' +
10908
- 'functions (non-array non-terminal) OR (null/undefined) arguments. ' +
10909
- 'mergeInto functions have the same requirements but with an added ' +
10910
- 'restriction that the first parameter must not be null/undefined.',
10911
-
10912
- MERGE_DEEP_MAX_LEVELS:
10913
- 'Maximum deep merge depth exceeded. You may attempting to merge ' +
10914
- 'circular structures in an unsupported way.',
10915
- MERGE_DEEP_NO_ARR_STRATEGY:
10916
- 'You must provide an array strategy to deep merge functions to ' +
10917
- 'instruct the deep merge how to resolve merging two arrays.'
10918
- };
10919
- }
10920
-
10921
11068
  /**
10922
11069
  * We won't worry about edge cases like new String('x') or new Boolean(true).
10923
11070
  * Functions are considered terminals, and arrays are not.
@@ -10953,9 +11100,11 @@ var mergeHelpers = {
10953
11100
  * @param {*} two Array to merge from.
10954
11101
  */
10955
11102
  checkMergeArrayArgs: function(one, two) {
10956
- throwIf(
10957
- !Array.isArray(one) || !Array.isArray(two),
10958
- ERRORS.MERGE_CORE_FAILURE
11103
+ invariant(
11104
+ Array.isArray(one) && Array.isArray(two),
11105
+ 'Critical assumptions about the merge functions have been violated. ' +
11106
+ 'This is the fault of the merge functions themselves, not necessarily ' +
11107
+ 'the callers.'
10959
11108
  );
10960
11109
  },
10961
11110
 
@@ -10972,7 +11121,12 @@ var mergeHelpers = {
10972
11121
  * @param {*} arg
10973
11122
  */
10974
11123
  checkMergeObjectArg: function(arg) {
10975
- throwIf(isTerminal(arg) || Array.isArray(arg), ERRORS.MERGE_CORE_FAILURE);
11124
+ invariant(
11125
+ !isTerminal(arg) && !Array.isArray(arg),
11126
+ 'Critical assumptions about the merge functions have been violated. ' +
11127
+ 'This is the fault of the merge functions themselves, not necessarily ' +
11128
+ 'the callers.'
11129
+ );
10976
11130
  },
10977
11131
 
10978
11132
  /**
@@ -10982,19 +11136,23 @@ var mergeHelpers = {
10982
11136
  * @param {number} Level of recursion to validate against maximum.
10983
11137
  */
10984
11138
  checkMergeLevel: function(level) {
10985
- throwIf(level >= MAX_MERGE_DEPTH, ERRORS.MERGE_DEEP_MAX_LEVELS);
11139
+ invariant(
11140
+ level < MAX_MERGE_DEPTH,
11141
+ 'Maximum deep merge depth exceeded. You may be attempting to merge ' +
11142
+ 'circular structures in an unsupported way.'
11143
+ );
10986
11144
  },
10987
11145
 
10988
11146
  /**
10989
- * Checks that a merge was not given a circular object or an object that had
10990
- * too great of depth.
11147
+ * Checks that the supplied merge strategy is valid.
10991
11148
  *
10992
- * @param {number} Level of recursion to validate against maximum.
11149
+ * @param {string} Array merge strategy.
10993
11150
  */
10994
11151
  checkArrayStrategy: function(strategy) {
10995
- throwIf(
10996
- strategy !== undefined && !(strategy in mergeHelpers.ArrayStrategies),
10997
- ERRORS.MERGE_DEEP_NO_ARR_STRATEGY
11152
+ invariant(
11153
+ strategy === undefined || strategy in mergeHelpers.ArrayStrategies,
11154
+ 'You must provide an array strategy to deep merge functions to ' +
11155
+ 'instruct the deep merge how to resolve merging two arrays.'
10998
11156
  );
10999
11157
  },
11000
11158
 
@@ -11008,14 +11166,13 @@ var mergeHelpers = {
11008
11166
  ArrayStrategies: keyMirror({
11009
11167
  Clobber: true,
11010
11168
  IndexByIndex: true
11011
- }),
11169
+ })
11012
11170
 
11013
- ERRORS: ERRORS
11014
11171
  };
11015
11172
 
11016
11173
  module.exports = mergeHelpers;
11017
11174
 
11018
- },{"./keyMirror":78,"./throwIf":86}],83:[function(require,module,exports){
11175
+ },{"./invariant":78,"./keyMirror":81}],86:[function(require,module,exports){
11019
11176
  /**
11020
11177
  * Copyright 2013 Facebook, Inc.
11021
11178
  *
@@ -11062,7 +11219,7 @@ function mergeInto(one, two) {
11062
11219
 
11063
11220
  module.exports = mergeInto;
11064
11221
 
11065
- },{"./mergeHelpers":82}],84:[function(require,module,exports){
11222
+ },{"./mergeHelpers":85}],87:[function(require,module,exports){
11066
11223
  /**
11067
11224
  * Copyright 2013 Facebook, Inc.
11068
11225
  *
@@ -11098,7 +11255,7 @@ var mixInto = function(constructor, methodBag) {
11098
11255
 
11099
11256
  module.exports = mixInto;
11100
11257
 
11101
- },{}],85:[function(require,module,exports){
11258
+ },{}],88:[function(require,module,exports){
11102
11259
  /**
11103
11260
  * Copyright 2013 Facebook, Inc.
11104
11261
  *
@@ -11147,7 +11304,7 @@ function objMapKeyVal(obj, func, context) {
11147
11304
 
11148
11305
  module.exports = objMapKeyVal;
11149
11306
 
11150
- },{}],86:[function(require,module,exports){
11307
+ },{}],89:[function(require,module,exports){
11151
11308
  /**
11152
11309
  * Copyright 2013 Facebook, Inc.
11153
11310
  *
@@ -11176,7 +11333,7 @@ var throwIf = function(condition, err) {
11176
11333
 
11177
11334
  module.exports = throwIf;
11178
11335
 
11179
- },{}],87:[function(require,module,exports){
11336
+ },{}],90:[function(require,module,exports){
11180
11337
  (function(){/**
11181
11338
  * Copyright 2013 Facebook, Inc.
11182
11339
  *
@@ -11200,22 +11357,7 @@ module.exports = throwIf;
11200
11357
  var ReactComponent = require("./ReactComponent");
11201
11358
  var ReactTextComponent = require("./ReactTextComponent");
11202
11359
 
11203
- var throwIf = require("./throwIf");
11204
-
11205
- /**
11206
- * @polyFill Array.isArray
11207
- */
11208
- var DUPLICATE_KEY_ERROR = 'DUPLICATE_KEY_ERROR';
11209
- var INVALID_CHILD = 'INVALID_CHILD';
11210
- if (true) {
11211
- INVALID_CHILD =
11212
- 'You may not pass a child of that type to a React component. It ' +
11213
- 'is a common mistake to try to pass a standard browser DOM element ' +
11214
- 'as a child of a React component.';
11215
- DUPLICATE_KEY_ERROR =
11216
- 'You have two children with identical keys. Make sure that you set the ' +
11217
- '"key" property to a unique value such as a row ID.';
11218
- }
11360
+ var invariant = require("./invariant");
11219
11361
 
11220
11362
  /**
11221
11363
  * TODO: Test that:
@@ -11267,7 +11409,11 @@ var traverseAllChildrenImpl =
11267
11409
  subtreeCount = 1;
11268
11410
  } else {
11269
11411
  if (type === 'object') {
11270
- throwIf(children && children.nodeType === 1, INVALID_CHILD);
11412
+ invariant(
11413
+ children || children.nodeType !== 1,
11414
+ 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
11415
+ 'elements are not valid children of React components.'
11416
+ );
11271
11417
  for (var key in children) {
11272
11418
  if (children.hasOwnProperty(key)) {
11273
11419
  subtreeCount += traverseAllChildrenImpl(
@@ -11314,15 +11460,9 @@ function traverseAllChildren(children, callback, traverseContext) {
11314
11460
  }
11315
11461
  }
11316
11462
 
11317
- /**
11318
- * Export the error code for use in other walking/mapping code.
11319
- */
11320
- traverseAllChildren.DUPLICATE_KEY_ERROR = DUPLICATE_KEY_ERROR;
11321
-
11322
-
11323
11463
  module.exports = traverseAllChildren;
11324
11464
 
11325
11465
  })()
11326
- },{"./ReactComponent":22,"./ReactTextComponent":47,"./throwIf":86}]},{},[21])(21)
11466
+ },{"./ReactComponent":23,"./ReactTextComponent":48,"./invariant":78}]},{},[22])(22)
11327
11467
  });
11328
11468
  ;