Files
react/build/react-test.js
T
2013-11-06 15:30:49 -05:00

267 lines
998 KiB
JavaScript

//# sourceURL=populist/loader.js
(function(entries, sources) {
var modules = {};
var hasOwn = modules.hasOwnProperty;
var global = Function("return this")();
var doc = global.document;
var head = doc.documentElement.firstChild;
function internalRequire(id) {
var module = getModule(id);
if (module && !hasOwn.call(module, "exports")) {
module(function(rid) {
return internalRequire(absolutize(id, rid));
}, module.exports = {}, module, global);
// If the module id has a non-null value in the entries object,
// define a global reference to its exports object.
var globalName = entries[id];
if (globalName && hasOwn.call(entries, id))
global[globalName] = module.exports;
}
return module.exports;
}
function getModule(id) {
if (!hasOwn.call(modules, id)) {
if (hasOwn.call(sources, id)) {
var name = "module$" + Math.random().toString(36).slice(2);
var script = doc.createElement("script");
var code = "function " + name + "(require,exports,module,global){" +
sources[id] + "\n}\n//# sourceURL=" + id + ".js\n";
script.setAttribute("type", "text/javascript");
script.setAttribute("encoding", "utf8");
script.appendChild(doc.createTextNode(code));
head.appendChild(script);
modules[id] = global[name];
} else {
throw new Error("Missing module: " + id);
}
}
return modules[id];
}
var pathNormExp = /\/(\.?|[^\/]+\/\.\.)\//;
function absolutize(id, rid) {
if (rid.charAt(0) === ".") {
rid = "/" + id + "/../" + rid;
while (rid != (id = rid.replace(pathNormExp, "/")))
rid = id;
rid = rid.replace(/^\//, "");
}
return rid;
}
// Eagerly require all identifiers that are keys of the entries object.
for (var id in entries)
if (hasOwn.call(entries, id))
internalRequire(id);
})({"test/all":"harness"},{
"test/all":"// This file exists both to give a single entry point for all the utility\n// modules in src/test and to specify an ordering on those modules, since\n// some still have implicit dependencies on others.\n\nrequire(\"./phantomjs-shims\");\nrequire(\"../ReactTestUtils\");\nrequire(\"../reactComponentExpect\");\nrequire(\"../mocks\");\nrequire(\"../mock-modules\");\nrequire(\"./mock-timers\");\n\nexports.enableTest = function(testID) {\n require(\"../\" + testID);\n};\n\nexports.removeNextSiblings = function(node) {\n var parent = node && node.parentNode;\n if (parent) {\n while (node.nextSibling) {\n parent.removeChild(node.nextSibling);\n }\n }\n};\n",
"addons/link/__tests__/LinkedStateMixin-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\n/*jshint evil:true */\n\ndescribe('LinkedStateMixin', function() {\n var LinkedStateMixin;\n var React;\n var ReactLink;\n\n beforeEach(function() {\n LinkedStateMixin = require(\"../../../LinkedStateMixin\");\n React = require(\"../../../React\");\n ReactLink = require(\"../../../ReactLink\");\n });\n\n it('should create a ReactLink for state', function() {\n var Component = React.createClass({displayName: 'Component',\n mixins: [LinkedStateMixin],\n\n getInitialState: function() {\n return {value: 'initial value'};\n },\n\n render: function() {\n return React.DOM.span(null, \"value is \", this.state.value);\n }\n });\n var container = document.createElement('div');\n var component = React.renderComponent(Component(null ), container);\n var link = component.linkState('value');\n expect(component.state.value).toBe('initial value');\n expect(link.value).toBe('initial value');\n link.requestChange('new value');\n expect(component.state.value).toBe('new value');\n expect(component.linkState('value').value).toBe('new value');\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"addons/link/__tests__/LinkedStateMixin-test\", module);\n",
"addons/transitions/__tests__/ReactTransitionGroup-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTransitionGroup;\nvar mocks;\n\n// Most of the real functionality is covered in other unit tests, this just\n// makes sure we're wired up correctly.\ndescribe('ReactTransitionGroup', function() {\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactTransitionGroup = require(\"../../../ReactTransitionGroup\");\n mocks = require(\"../../../mocks\");\n });\n\n it('should warn after time with no transitionend', function() {\n var container;\n var a;\n\n container = document.createElement('div');\n a = React.renderComponent(\n ReactTransitionGroup( {transitionName:\"yolo\"}, \n React.DOM.span( {key:\"one\", id:\"one\"} )\n ),\n container\n );\n expect(a.getDOMNode().childNodes.length).toBe(1);\n\n setTimeout.mock.calls.length = 0;\n\n React.renderComponent(\n ReactTransitionGroup( {transitionName:\"yolo\"}, \n React.DOM.span( {key:\"two\", id:\"two\"} )\n ),\n container\n );\n expect(a.getDOMNode().childNodes.length).toBe(2);\n expect(a.getDOMNode().childNodes[0].id).toBe('two');\n expect(a.getDOMNode().childNodes[1].id).toBe('one');\n\n console.warn = mocks.getMockFunction();\n setTimeout.mock.calls[2][0]();\n\n expect(a.getDOMNode().childNodes.length).toBe(2);\n expect(console.warn.mock.calls.length).toBe(1);\n });\n\n it('should keep both sets of DOM nodes around', function() {\n var container = document.createElement('div');\n var a = React.renderComponent(\n ReactTransitionGroup( {transitionName:\"yolo\"}, \n React.DOM.span( {key:\"one\", id:\"one\"} )\n ),\n container\n );\n expect(a.getDOMNode().childNodes.length).toBe(1);\n React.renderComponent(\n ReactTransitionGroup( {transitionName:\"yolo\"}, \n React.DOM.span( {key:\"two\", id:\"two\"} )\n ),\n container\n );\n expect(a.getDOMNode().childNodes.length).toBe(2);\n expect(a.getDOMNode().childNodes[0].id).toBe('two');\n expect(a.getDOMNode().childNodes[1].id).toBe('one');\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"addons/transitions/__tests__/ReactTransitionGroup-test\", module);\n",
"addons/transitions/__tests__/ReactTransitionKeySet-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTransitionKeySet;\n\ndescribe('ReactTransitionKeySet', function() {\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactTransitionKeySet = require(\"../../../ReactTransitionKeySet\");\n });\n\n it('should support getChildMapping', function() {\n var oneone = React.DOM.div( {key:\"oneone\"} );\n var onetwo = React.DOM.div( {key:\"onetwo\"} );\n var one = React.DOM.div( {key:\"one\"}, oneone,onetwo);\n var two = React.DOM.div( {key:\"two\"} );\n var component = React.DOM.div(null, one,two);\n expect(ReactTransitionKeySet.getChildMapping(component.props.children))\n .toEqual({\n '{one}': one,\n '{two}': two\n });\n });\n\n it('should support getKeySet', function() {\n var oneone = React.DOM.div( {key:\"oneone\"} );\n var onetwo = React.DOM.div( {key:\"onetwo\"} );\n var one = React.DOM.div( {key:\"one\"}, oneone,onetwo);\n var two = React.DOM.div( {key:\"two\"} );\n var component = React.DOM.div(null, one,two);\n expect(ReactTransitionKeySet.getKeySet(component.props.children)).toEqual({\n '{one}': true,\n '{two}': true\n });\n });\n\n it('should support mergeKeySets for adding keys', function() {\n var prev = {\n one: true,\n two: true\n };\n var next = {\n one: true,\n two: true,\n three: true\n };\n expect(ReactTransitionKeySet.mergeKeySets(prev, next)).toEqual({\n one: true,\n two: true,\n three: true\n });\n });\n\n it('should support mergeKeySets for removing keys', function() {\n var prev = {\n one: true,\n two: true,\n three: true\n };\n var next = {\n one: true,\n two: true\n };\n expect(ReactTransitionKeySet.mergeKeySets(prev, next)).toEqual({\n one: true,\n two: true,\n three: true\n });\n });\n\n it('should support mergeKeySets for adding and removing', function() {\n var prev = {\n one: true,\n two: true,\n three: true\n };\n var next = {\n one: true,\n two: true,\n four: true\n };\n expect(ReactTransitionKeySet.mergeKeySets(prev, next)).toEqual({\n one: true,\n two: true,\n three: true,\n four: true\n });\n });\n\n it('should reconcile overlapping insertions and deletions', function() {\n var prev = {\n one: true,\n two: true,\n four: true,\n five: true\n };\n var next = {\n one: true,\n two: true,\n three: true,\n five: true\n };\n expect(ReactTransitionKeySet.mergeKeySets(prev, next)).toEqual({\n one: true,\n two: true,\n three: true,\n four: true,\n five: true\n });\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"addons/transitions/__tests__/ReactTransitionKeySet-test\", module);\n",
"addons/transitions/__tests__/ReactTransitionableChild-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTransitionableChild;\n\nvar mocks = require(\"../../../mocks\");\n\ndescribe('ReactTransitionableChild', function() {\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactTransitionableChild = require(\"../../../ReactTransitionableChild\");\n });\n\n it('should keep the DOM node around', function() {\n var container = document.createElement('div');\n var ac = React.renderComponent(\n ReactTransitionableChild(null, React.DOM.span( {id:\"test\"} )),\n container\n );\n expect(ac.getDOMNode().id).toBe('test');\n ac = React.renderComponent(ReactTransitionableChild(null ), container);\n expect(ac.getDOMNode().id).toBe('test');\n });\n\n it('should manage enter css classes correctly', function() {\n var runNextTick = mocks.getMockFunction();\n var container = document.createElement('div');\n var ac = React.renderComponent(\n ReactTransitionableChild(\n {runNextTick:runNextTick,\n name:\"myanim\",\n enter:true}, \n React.DOM.span( {id:\"test\"} )\n ),\n container\n );\n expect(ac.getDOMNode().id).toBe('test');\n expect(ac.getDOMNode().className.trim()).toBe('myanim-enter');\n expect(runNextTick.mock.calls.length).toBe(1);\n runNextTick.mock.calls[0][0]();\n expect(ac.getDOMNode().className.trim()).toBe(\n 'myanim-enter myanim-enter-active'\n );\n expect(runNextTick.mock.calls.length).toBe(1);\n });\n\n it('should manage leave css classes correctly', function() {\n var runNextTick = mocks.getMockFunction();\n var container = document.createElement('div');\n var ac = React.renderComponent(\n ReactTransitionableChild(\n {runNextTick:runNextTick,\n name:\"myanim\",\n enter:true,\n leave:true}, \n React.DOM.span( {id:\"test\"} )\n ),\n container\n );\n runNextTick.mock.calls[0][0]();\n expect(ac.getDOMNode().className.trim()).toBe(\n 'myanim-enter myanim-enter-active'\n );\n\n // TODO: we should just trigger the CSS animation end event to\n // clean these up\n ac.getDOMNode().className = '';\n React.renderComponent(\n ReactTransitionableChild(\n {runNextTick:runNextTick,\n name:\"myanim\",\n enter:true,\n leave:true}\n ),\n container\n );\n expect(ac.getDOMNode().className.trim()).toBe('myanim-leave');\n expect(runNextTick.mock.calls.length).toBe(2);\n runNextTick.mock.calls[1][0]();\n expect(ac.getDOMNode().className.trim()).toBe(\n 'myanim-leave myanim-leave-active'\n );\n expect(runNextTick.mock.calls.length).toBe(2);\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"addons/transitions/__tests__/ReactTransitionableChild-test\", module);\n",
"core/__tests__/ReactBind-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n/*global global:true*/\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\nvar React = require(\"../../React\");\nvar ReactDoNotBindDeprecated = require(\"../../ReactDoNotBindDeprecated\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\nvar reactComponentExpect = require(\"../../reactComponentExpect\");\n\n// TODO: Test render and all stock methods.\ndescribe('autobinding', function() {\n\n it('Holds reference to instance', function() {\n\n var mouseDidEnter = mocks.getMockFunction();\n var mouseDidLeave = mocks.getMockFunction();\n var mouseDidClick = mocks.getMockFunction();\n\n var TestBindComponent = React.createClass({displayName: 'TestBindComponent',\n getInitialState: function() {\n return {something: 'hi'};\n },\n onMouseEnter: ReactDoNotBindDeprecated.doNotBind(mouseDidEnter),\n onMouseLeave: ReactDoNotBindDeprecated.doNotBind(mouseDidLeave),\n onClick: mouseDidClick,\n\n // auto binding only occurs on top level functions in class defs.\n badIdeas: {\n badBind: function() {\n this.state.something;\n }\n },\n\n render: function() {\n return (\n React.DOM.div(\n {onMouseEnter:this.onMouseEnter.bind(this),\n onMouseLeave:this.onMouseLeave,\n onClick:this.onClick}\n )\n );\n }\n });\n\n var instance1 = TestBindComponent(null );\n ReactTestUtils.renderIntoDocument(instance1);\n var rendered1 = reactComponentExpect(instance1)\n .expectRenderedChild()\n .instance();\n\n var instance2 = TestBindComponent(null );\n ReactTestUtils.renderIntoDocument(instance2);\n var rendered2 = reactComponentExpect(instance2)\n .expectRenderedChild()\n .instance();\n\n expect(function() {\n var badIdea = instance1.badIdeas.badBind;\n badIdea();\n }).toThrow();\n\n expect(instance1.onMouseEnter).toBe(instance2.onMouseEnter);\n expect(instance1.onMouseLeave).toBe(instance2.onMouseLeave);\n expect(instance1.onClick).not.toBe(instance2.onClick);\n\n ReactTestUtils.Simulate.click(rendered1);\n expect(mouseDidClick.mock.instances.length).toBe(1);\n expect(mouseDidClick.mock.instances[0]).toBe(instance1);\n\n ReactTestUtils.Simulate.click(rendered2);\n expect(mouseDidClick.mock.instances.length).toBe(2);\n expect(mouseDidClick.mock.instances[1]).toBe(instance2);\n\n ReactTestUtils.Simulate.mouseOver(rendered1);\n expect(mouseDidEnter.mock.instances.length).toBe(1);\n expect(mouseDidEnter.mock.instances[0]).toBe(instance1);\n\n ReactTestUtils.Simulate.mouseOver(rendered2);\n expect(mouseDidEnter.mock.instances.length).toBe(2);\n expect(mouseDidEnter.mock.instances[1]).toBe(instance2);\n\n ReactTestUtils.Simulate.mouseOut(rendered1);\n expect(mouseDidLeave.mock.instances.length).toBe(1);\n expect(mouseDidLeave.mock.instances[0]).toBe(global);\n\n ReactTestUtils.Simulate.mouseOut(rendered2);\n expect(mouseDidLeave.mock.instances.length).toBe(2);\n expect(mouseDidLeave.mock.instances[1]).toBe(global);\n });\n\n it('works with mixins', function() {\n var mouseDidClick = mocks.getMockFunction();\n\n var TestMixin = {\n onClick: mouseDidClick\n };\n\n var TestBindComponent = React.createClass({displayName: 'TestBindComponent',\n mixins: [TestMixin],\n\n render: function() {\n return React.DOM.div( {onClick:this.onClick} );\n }\n });\n\n var instance1 = TestBindComponent(null );\n ReactTestUtils.renderIntoDocument(instance1);\n var rendered1 = reactComponentExpect(instance1)\n .expectRenderedChild()\n .instance();\n\n ReactTestUtils.Simulate.click(rendered1);\n expect(mouseDidClick.mock.instances.length).toBe(1);\n expect(mouseDidClick.mock.instances[0]).toBe(instance1);\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactBind-test\", module);\n",
"core/__tests__/ReactComponent-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTestUtils;\n\nvar reactComponentExpect;\n\ndescribe('ReactComponent', function() {\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n });\n\n it('should throw on invalid render targets', function() {\n var container = document.createElement('div');\n // jQuery objects are basically arrays; people often pass them in by mistake\n expect(function() {\n React.renderComponent(React.DOM.div(null), [container]);\n }).toThrow(\n 'Invariant Violation: prepareEnvironmentForDOM(...): Target container ' +\n 'is not a DOM element.'\n );\n\n expect(function() {\n React.renderComponent(React.DOM.div(null), null);\n }).toThrow(\n 'Invariant Violation: prepareEnvironmentForDOM(...): Target container ' +\n 'is not a DOM element.'\n );\n });\n\n it('should throw when supplying a ref outside of render method', function() {\n var instance = React.DOM.div( {ref:\"badDiv\"} );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow();\n });\n\n it('should throw when attempting to hijack a ref', function() {\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n var child = this.props.child;\n this.attachRef('test', child);\n return child;\n }\n });\n\n var instance = Component( {child:React.DOM.span(null )} );\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow(\n 'Invariant Violation: attachRef(test, ...): Only a component\\'s owner ' +\n 'can store a ref to it.'\n );\n });\n\n it('should support refs on owned components', function() {\n var inner, outer;\n\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n inner = React.DOM.div( {ref:\"inner\"} );\n outer = React.DOM.div( {ref:\"outer\"}, inner);\n return outer;\n },\n componentDidMount: function() {\n expect(this.refs.inner).toEqual(inner);\n expect(this.refs.outer).toEqual(outer);\n }\n });\n\n var instance = Component( {child:React.DOM.span(null )} );\n ReactTestUtils.renderIntoDocument(instance);\n });\n\n it('should not have refs on unmounted components', function() {\n var Parent = React.createClass({displayName: 'Parent',\n render: function() {\n return Child(null, React.DOM.div( {ref:\"test\"} ));\n },\n componentDidMount: function() {\n expect(this.refs && this.refs.test).toEqual(undefined);\n }\n });\n var Child = React.createClass({displayName: 'Child',\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n var instance = Parent( {child:React.DOM.span(null )} );\n ReactTestUtils.renderIntoDocument(instance);\n });\n\n it('should correctly determine if a component is mounted', function() {\n var Component = React.createClass({displayName: 'Component',\n componentWillMount: function() {\n expect(this.isMounted()).toBeFalsy();\n },\n componentDidMount: function() {\n expect(this.isMounted()).toBeTruthy();\n },\n render: function() {\n return React.DOM.div(null);\n }\n });\n\n var instance = Component(null );\n\n expect(instance.isMounted()).toBeFalsy();\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.isMounted()).toBeTruthy();\n });\n\n it('should know its simple mount depth', function() {\n var Owner = React.createClass({displayName: 'Owner',\n render: function() {\n return Child( {ref:\"child\"} );\n }\n });\n\n var Child = React.createClass({displayName: 'Child',\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n var instance = Owner(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance._mountDepth).toBe(0);\n expect(instance.refs.child._mountDepth).toBe(1);\n });\n\n it('should know its (complicated) mount depth', function() {\n var Box = React.createClass({displayName: 'Box',\n render: function() {\n return React.DOM.div( {ref:\"boxDiv\"}, this.props.children);\n }\n });\n\n var Child = React.createClass({displayName: 'Child',\n render: function() {\n return React.DOM.span( {ref:\"span\"}, \"child\");\n }\n });\n\n var Switcher = React.createClass({displayName: 'Switcher',\n getInitialState: function() {\n return {tabKey: 'hello'};\n },\n\n render: function() {\n var child = this.props.children;\n\n return (\n Box( {ref:\"box\"}, \n React.DOM.div(\n {ref:\"switcherDiv\",\n style:{\n display: this.state.tabKey === child.key ? '' : 'none'\n }}, \n child\n )\n )\n );\n }\n });\n\n var App = React.createClass({displayName: 'App',\n render: function() {\n return (\n Switcher( {ref:\"switcher\"}, \n Child( {key:\"hello\", ref:\"child\"} )\n )\n );\n }\n });\n\n var root = App(null );\n ReactTestUtils.renderIntoDocument(root);\n\n expect(root._mountDepth).toBe(0);\n expect(root.refs.switcher._mountDepth).toBe(1);\n expect(root.refs.switcher.refs.box._mountDepth).toBe(2);\n expect(root.refs.switcher.refs.switcherDiv._mountDepth).toBe(4);\n expect(root.refs.child._mountDepth).toBe(5);\n expect(root.refs.switcher.refs.box.refs.boxDiv._mountDepth).toBe(3);\n expect(root.refs.child.refs.span._mountDepth).toBe(6);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactComponent-test\", module);\n",
"core/__tests__/ReactComponentLifeCycle-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTestUtils;\nvar ReactComponent;\nvar ReactCompositeComponent;\nvar ComponentLifeCycle;\nvar CompositeComponentLifeCycle;\n\nvar clone = function(o) {\n return JSON.parse(JSON.stringify(o));\n};\n\n\nvar GET_INIT_STATE_RETURN_VAL = {\n hasWillMountCompleted: false,\n hasRenderCompleted: false,\n hasDidMountCompleted: false,\n hasWillUnmountCompleted: false\n};\n\nvar INIT_RENDER_STATE = {\n hasWillMountCompleted: true,\n hasRenderCompleted: false,\n hasDidMountCompleted: false,\n hasWillUnmountCompleted: false\n};\n\nvar DID_MOUNT_STATE = {\n hasWillMountCompleted: true,\n hasRenderCompleted: true,\n hasDidMountCompleted: false,\n hasWillUnmountCompleted: false\n};\n\nvar NEXT_RENDER_STATE = {\n hasWillMountCompleted: true,\n hasRenderCompleted: true,\n hasDidMountCompleted: true,\n hasWillUnmountCompleted: false\n};\n\nvar WILL_UNMOUNT_STATE = {\n hasWillMountCompleted: true,\n hasDidMountCompleted: true,\n hasRenderCompleted: true,\n hasWillUnmountCompleted: false\n};\n\nvar POST_WILL_UNMOUNT_STATE = {\n hasWillMountCompleted: true,\n hasDidMountCompleted: true,\n hasRenderCompleted: true,\n hasWillUnmountCompleted: true\n};\n\n/**\n * TODO: We should make any setState calls fail in\n * `getInitialState` and `componentWillMount`. They will usually fail\n * anyways because `this._renderedComponent` is empty, however, if a component\n * is *reused*, then that won't be the case and things will appear to work in\n * some cases. Better to just block all updates in initialization.\n */\ndescribe('ReactComponentLifeCycle', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n ReactComponent = require(\"../../ReactComponent\");\n ReactCompositeComponent = require(\"../../ReactCompositeComponent\");\n ComponentLifeCycle = ReactComponent.LifeCycle;\n CompositeComponentLifeCycle = ReactCompositeComponent.LifeCycle;\n });\n\n it('should scrub state when reinitialized using getInitialState', function() {\n var StatefulComponent = React.createClass({displayName: 'StatefulComponent',\n getInitialState: function() {\n return { };\n },\n addAnotherField: function() {\n this.setState({\n aField: 'asdf'\n });\n },\n render: function() {\n return (\n React.DOM.div(null )\n );\n }\n });\n var instance = StatefulComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n instance.addAnotherField();\n expect(instance.state.aField).toBe('asdf');\n instance.unmountComponent();\n ReactTestUtils.renderIntoDocument(instance);\n expect(typeof instance.state.aField).toBe('undefined');\n });\n\n /**\n * If a state update triggers rerendering that in turn fires an onDOMReady,\n * that second onDOMReady should not fail.\n */\n it('it should fire onDOMReady when already in onDOMReady', function() {\n\n var _testJournal = [];\n\n var Child = React.createClass({displayName: 'Child',\n componentDidMount: function() {\n _testJournal.push('Child:onDOMReady');\n },\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n var SwitcherParent = React.createClass({displayName: 'SwitcherParent',\n getInitialState: function() {\n _testJournal.push('SwitcherParent:getInitialState');\n return {showHasOnDOMReadyComponent: false};\n },\n componentDidMount: function() {\n _testJournal.push('SwitcherParent:onDOMReady');\n this.switchIt();\n },\n switchIt: function() {\n this.setState({showHasOnDOMReadyComponent: true});\n },\n render: function() {\n return (\n React.DOM.div(null, \n this.state.showHasOnDOMReadyComponent ?\n Child(null ) :\n React.DOM.div(null )\n )\n );\n }\n });\n\n var instance = SwitcherParent(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(_testJournal).toEqual([\n 'SwitcherParent:getInitialState',\n 'SwitcherParent:onDOMReady',\n 'Child:onDOMReady'\n ]);\n });\n\n\n it('should scrub state when re-initialized', function() {\n var StatefulComponent = React.createClass({displayName: 'StatefulComponent',\n addAnotherField: function() {\n this.setState({\n aField: 'asdf'\n });\n },\n render: function() {\n return (\n React.DOM.div(null )\n );\n }\n });\n var instance = StatefulComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n instance.addAnotherField();\n expect(instance.state.aField).toBe('asdf');\n instance.unmountComponent();\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toBe(null);\n });\n\n // You could assign state here, but not access members of it, unless you\n // had provided a getInitialState method.\n it('throws when accessing state in componentWillMount', function() {\n var StatefulComponent = React.createClass({displayName: 'StatefulComponent',\n componentWillMount: function() {\n this.state.yada;\n },\n render: function() {\n return (\n React.DOM.div(null )\n );\n }\n });\n var instance = StatefulComponent(null );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow();\n });\n\n it('should allow update state inside of componentWillMount', function() {\n var StatefulComponent = React.createClass({displayName: 'StatefulComponent',\n componentWillMount: function() {\n this.setState({stateField: 'something'});\n },\n render: function() {\n return (\n React.DOM.div(null )\n );\n }\n });\n var instance = StatefulComponent(null );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).not.toThrow();\n });\n\n it('should allow update state inside of getInitialState', function() {\n var StatefulComponent = React.createClass({displayName: 'StatefulComponent',\n getInitialState: function() {\n this.setState({stateField: 'something'});\n\n return {stateField: 'somethingelse'};\n },\n render: function() {\n return (\n React.DOM.div(null )\n );\n }\n });\n var instance = StatefulComponent(null );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).not.toThrow();\n\n // The return value of getInitialState overrides anything from setState\n expect(instance.state.stateField).toEqual('somethingelse');\n });\n\n\n it('should carry through each of the phases of setup', function() {\n var LifeCycleComponent = React.createClass({displayName: 'LifeCycleComponent',\n getInitialState: function() {\n this._testJournal = {};\n var initState = {\n hasWillMountCompleted: false,\n hasDidMountCompleted: false,\n hasRenderCompleted: false,\n hasWillUnmountCompleted: false\n };\n this._testJournal.returnedFromGetInitialState = clone(initState);\n this._testJournal.lifeCycleAtStartOfGetInitialState =\n this._lifeCycleState;\n this._testJournal.compositeLifeCycleAtStartOfGetInitialState =\n this._compositeLifeCycleState;\n return initState;\n },\n\n componentWillMount: function() {\n this._testJournal.stateAtStartOfWillMount = clone(this.state);\n this._testJournal.lifeCycleAtStartOfWillMount =\n this._lifeCycleState;\n this._testJournal.compositeLifeCycleAtStartOfWillMount =\n this._compositeLifeCycleState;\n this.state.hasWillMountCompleted = true;\n },\n\n componentDidMount: function() {\n this._testJournal.stateAtStartOfDidMount = clone(this.state);\n this._testJournal.lifeCycleAtStartOfDidMount =\n this._lifeCycleState;\n this.setState({hasDidMountCompleted: true});\n },\n\n render: function() {\n var isInitialRender = !this.state.hasRenderCompleted;\n if (isInitialRender) {\n this._testJournal.stateInInitialRender = clone(this.state);\n this._testJournal.lifeCycleInInitialRender = this._lifeCycleState;\n this._testJournal.compositeLifeCycleInInitialRender =\n this._compositeLifeCycleState;\n } else {\n this._testJournal.stateInLaterRender = clone(this.state);\n this._testJournal.lifeCycleInLaterRender = this._lifeCycleState;\n }\n // you would *NEVER* do anything like this in real code!\n this.state.hasRenderCompleted = true;\n return (\n React.DOM.div( {ref:\"theDiv\"}, \n \" I am the inner DIV \"\n )\n );\n },\n\n componentWillUnmount: function() {\n this._testJournal.stateAtStartOfWillUnmount = clone(this.state);\n this._testJournal.lifeCycleAtStartOfWillUnmount =\n this._lifeCycleState;\n this.state.hasWillUnmountCompleted = true;\n }\n });\n\n // A component that is merely \"constructed\" (as in \"constructor\") but not\n // yet initialized, or rendered.\n //\n var instance = LifeCycleComponent(null );\n expect(instance._lifeCycleState).toBe(ComponentLifeCycle.UNMOUNTED);\n ReactTestUtils.renderIntoDocument(instance);\n\n // getInitialState\n expect(instance._testJournal.returnedFromGetInitialState).toEqual(\n GET_INIT_STATE_RETURN_VAL\n );\n expect(instance._testJournal.lifeCycleAtStartOfGetInitialState)\n .toBe(ComponentLifeCycle.MOUNTED);\n expect(instance._testJournal.compositeLifeCycleAtStartOfGetInitialState)\n .toBe(CompositeComponentLifeCycle.MOUNTING);\n\n // componentWillMount\n expect(instance._testJournal.stateAtStartOfWillMount).toEqual(\n instance._testJournal.returnedFromGetInitialState\n );\n expect(instance._testJournal.lifeCycleAtStartOfWillMount)\n .toBe(ComponentLifeCycle.MOUNTED);\n expect(instance._testJournal.compositeLifeCycleAtStartOfWillMount)\n .toBe(CompositeComponentLifeCycle.MOUNTING);\n\n // componentDidMount\n expect(instance._testJournal.stateAtStartOfDidMount)\n .toEqual(DID_MOUNT_STATE);\n expect(instance._testJournal.lifeCycleAtStartOfDidMount).toBe(\n ComponentLifeCycle.MOUNTED\n );\n\n // render\n expect(instance._testJournal.stateInInitialRender)\n .toEqual(INIT_RENDER_STATE);\n expect(instance._testJournal.lifeCycleInInitialRender).toBe(\n ComponentLifeCycle.MOUNTED\n );\n expect(instance._testJournal.compositeLifeCycleInInitialRender).toBe(\n CompositeComponentLifeCycle.MOUNTING\n );\n\n expect(instance._lifeCycleState).toBe(ComponentLifeCycle.MOUNTED);\n\n // Now *update the component*\n instance.forceUpdate();\n\n // render 2nd time\n expect(instance._testJournal.stateInLaterRender)\n .toEqual(NEXT_RENDER_STATE);\n expect(instance._testJournal.lifeCycleInLaterRender).toBe(\n ComponentLifeCycle.MOUNTED\n );\n\n expect(instance._lifeCycleState).toBe(ComponentLifeCycle.MOUNTED);\n\n // Now *unmountComponent*\n instance.unmountComponent();\n\n expect(instance._testJournal.stateAtStartOfWillUnmount)\n .toEqual(WILL_UNMOUNT_STATE);\n // componentWillUnmount called right before unmount.\n expect(instance._testJournal.lifeCycleAtStartOfWillUnmount).toBe(\n ComponentLifeCycle.MOUNTED\n );\n\n // But the current lifecycle of the component is unmounted.\n expect(instance._lifeCycleState).toBe(ComponentLifeCycle.UNMOUNTED);\n expect(instance.state).toEqual(POST_WILL_UNMOUNT_STATE);\n });\n\n it('should throw when calling setProps() on an owned component', function() {\n /**\n * calls setProps in an componentDidMount.\n */\n var PropsUpdaterInOnDOMReady = React.createClass({displayName: 'PropsUpdaterInOnDOMReady',\n componentDidMount: function() {\n this.refs.theSimpleComponent.setProps({\n value: this.props.valueToUseInOnDOMReady\n });\n },\n render: function() {\n return (\n React.DOM.input(\n {value:this.props.valueToUseInitially,\n ref:\"theSimpleComponent\"}\n )\n );\n }\n });\n var instance =\n PropsUpdaterInOnDOMReady(\n {valueToUseInitially:\"hello\",\n valueToUseInOnDOMReady:\"goodbye\"}\n );\n expect(ReactTestUtils.renderIntoDocument.bind(ReactTestUtils, instance))\n .toThrow();\n });\n\n it('should throw when calling setProps() on an unmounted component',\n function() {\n var PropsToUpdate = React.createClass({displayName: 'PropsToUpdate',\n render: function() {\n return (\n React.DOM.input(\n {value:this.props.value,\n ref:\"theSimpleComponent\"}\n )\n );\n }\n });\n var instance = PropsToUpdate( {value:\"hello\"} );\n expect(function() {\n instance.setProps({value: \"goodbye\"});\n }).toThrow(\n 'Invariant Violation: replaceProps(...): Can only update a ' +\n 'mounted component.'\n );\n });\n\n it('should allow state updates in componentDidMount', function() {\n /**\n * calls setState in an componentDidMount.\n */\n var SetStateInComponentDidMount = React.createClass({displayName: 'SetStateInComponentDidMount',\n getInitialState: function() {\n return {\n stateField: this.props.valueToUseInitially\n };\n },\n componentDidMount: function() {\n this.setState({stateField: this.props.valueToUseInOnDOMReady});\n },\n render: function() {\n return (React.DOM.div(null));\n }\n });\n var instance =\n SetStateInComponentDidMount(\n {valueToUseInitially:\"hello\",\n valueToUseInOnDOMReady:\"goodbye\"}\n );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state.stateField).toBe('goodbye');\n });\n\n it('should call nested lifecycle methods in the right order', function() {\n var log;\n var logger = function(msg) {\n return function() {\n // return true for shouldComponentUpdate\n log.push(msg);\n return true;\n };\n };\n var Outer = React.createClass({displayName: 'Outer',\n render: function() {\n return React.DOM.div(null, Inner( {x:this.props.x} ));\n },\n componentWillMount: logger('outer componentWillMount'),\n componentDidMount: logger('outer componentDidMount'),\n componentWillReceiveProps: logger('outer componentWillReceiveProps'),\n shouldComponentUpdate: logger('outer shouldComponentUpdate'),\n componentWillUpdate: logger('outer componentWillUpdate'),\n componentDidUpdate: logger('outer componentDidUpdate'),\n componentWillUnmount: logger('outer componentWillUnmount')\n });\n var Inner = React.createClass({displayName: 'Inner',\n render: function() {\n return React.DOM.span(null, this.props.x);\n },\n componentWillMount: logger('inner componentWillMount'),\n componentDidMount: logger('inner componentDidMount'),\n componentWillReceiveProps: logger('inner componentWillReceiveProps'),\n shouldComponentUpdate: logger('inner shouldComponentUpdate'),\n componentWillUpdate: logger('inner componentWillUpdate'),\n componentDidUpdate: logger('inner componentDidUpdate'),\n componentWillUnmount: logger('inner componentWillUnmount')\n });\n var instance;\n\n log = [];\n instance = ReactTestUtils.renderIntoDocument(Outer( {x:17} ));\n expect(log).toEqual([\n 'outer componentWillMount',\n 'inner componentWillMount',\n 'inner componentDidMount',\n 'outer componentDidMount'\n ]);\n\n log = [];\n instance.setProps({x: 42});\n expect(log).toEqual([\n 'outer componentWillReceiveProps',\n 'outer shouldComponentUpdate',\n 'outer componentWillUpdate',\n 'inner componentWillReceiveProps',\n 'inner shouldComponentUpdate',\n 'inner componentWillUpdate',\n 'inner componentDidUpdate',\n 'outer componentDidUpdate'\n ]);\n\n log = [];\n instance.unmountComponent();\n expect(log).toEqual([\n 'outer componentWillUnmount',\n 'inner componentWillUnmount'\n ]);\n });\n});\n\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactComponentLifeCycle-test\", module);\n",
"core/__tests__/ReactCompositeComponent-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar MorphingComponent;\nvar ChildUpdates;\nvar React;\nvar ReactCurrentOwner;\nvar ReactPropTypes;\nvar ReactTestUtils;\nvar ReactMount;\nvar ReactDoNotBindDeprecated;\n\nvar cx;\nvar reactComponentExpect;\nvar mocks;\n\ndescribe('ReactCompositeComponent', function() {\n\n beforeEach(function() {\n cx = require(\"../../cx\");\n mocks = require(\"../../mocks\");\n\n reactComponentExpect = require(\"../../reactComponentExpect\");\n React = require(\"../../React\");\n ReactCurrentOwner = require(\"../../ReactCurrentOwner\");\n ReactDoNotBindDeprecated = require(\"../../ReactDoNotBindDeprecated\");\n ReactPropTypes = require(\"../../ReactPropTypes\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n ReactMount = require(\"../../ReactMount\");\n\n MorphingComponent = React.createClass({\n getInitialState: function() {\n return {activated: false};\n },\n\n _toggleActivatedState: function() {\n this.setState({activated: !this.state.activated});\n },\n\n render: function() {\n var toggleActivatedState = this._toggleActivatedState;\n return !this.state.activated ?\n React.DOM.a( {ref:\"x\", onClick:toggleActivatedState} ) :\n React.DOM.b( {ref:\"x\", onClick:toggleActivatedState} );\n }\n });\n\n /**\n * We'll use this to ensure that an old version is not cached when it is\n * reallocated again.\n */\n ChildUpdates = React.createClass({\n getAnchorID: function() {\n return this.refs.anch._rootNodeID;\n },\n render: function() {\n var className = cx({'anchorClass': this.props.anchorClassOn});\n return this.props.renderAnchor ?\n React.DOM.a( {ref:\"anch\", className:className}) :\n React.DOM.b(null);\n }\n });\n });\n\n it('should support rendering to different child types over time', function() {\n var instance = MorphingComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('a');\n\n instance._toggleActivatedState();\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('b');\n\n instance._toggleActivatedState();\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('a');\n });\n\n it('should react to state changes from callbacks', function() {\n var instance = MorphingComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n\n var renderedChild = reactComponentExpect(instance)\n .expectRenderedChild()\n .instance();\n\n ReactTestUtils.Simulate.click(renderedChild);\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('b');\n });\n\n it('should rewire refs when rendering to different child types', function() {\n var instance = MorphingComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n\n reactComponentExpect(instance.refs.x).toBeDOMComponentWithTag('a');\n instance._toggleActivatedState();\n reactComponentExpect(instance.refs.x).toBeDOMComponentWithTag('b');\n instance._toggleActivatedState();\n reactComponentExpect(instance.refs.x).toBeDOMComponentWithTag('a');\n });\n\n it('should not cache old DOM nodes when switching constructors', function() {\n var instance = ChildUpdates( {renderAnchor:true, anchorClassOn:false});\n ReactTestUtils.renderIntoDocument(instance);\n instance.setProps({anchorClassOn: true}); // Warm any cache\n instance.setProps({renderAnchor: false}); // Clear out the anchor\n // rerender\n instance.setProps({renderAnchor: true, anchorClassOn: false});\n var anchorID = instance.getAnchorID();\n var actualDOMAnchorNode = ReactMount.getNode(anchorID);\n expect(actualDOMAnchorNode.className).toBe('');\n });\n\n it('should auto bind methods and values correctly', function() {\n spyOn(console, 'warn');\n\n var ComponentClass = React.createClass({displayName: 'ComponentClass',\n getInitialState: function() {\n return {valueToReturn: 'hi'};\n },\n methodToBeExplicitlyBound: function() {\n return this;\n },\n methodAutoBound: function() {\n return this;\n },\n methodExplicitlyNotBound: ReactDoNotBindDeprecated.doNotBind(function() {\n return this;\n }),\n render: function() {\n return React.DOM.div(null );\n }\n });\n var instance = ComponentClass(null );\n\n // These are controversial assertions for now, they just exist\n // because existing code depends on these assumptions.\n expect(function() {\n instance.methodToBeExplicitlyBound.bind(instance)();\n }).not.toThrow();\n expect(function() {\n instance.methodAutoBound();\n }).not.toThrow();\n expect(function() {\n instance.methodExplicitlyNotBound();\n }).not.toThrow();\n\n // Next, prove that once mounted, the scope is bound correctly to the actual\n // component.\n ReactTestUtils.renderIntoDocument(instance);\n expect(console.warn.argsForCall.length).toBe(0);\n var explicitlyBound = instance.methodToBeExplicitlyBound.bind(instance);\n expect(console.warn.argsForCall.length).toBe(1);\n var autoBound = instance.methodAutoBound;\n var explicitlyNotBound = instance.methodExplicitlyNotBound;\n\n var context = {};\n expect(explicitlyBound.call(context)).toBe(instance);\n expect(autoBound.call(context)).toBe(instance);\n expect(explicitlyNotBound.call(context)).toBe(context);\n\n expect(explicitlyBound.call(instance)).toBe(instance);\n expect(autoBound.call(instance)).toBe(instance);\n expect(explicitlyNotBound.call(instance)).toBe(instance);\n\n });\n\n it('should use default values for undefined props', function() {\n var Component = React.createClass({displayName: 'Component',\n getDefaultProps: function() {\n return {key: 'testKey'};\n },\n render: function() {\n return React.DOM.span(null );\n }\n });\n\n var instance1 = Component(null );\n ReactTestUtils.renderIntoDocument(instance1);\n reactComponentExpect(instance1).scalarPropsEqual({key: 'testKey'});\n\n var instance2 = Component( {key:undefined} );\n ReactTestUtils.renderIntoDocument(instance2);\n reactComponentExpect(instance2).scalarPropsEqual({key: 'testKey'});\n\n var instance3 = Component( {key:null} );\n ReactTestUtils.renderIntoDocument(instance3);\n reactComponentExpect(instance3).scalarPropsEqual({key: null});\n });\n\n it('should normalize props with default values', function() {\n var Component = React.createClass({displayName: 'Component',\n propTypes: {key: ReactPropTypes.string.isRequired},\n getDefaultProps: function() {\n return {key: 'testKey'};\n },\n getInitialState: function() {\n return {key: this.props.key + 'State'};\n },\n render: function() {\n return React.DOM.span(null, this.props.key);\n }\n });\n\n var instance = Component(null );\n ReactTestUtils.renderIntoDocument(instance);\n reactComponentExpect(instance).scalarPropsEqual({key: 'testKey'});\n reactComponentExpect(instance).scalarStateEqual({key: 'testKeyState'});\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(Component( {key:null} ));\n }).toThrow(\n 'Invariant Violation: Required prop `key` was not specified in ' +\n '`Component`.'\n );\n });\n\n it('should check default prop values', function() {\n var Component = React.createClass({displayName: 'Component',\n propTypes: {key: ReactPropTypes.string.isRequired},\n getDefaultProps: function() {\n return {key: null};\n },\n render: function() {\n return React.DOM.span(null, this.props.key);\n }\n });\n\n var instance = Component(null );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow(\n 'Invariant Violation: Required prop `key` was not specified in ' +\n '`Component`.'\n );\n });\n\n it('should check declared prop types', function() {\n var Component = React.createClass({displayName: 'Component',\n propTypes: {\n key: ReactPropTypes.string.isRequired\n },\n render: function() {\n return React.DOM.span(null, this.props.key);\n }\n });\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(Component(null ));\n }).toThrow(\n 'Invariant Violation: Required prop `key` was not specified in ' +\n '`Component`.'\n );\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(Component( {key:42} ));\n }).toThrow(\n 'Invariant Violation: Invalid prop `key` of type `number` supplied to ' +\n '`Component`, expected `string`.'\n );\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(Component( {key:\"string\"} ));\n }).not.toThrow();\n });\n\n it('should not allow `forceUpdate` on unmounted components', function() {\n var container = document.createElement('div');\n document.documentElement.appendChild(container);\n\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n var instance = Component(null );\n expect(function() {\n instance.forceUpdate();\n }).toThrow(\n 'Invariant Violation: forceUpdate(...): Can only force an update on ' +\n 'mounted or mounting components.'\n );\n\n React.renderComponent(instance, container);\n expect(function() {\n instance.forceUpdate();\n }).not.toThrow();\n\n React.unmountComponentAtNode(container);\n expect(function() {\n instance.forceUpdate();\n }).toThrow(\n 'Invariant Violation: forceUpdate(...): Can only force an update on ' +\n 'mounted or mounting components.'\n );\n });\n\n it('should cleanup even if render() fatals', function() {\n var BadComponent = React.createClass({displayName: 'BadComponent',\n render: function() {\n throw new Error();\n }\n });\n var instance = BadComponent(null );\n\n expect(ReactCurrentOwner.current).toBe(null);\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow();\n\n expect(ReactCurrentOwner.current).toBe(null);\n });\n\n it('should support mixins with getInitialState()', function() {\n var Mixin = {\n getInitialState: function() {\n return {mixin: true};\n }\n };\n var Component = React.createClass({displayName: 'Component',\n mixins: [Mixin],\n getInitialState: function() {\n return {component: true};\n },\n render: function() {\n return React.DOM.span(null );\n }\n });\n var instance = Component(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state.component).toBe(true);\n expect(instance.state.mixin).toBe(true);\n });\n\n it('should throw with conflicting getInitialState() methods', function() {\n var Mixin = {\n getInitialState: function() {\n return {x: true};\n }\n };\n var Component = React.createClass({displayName: 'Component',\n mixins: [Mixin],\n getInitialState: function() {\n return {x: true};\n },\n render: function() {\n return React.DOM.span(null );\n }\n });\n var instance = Component(null );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow(\n 'Invariant Violation: mergeObjectsWithNoDuplicateKeys(): ' +\n 'Tried to merge two objects with the same key: x'\n );\n });\n\n it('should throw with bad getInitialState() return values', function() {\n var Mixin = {\n getInitialState: function() {\n return null;\n }\n };\n var Component = React.createClass({displayName: 'Component',\n mixins: [Mixin],\n getInitialState: function() {\n return {x: true};\n },\n render: function() {\n return React.DOM.span(null );\n }\n });\n var instance = Component(null );\n expect(function() {\n ReactTestUtils.renderIntoDocument(instance);\n }).toThrow(\n 'Invariant Violation: mergeObjectsWithNoDuplicateKeys(): ' +\n 'Cannot merge non-objects'\n );\n });\n\n it('should detect valid CompositeComponent classes', function() {\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n return React.DOM.div(null);\n }\n });\n\n expect(React.isValidClass(Component)).toBe(true);\n });\n\n it('should detect invalid CompositeComponent classes', function() {\n var FnComponent = function() {\n return false;\n };\n\n var NullComponent = null;\n\n var TrickFnComponent = function() {\n return true;\n };\n TrickFnComponent.componentConstructor = true;\n\n expect(React.isValidClass(FnComponent)).toBe(false);\n expect(React.isValidClass(NullComponent)).toBe(false);\n expect(React.isValidClass(TrickFnComponent)).toBe(false);\n });\n\n it('should warn when mispelling shouldComponentUpdate', function() {\n var warn = console.warn;\n console.warn = mocks.getMockFunction();\n\n try {\n React.createClass({\n componentShouldUpdate: function() {\n return false;\n },\n render: function() {\n return React.DOM.div(null );\n }\n });\n expect(console.warn.mock.calls.length).toBe(1);\n expect(console.warn.mock.calls[0][0]).toBe(\n 'A component has a method called componentShouldUpdate(). Did you ' +\n 'mean shouldComponentUpdate()? The name is phrased as a question ' +\n 'because the function is expected to return a value.'\n );\n\n var NamedComponent = React.createClass({displayName: 'NamedComponent',\n componentShouldUpdate: function() {\n return false;\n },\n render: function() {\n return React.DOM.div(null );\n }\n });\n expect(console.warn.mock.calls.length).toBe(2);\n expect(console.warn.mock.calls[1][0]).toBe(\n 'NamedComponent has a method called componentShouldUpdate(). Did you ' +\n 'mean shouldComponentUpdate()? The name is phrased as a question ' +\n 'because the function is expected to return a value.'\n );\n\n NamedComponent(); // Shut up lint\n } catch (e) {\n throw e;\n } finally {\n console.warn = warn;\n }\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactCompositeComponent-test\", module);\n",
"core/__tests__/ReactCompositeComponentDOMMinimalism-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\n// Requires\nvar React;\nvar ReactTestUtils;\nvar reactComponentExpect;\n\n// Test components\nvar LowerLevelComposite;\nvar MyCompositeComponent;\n\nvar expectSingleChildlessDiv;\n\n/**\n * Integration test, testing the combination of JSX with our unit of\n * abstraction, `ReactCompositeComponent` does not ever add superfluous DOM\n * nodes.\n */\ndescribe('ReactCompositeComponentDOMMinimalism', function() {\n\n beforeEach(function() {\n reactComponentExpect = require(\"../../reactComponentExpect\");\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n\n LowerLevelComposite = React.createClass({\n render: function() {\n return (\n React.DOM.div(null, \n this.props.children\n )\n );\n }\n });\n\n MyCompositeComponent = React.createClass({\n render: function() {\n return (\n LowerLevelComposite(null, \n this.props.children\n )\n );\n }\n });\n\n expectSingleChildlessDiv = function(instance) {\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeCompositeComponentWithType(LowerLevelComposite)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('div')\n .toBeDOMComponentWithNoChildren();\n };\n });\n\n it('should not render extra nodes for non-interpolated text', function() {\n var instance = (\n MyCompositeComponent(null, \n \" A string child \"\n )\n );\n ReactTestUtils.renderIntoDocument(instance);\n expectSingleChildlessDiv(instance);\n });\n\n it('should not render extra nodes for non-interpolated text', function() {\n var instance = (\n MyCompositeComponent(null, \n 'Interpolated String Child'\n )\n );\n ReactTestUtils.renderIntoDocument(instance);\n expectSingleChildlessDiv(instance);\n });\n\n it('should not render extra nodes for non-interpolated text', function() {\n var instance = (\n MyCompositeComponent(null, \n React.DOM.ul(null, \n \" This text causes no children in ul, just innerHTML \"\n )\n )\n );\n ReactTestUtils.renderIntoDocument(instance);\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeCompositeComponentWithType(LowerLevelComposite)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('div')\n .toBeDOMComponentWithChildCount(1)\n .expectRenderedChildAt(0)\n .toBeDOMComponentWithTag('ul')\n .toBeDOMComponentWithNoChildren();\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactCompositeComponentDOMMinimalism-test\", module);\n",
"core/__tests__/ReactCompositeComponentMixin-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\n\nvar React;\nvar ReactTestUtils;\nvar reactComponentExpect;\n\nvar TestComponent;\nvar TestComponentWithPropTypes;\nvar mixinPropValidator;\nvar componentPropValidator;\n\ndescribe('ReactCompositeComponent-mixin', function() {\n\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n mixinPropValidator = mocks.getMockFunction();\n componentPropValidator = mocks.getMockFunction();\n\n var MixinA = {\n componentDidMount: function() {\n this.props.listener('MixinA didMount');\n }\n };\n\n var MixinB = {\n mixins: [MixinA],\n componentDidMount: function() {\n this.props.listener('MixinB didMount');\n }\n };\n\n var MixinC = {\n componentDidMount: function() {\n this.props.listener('MixinC didMount');\n }\n };\n\n var MixinD = {\n propTypes: {\n value: mixinPropValidator\n }\n };\n\n TestComponent = React.createClass({\n mixins: [MixinB, MixinC, MixinD],\n\n componentDidMount: function() {\n this.props.listener('Component didMount');\n },\n\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n TestComponentWithPropTypes = React.createClass({\n mixins: [MixinD],\n propTypes: {\n value: componentPropValidator\n },\n render: function() {\n return React.DOM.div(null );\n }\n });\n });\n\n it('should support chaining delegate functions', function() {\n var listener = mocks.getMockFunction();\n var instance = TestComponent( {listener:listener} );\n ReactTestUtils.renderIntoDocument(instance);\n\n expect(listener.mock.calls).toEqual([\n ['MixinA didMount'],\n ['MixinB didMount'],\n ['MixinC didMount'],\n ['Component didMount']\n ]);\n });\n\n it('should validate prop types via mixins', function() {\n expect(TestComponent.componentConstructor.propTypes).toBeDefined();\n expect(TestComponent.componentConstructor.propTypes.value)\n .toBe(mixinPropValidator);\n });\n\n it('should override mixin prop types with class prop types', function() {\n // Sanity check...\n expect(componentPropValidator).toNotBe(mixinPropValidator);\n // Actually check...\n expect(TestComponentWithPropTypes.componentConstructor.propTypes)\n .toBeDefined();\n expect(TestComponentWithPropTypes.componentConstructor.propTypes.value)\n .toNotBe(mixinPropValidator);\n expect(TestComponentWithPropTypes.componentConstructor.propTypes.value)\n .toBe(componentPropValidator);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactCompositeComponentMixin-test\", module);\n",
"core/__tests__/ReactCompositeComponentSpec-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\n\nvar React;\nvar ReactTestUtils;\nvar reactComponentExpect;\n\ndescribe('ReactCompositeComponent-spec', function() {\n\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n });\n\n it('should throw when `render` is not specified', function() {\n expect(function() {\n React.createClass({});\n }).toThrow(\n 'Invariant Violation: createClass(...): Class specification must ' +\n 'implement a `render` method.'\n );\n });\n\n it('should copy `displayName` onto the Constructor', function() {\n var TestComponent = React.createClass({displayName: 'TestComponent',\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n expect(TestComponent.componentConstructor.displayName)\n .toBe('TestComponent');\n });\n\n it('should copy prop types onto the Constructor', function() {\n var propValidator = mocks.getMockFunction();\n var TestComponent = React.createClass({displayName: 'TestComponent',\n propTypes: {\n value: propValidator\n },\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n expect(TestComponent.componentConstructor.propTypes).toBeDefined();\n expect(TestComponent.componentConstructor.propTypes.value)\n .toBe(propValidator);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactCompositeComponentSpec-test\", module);\n",
"core/__tests__/ReactCompositeComponentState-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\n\nvar React;\nvar ReactTestUtils;\nvar reactComponentExpect;\n\nvar TestComponent;\n\ndescribe('ReactCompositeComponent-state', function() {\n\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n\n TestComponent = React.createClass({\n peekAtState: function(from, state) {\n if (state) {\n this.props.stateListener(from, state && state.color);\n } else {\n this.props.stateListener(\n from,\n this.state && this.state.color,\n this._pendingState && this._pendingState.color\n );\n }\n },\n\n setFavoriteColor: function(nextColor) {\n this.setState({color: nextColor});\n },\n\n getInitialState: function() {\n this.peekAtState('getInitialState');\n return {color: 'red'};\n },\n\n render: function() {\n this.peekAtState('render');\n return React.DOM.div(null, this.state.color);\n },\n\n componentWillMount: function() {\n this.peekAtState('componentWillMount-start');\n this.setState({color: 'sunrise'});\n this.peekAtState('componentWillMount-after-sunrise');\n this.setState({color: 'orange'});\n this.peekAtState('componentWillMount-end');\n },\n\n componentDidMount: function() {\n this.peekAtState('componentDidMount-start');\n this.setState({color: 'yellow'});\n this.peekAtState('componentDidMount-end');\n },\n\n componentWillReceiveProps: function(newProps) {\n this.peekAtState('componentWillReceiveProps-start');\n if (newProps.nextColor) {\n this.setState({color: newProps.nextColor});\n }\n this.peekAtState('componentWillReceiveProps-end');\n },\n\n shouldComponentUpdate: function(nextProps, nextState) {\n this.peekAtState('shouldComponentUpdate-currentState');\n this.peekAtState('shouldComponentUpdate-nextState', nextState);\n return true;\n },\n\n componentWillUpdate: function(nextProps, nextState) {\n this.peekAtState('componentWillUpdate-currentState');\n this.peekAtState('componentWillUpdate-nextState', nextState);\n },\n\n componentDidUpdate: function(prevProps, prevState) {\n this.peekAtState('componentDidUpdate-currentState');\n this.peekAtState('componentDidUpdate-prevState', prevState);\n },\n\n componentWillUnmount: function() {\n this.peekAtState('componentWillUnmount');\n }\n });\n\n });\n\n it('should support setting state', function() {\n var stateListener = mocks.getMockFunction();\n var instance = TestComponent( {stateListener:stateListener} );\n ReactTestUtils.renderIntoDocument(instance);\n instance.setProps({nextColor: 'green'});\n instance.setFavoriteColor('blue');\n instance.forceUpdate();\n instance.unmountComponent();\n\n expect(stateListener.mock.calls).toEqual([\n // there is no state when getInitialState() is called\n [ 'getInitialState', null, null ],\n [ 'componentWillMount-start', 'red', null ],\n // setState() only enqueues a pending state.\n [ 'componentWillMount-after-sunrise', 'red', 'sunrise' ],\n [ 'componentWillMount-end', 'red', 'orange' ],\n // pending state has been applied\n [ 'render', 'orange', null ],\n [ 'componentDidMount-start', 'orange', null ],\n // componentDidMount() called setState({color:'yellow'}), currently this\n // occurs inline.\n // In a future where setState() is async, this test result will change.\n [ 'shouldComponentUpdate-currentState', 'orange', null ],\n [ 'shouldComponentUpdate-nextState', 'yellow' ],\n [ 'componentWillUpdate-currentState', 'orange', null ],\n [ 'componentWillUpdate-nextState', 'yellow' ],\n [ 'render', 'yellow', null ],\n [ 'componentDidUpdate-currentState', 'yellow', null ],\n [ 'componentDidUpdate-prevState', 'orange' ],\n // componentDidMount() finally closes.\n [ 'componentDidMount-end', 'yellow', null ],\n [ 'componentWillReceiveProps-start', 'yellow', null ],\n // setState({color:'green'}) only enqueues a pending state.\n [ 'componentWillReceiveProps-end', 'yellow', 'green' ],\n [ 'shouldComponentUpdate-currentState', 'yellow', null ],\n [ 'shouldComponentUpdate-nextState', 'green' ],\n [ 'componentWillUpdate-currentState', 'yellow', null ],\n [ 'componentWillUpdate-nextState', 'green' ],\n [ 'render', 'green', null ],\n [ 'componentDidUpdate-currentState', 'green', null ],\n [ 'componentDidUpdate-prevState', 'yellow' ],\n // setFavoriteColor('blue')\n [ 'shouldComponentUpdate-currentState', 'green', null ],\n [ 'shouldComponentUpdate-nextState', 'blue' ],\n [ 'componentWillUpdate-currentState', 'green', null ],\n [ 'componentWillUpdate-nextState', 'blue' ],\n [ 'render', 'blue', null ],\n [ 'componentDidUpdate-currentState', 'blue', null ],\n [ 'componentDidUpdate-prevState', 'green' ],\n // forceUpdate()\n [ 'componentWillUpdate-currentState', 'blue', null ],\n [ 'componentWillUpdate-nextState', 'blue' ],\n [ 'render', 'blue', null ],\n [ 'componentDidUpdate-currentState', 'blue', null ],\n [ 'componentDidUpdate-prevState', 'blue' ],\n // unmountComponent()\n // state is available within `componentWillUnmount()`\n [ 'componentWillUnmount', 'blue', null ]\n ]);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactCompositeComponentState-test\", module);\n",
"core/__tests__/ReactDOM-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\nvar ReactDOM = require(\"../../ReactDOM\");\nvar ReactMount = require(\"../../ReactMount\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\n\ndescribe('ReactDOM', function() {\n // TODO: uncomment this test once we can run in phantom, which\n // supports real submit events.\n /*\n it('should bubble onSubmit', function() {\n var count = 0;\n var form;\n var Parent = React.createClass({\n handleSubmit: function() {\n count++;\n return false;\n },\n render: function() {\n return <Child />;\n }\n });\n var Child = React.createClass({\n render: function() {\n return <form><input type=\"submit\" value=\"Submit\" /></form>;\n },\n componentDidMount: function(node) {\n form = node;\n }\n });\n var instance = ReactTestUtils.renderIntoDocument(<Parent />);\n form.submit();\n expect(count).toEqual(1);\n });\n */\n\n it(\"should allow children to be passed as an argument\", function() {\n var argDiv = ReactTestUtils.renderIntoDocument(\n ReactDOM.div(null, 'child')\n );\n var argNode = ReactMount.getNode(argDiv._rootNodeID);\n expect(argNode.innerHTML).toBe('child');\n });\n\n it(\"should overwrite props.children with children argument\", function() {\n var conflictDiv = ReactTestUtils.renderIntoDocument(\n ReactDOM.div({children: 'fakechild'}, 'child')\n );\n var conflictNode = ReactMount.getNode(conflictDiv._rootNodeID);\n expect(conflictNode.innerHTML).toBe('child');\n });\n\n /**\n * We need to make sure that updates occur to the actual node that's in the\n * DOM, instead of a stale cache.\n */\n it(\"should purge the DOM cache when removing nodes\", function() {\n var myDiv = ReactTestUtils.renderIntoDocument(\n React.DOM.div(null, {\n theDog: React.DOM.div( {className:\"dog\"} ),\n theBird: React.DOM.div( {className:\"bird\"} )\n })\n );\n // Warm the cache with theDog\n myDiv.setProps({\n children: {\n theDog: React.DOM.div( {className:\"dogbeforedelete\"} ),\n theBird: React.DOM.div( {className:\"bird\"} )\n }\n });\n // Remove theDog - this should purge the cache\n myDiv.setProps({\n children: {\n theBird: React.DOM.div( {className:\"bird\"} )\n }\n });\n // Now, put theDog back. It's now a different DOM node.\n myDiv.setProps({\n children: {\n theDog: React.DOM.div( {className:\"dog\"} ),\n theBird: React.DOM.div( {className:\"bird\"} )\n }\n });\n // Change the className of theDog. It will use the same element\n myDiv.setProps({\n children: {\n theDog: React.DOM.div( {className:\"bigdog\"} ),\n theBird: React.DOM.div( {className:\"bird\"} )\n }\n });\n var root = ReactMount.getNode(myDiv._rootNodeID);\n var dog = root.childNodes[0];\n expect(dog.className).toBe('bigdog');\n });\n\n it('should be a valid class', function() {\n expect(React.isValidClass(ReactDOM.div)).toBe(true);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactDOM-test\", module);\n",
"core/__tests__/ReactDOMComponent-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\n\ndescribe('ReactDOMComponent', function() {\n\n describe('updateDOM', function() {\n var React;\n var ReactTestUtils;\n var transaction;\n\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n\n var ReactReconcileTransaction = require(\"../../ReactReconcileTransaction\");\n transaction = new ReactReconcileTransaction();\n });\n\n it(\"should handle className\", function() {\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {style:{}} ));\n\n stub.receiveProps({ className: 'foo' }, transaction);\n expect(stub.getDOMNode().className).toEqual('foo');\n stub.receiveProps({ className: 'bar' }, transaction);\n expect(stub.getDOMNode().className).toEqual('bar');\n stub.receiveProps({ className: null }, transaction);\n expect(stub.getDOMNode().className).toEqual('');\n });\n\n it(\"should gracefully handle various style value types\", function() {\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {style:{}} ));\n var stubStyle = stub.getDOMNode().style;\n\n // set initial style\n var setup = { display: 'block', left: '1', top: 2, fontFamily: 'Arial' };\n stub.receiveProps({ style: setup }, transaction);\n expect(stubStyle.display).toEqual('block');\n expect(stubStyle.left).toEqual('1px');\n expect(stubStyle.fontFamily).toEqual('Arial');\n\n // reset the style to their default state\n var reset = { display: '', left: null, top: false, fontFamily: true };\n stub.receiveProps({ style: reset }, transaction);\n expect(stubStyle.display).toEqual('');\n expect(stubStyle.left).toEqual('');\n expect(stubStyle.top).toEqual('');\n expect(stubStyle.fontFamily).toEqual('');\n });\n\n it(\"should update styles when mutating style object\", function() {\n var styles = { display: 'none', fontFamily: 'Arial', opacity: 0 };\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {style:styles} ));\n\n var stubStyle = stub.getDOMNode().style;\n stubStyle.display = styles.display;\n stubStyle.fontFamily = styles.fontFamily;\n\n styles.display = 'block';\n\n stub.receiveProps({ style: styles }, transaction);\n expect(stubStyle.display).toEqual('block');\n expect(stubStyle.fontFamily).toEqual('Arial');\n expect(stubStyle.opacity).toEqual('0');\n\n styles.fontFamily = 'Helvetica';\n\n stub.receiveProps({ style: styles }, transaction);\n expect(stubStyle.display).toEqual('block');\n expect(stubStyle.fontFamily).toEqual('Helvetica');\n expect(stubStyle.opacity).toEqual('0');\n\n styles.opacity = 0.5;\n\n stub.receiveProps({ style: styles }, transaction);\n expect(stubStyle.display).toEqual('block');\n expect(stubStyle.fontFamily).toEqual('Helvetica');\n expect(stubStyle.opacity).toEqual('0.5');\n });\n\n it(\"should update styles if initially null\", function() {\n var styles = null;\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {style:styles} ));\n\n var stubStyle = stub.getDOMNode().style;\n\n styles = {display: 'block'};\n\n stub.receiveProps({ style: styles }, transaction);\n expect(stubStyle.display).toEqual('block');\n });\n\n it(\"should remove attributes\", function() {\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.img( {height:\"17\"} ));\n\n expect(stub.getDOMNode().hasAttribute('height')).toBe(true);\n stub.receiveProps({}, transaction);\n expect(stub.getDOMNode().hasAttribute('height')).toBe(false);\n });\n\n it(\"should remove properties\", function() {\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {className:\"monkey\"} ));\n\n expect(stub.getDOMNode().className).toEqual('monkey');\n stub.receiveProps({}, transaction);\n expect(stub.getDOMNode().className).toEqual('');\n });\n\n it(\"should clear a single style prop when changing 'style'\", function() {\n var styles = {display: 'none', color: 'red'};\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {style:styles} ));\n\n var stubStyle = stub.getDOMNode().style;\n\n styles = {color: 'green'};\n stub.receiveProps({ style: styles }, transaction);\n expect(stubStyle.display).toEqual('');\n expect(stubStyle.color).toEqual('green');\n });\n\n it(\"should clear all the styles when removing 'style'\", function() {\n var styles = {display: 'none', color: 'red'};\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {style:styles} ));\n\n var stubStyle = stub.getDOMNode().style;\n\n stub.receiveProps({}, transaction);\n expect(stubStyle.display).toEqual('');\n expect(stubStyle.color).toEqual('');\n });\n\n it(\"should empty element when removing innerHTML\", function() {\n var stub = ReactTestUtils.renderIntoDocument(\n React.DOM.div( {dangerouslySetInnerHTML:{__html: ':)'}} )\n );\n\n expect(stub.getDOMNode().innerHTML).toEqual(':)');\n stub.receiveProps({}, transaction);\n expect(stub.getDOMNode().innerHTML).toEqual('');\n });\n\n it(\"should transition from string content to innerHTML\", function() {\n var stub = ReactTestUtils.renderIntoDocument(\n React.DOM.div(null, \"hello\")\n );\n\n expect(stub.getDOMNode().innerHTML).toEqual('hello');\n stub.receiveProps(\n {dangerouslySetInnerHTML: {__html: 'goodbye'}},\n transaction\n );\n expect(stub.getDOMNode().innerHTML).toEqual('goodbye');\n });\n\n it(\"should transition from innerHTML to string content\", function() {\n var stub = ReactTestUtils.renderIntoDocument(\n React.DOM.div( {dangerouslySetInnerHTML:{__html: 'bonjour'}} )\n );\n\n expect(stub.getDOMNode().innerHTML).toEqual('bonjour');\n stub.receiveProps({children: 'adieu'}, transaction);\n expect(stub.getDOMNode().innerHTML).toEqual('adieu');\n });\n\n it(\"should not incur unnecessary DOM mutations\", function() {\n var stub = ReactTestUtils.renderIntoDocument(React.DOM.div( {value:\"\"} ));\n\n var node = stub.getDOMNode();\n var nodeValue = node.value;\n var nodeValueSetter = mocks.getMockFunction();\n Object.defineProperty(node, 'value', {\n get: function() {\n return nodeValue;\n },\n set: nodeValueSetter.mockImplementation(function(newValue) {\n nodeValue = newValue;\n })\n });\n\n stub.receiveProps({value: ''}, transaction);\n expect(nodeValueSetter.mock.calls.length).toBe(0);\n\n stub.receiveProps({}, transaction);\n expect(nodeValueSetter.mock.calls.length).toBe(1);\n });\n });\n\n describe('createOpenTagMarkup', function() {\n var genMarkup;\n\n function quoteRegexp(str) {\n return (str+'').replace(/([.?*+\\^$\\[\\]\\\\(){}|-])/g, \"\\\\$1\");\n }\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n\n var ReactDefaultInjection = require(\"../../ReactDefaultInjection\");\n ReactDefaultInjection.inject();\n\n var mixInto = require(\"../../mixInto\");\n var ReactDOMComponent = require(\"../../ReactDOMComponent\");\n\n var NodeStub = function(initialProps) {\n this.props = initialProps || {};\n this._rootNodeID = 'test';\n };\n mixInto(NodeStub, ReactDOMComponent.Mixin);\n\n genMarkup = function(props) {\n return (new NodeStub(props))._createOpenTagMarkup();\n };\n\n this.addMatchers({\n toHaveAttribute: function(attr, value) {\n var expected = '(?:^|\\\\s)' + attr + '=[\\\\\\'\"]';\n if (typeof value != 'undefined') {\n expected += quoteRegexp(value) + '[\\\\\\'\"]';\n }\n return this.actual.match(new RegExp(expected));\n }\n });\n });\n\n it(\"should generate the correct markup with className\", function() {\n expect(genMarkup({ className: 'a' })).toHaveAttribute('class', 'a');\n expect(genMarkup({ className: 'a b' })).toHaveAttribute('class', 'a b');\n expect(genMarkup({ className: '' })).toHaveAttribute('class', '');\n });\n });\n\n describe('createContentMarkup', function() {\n var genMarkup;\n\n function quoteRegexp(str) {\n return (str+'').replace(/([.?*+\\^$\\[\\]\\\\(){}|-])/g, \"\\\\$1\");\n }\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n\n var mixInto = require(\"../../mixInto\");\n var ReactDOMComponent = require(\"../../ReactDOMComponent\");\n var ReactReconcileTransaction = require(\"../../ReactReconcileTransaction\");\n\n var NodeStub = function(initialProps) {\n this.props = initialProps || {};\n this._rootNodeID = 'test';\n };\n mixInto(NodeStub, ReactDOMComponent.Mixin);\n\n genMarkup = function(props) {\n var transaction = new ReactReconcileTransaction();\n return (new NodeStub(props))._createContentMarkup(transaction);\n };\n\n this.addMatchers({\n toHaveInnerhtml: function(html) {\n var expected = '^' + quoteRegexp(html) + '$';\n return this.actual.match(new RegExp(expected));\n }\n });\n });\n\n it(\"should handle dangerouslySetInnerHTML\", function() {\n var innerHTML = {__html: 'testContent'};\n expect(\n genMarkup({ dangerouslySetInnerHTML: innerHTML })\n ).toHaveInnerhtml('testContent');\n });\n });\n\n describe('mountComponent', function() {\n var mountComponent;\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n\n var mixInto = require(\"../../mixInto\");\n var ReactComponent = require(\"../../ReactComponent\");\n var ReactMultiChild = require(\"../../ReactMultiChild\");\n var ReactDOMComponent = require(\"../../ReactDOMComponent\");\n var ReactReconcileTransaction = require(\"../../ReactReconcileTransaction\");\n\n var StubNativeComponent = function(initialProps) {\n ReactComponent.Mixin.construct.call(this, initialProps);\n };\n mixInto(StubNativeComponent, ReactComponent.Mixin);\n mixInto(StubNativeComponent, ReactDOMComponent.Mixin);\n mixInto(StubNativeComponent, ReactMultiChild.Mixin);\n\n mountComponent = function(props) {\n var transaction = new ReactReconcileTransaction();\n var stubComponent = new StubNativeComponent(props);\n return stubComponent.mountComponent('test', transaction, 0);\n };\n });\n\n it(\"should validate against multiple children props\", function() {\n expect(function() {\n mountComponent({ children: '', dangerouslySetInnerHTML: '' });\n }).toThrow(\n 'Invariant Violation: Can only set one of `children` or ' +\n '`props.dangerouslySetInnerHTML`.'\n );\n });\n\n it(\"should validate against invalid styles\", function() {\n expect(function() {\n mountComponent({ style: 'display: none' });\n }).toThrow(\n 'Invariant Violation: The `style` prop expects a mapping from style ' +\n 'properties to values, not a string.'\n );\n });\n });\n\n describe('unmountComponent', function() {\n it(\"should clean up listeners\", function() {\n var React = require(\"../../React\");\n var ReactEventEmitter = require(\"../../ReactEventEmitter\");\n var ReactMount = require(\"../../ReactMount\");\n\n var container = document.createElement('div');\n document.documentElement.appendChild(container);\n\n var callback = function() {};\n var instance = React.DOM.div( {onClick:callback} );\n React.renderComponent(instance, container);\n\n var rootNode = instance.getDOMNode();\n var rootNodeID = ReactMount.getID(rootNode);\n expect(\n ReactEventEmitter.getListener(rootNodeID, 'onClick')\n ).toBe(callback);\n\n React.unmountComponentAtNode(container);\n\n expect(\n ReactEventEmitter.getListener(rootNodeID, 'onClick')\n ).toBe(undefined);\n });\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactDOMComponent-test\", module);\n",
"core/__tests__/ReactDOMIDOperations-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\ndescribe('ReactDOMIDOperations', function() {\n var DOMPropertyOperations = require(\"../../DOMPropertyOperations\");\n var ReactDOMIDOperations = require(\"../../ReactDOMIDOperations\");\n var ReactMount = require(\"../../ReactMount\");\n var keyOf = require(\"../../keyOf\");\n\n it('should disallow updating special properties', function() {\n spyOn(ReactMount, \"getNode\");\n spyOn(DOMPropertyOperations, \"setValueForProperty\");\n\n expect(function() {\n ReactDOMIDOperations.updatePropertyByID(\n 'testID',\n keyOf({dangerouslySetInnerHTML: null}),\n {__html: 'testContent'}\n );\n }).toThrow();\n\n expect(\n ReactMount.getNode.argsForCall[0][0]\n ).toBe('testID');\n\n expect(\n DOMPropertyOperations.setValueForProperty.callCount\n ).toBe(0);\n });\n\n it('should update innerHTML and special-case whitespace', function() {\n var stubNode = document.createElement('div');\n spyOn(ReactMount, \"getNode\").andReturn(stubNode);\n\n ReactDOMIDOperations.updateInnerHTMLByID(\n 'testID',\n ' testContent'\n );\n\n expect(\n ReactMount.getNode.argsForCall[0][0]\n ).toBe('testID');\n\n expect(stubNode.innerHTML).toBe('&nbsp;testContent');\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactDOMIDOperations-test\", module);\n",
"core/__tests__/ReactEventEmitter-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\")\n .dontMock('BrowserScroll')\n .dontMock('CallbackRegistry')\n .dontMock('EventPluginHub')\n .dontMock('ReactMount')\n .dontMock('ReactEventEmitter')\n .dontMock('ReactInstanceHandles')\n .dontMock('EventPluginHub')\n .dontMock('TapEventPlugin')\n .dontMock('TouchEventUtils')\n .dontMock('keyOf');\n\n\nvar keyOf = require(\"../../keyOf\");\nvar mocks = require(\"../../mocks\");\n\nvar EventPluginHub;\nvar ReactMount = require(\"../../ReactMount\");\nvar getID = ReactMount.getID;\nvar setID = ReactMount.setID;\nvar ReactEventEmitter;\nvar ReactTestUtils;\nvar TapEventPlugin;\n\nvar tapMoveThreshold;\nvar idCallOrder = [];\nvar recordID = function(id) {\n idCallOrder.push(id);\n};\nvar recordIDAndStopPropagation = function(id, event) {\n recordID(id);\n event.stopPropagation();\n};\nvar recordIDAndReturnFalse = function(id, event) {\n recordID(id);\n return false;\n};\nvar LISTENER = mocks.getMockFunction();\nvar ON_CLICK_KEY = keyOf({onClick: null});\nvar ON_TOUCH_TAP_KEY = keyOf({onTouchTap: null});\n\n\n/**\n * Since `ReactEventEmitter` is fairly well separated from the DOM, we can test\n * almost all of `ReactEventEmitter` without ever rendering anything in the DOM.\n * As long as we provide IDs that follow `React's` conventional id namespace\n * hierarchy. The only reason why we create these DOM nodes, is so that when we\n * feed them into `ReactEventEmitter` (through `ReactTestUtils`), the event\n * handlers may receive a DOM node to inspect.\n */\nvar CHILD = document.createElement('div');\nvar PARENT = document.createElement('div');\nvar GRANDPARENT = document.createElement('div');\nsetID(CHILD, '.reactRoot.[0].[0].[0]');\nsetID(PARENT, '.reactRoot.[0].[0]');\nsetID(GRANDPARENT, '.reactRoot.[0]');\n\nfunction registerSimpleTestHandler() {\n ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, LISTENER);\n var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY);\n expect(listener).toEqual(LISTENER);\n return ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY);\n}\n\n\ndescribe('ReactEventEmitter', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n EventPluginHub = require(\"../../EventPluginHub\");\n TapEventPlugin = require(\"../../TapEventPlugin\");\n ReactMount = require(\"../../ReactMount\");\n getID = ReactMount.getID;\n setID = ReactMount.setID;\n ReactEventEmitter = require(\"../../ReactEventEmitter\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n idCallOrder = [];\n tapMoveThreshold = TapEventPlugin.tapMoveThreshold;\n ReactEventEmitter.ensureListening(false, document);\n EventPluginHub.injection.injectEventPluginsByName({\n TapEventPlugin: TapEventPlugin\n });\n });\n\n it('should store a listener correctly', function() {\n registerSimpleTestHandler();\n var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY);\n expect(listener).toBe(LISTENER);\n });\n\n it('should retrieve a listener correctly', function() {\n registerSimpleTestHandler();\n var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY);\n expect(listener).toEqual(LISTENER);\n });\n\n it('should clear all handlers when asked to', function() {\n registerSimpleTestHandler();\n ReactEventEmitter.deleteAllListeners(getID(CHILD));\n var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY);\n expect(listener).toBe(undefined);\n });\n\n it('should invoke a simple handler registered on a node', function() {\n registerSimpleTestHandler();\n ReactTestUtils.Simulate.click(CHILD);\n expect(LISTENER.mock.calls.length).toBe(1);\n });\n\n it('should not invoke handlers if ReactEventEmitter is disabled', function() {\n registerSimpleTestHandler();\n ReactEventEmitter.setEnabled(false);\n ReactTestUtils.Simulate.click(CHILD);\n expect(LISTENER.mock.calls.length).toBe(0);\n ReactEventEmitter.setEnabled(true);\n ReactTestUtils.Simulate.click(CHILD);\n expect(LISTENER.mock.calls.length).toBe(1);\n });\n\n it('should bubble simply', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_CLICK_KEY,\n recordID.bind(null, getID(CHILD))\n );\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(PARENT))\n );\n ReactEventEmitter.putListener(\n getID(GRANDPARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(GRANDPARENT))\n );\n ReactTestUtils.Simulate.click(CHILD);\n expect(idCallOrder.length).toBe(3);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n expect(idCallOrder[1]).toBe(getID(PARENT));\n expect(idCallOrder[2]).toBe(getID(GRANDPARENT));\n });\n\n it('should support stopPropagation()', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_CLICK_KEY,\n recordID.bind(null, getID(CHILD))\n );\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_CLICK_KEY,\n recordIDAndStopPropagation.bind(null, getID(PARENT))\n );\n ReactEventEmitter.putListener(\n getID(GRANDPARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(GRANDPARENT))\n );\n ReactTestUtils.Simulate.click(CHILD);\n expect(idCallOrder.length).toBe(2);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n expect(idCallOrder[1]).toBe(getID(PARENT));\n });\n\n it('should stop after first dispatch if stopPropagation', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_CLICK_KEY,\n recordIDAndStopPropagation.bind(null, getID(CHILD))\n );\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(PARENT))\n );\n ReactEventEmitter.putListener(\n getID(GRANDPARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(GRANDPARENT))\n );\n ReactTestUtils.Simulate.click(CHILD);\n expect(idCallOrder.length).toBe(1);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n });\n\n it('should stopPropagation if false is returned', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_CLICK_KEY,\n recordIDAndReturnFalse.bind(null, getID(CHILD))\n );\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(PARENT))\n );\n ReactEventEmitter.putListener(\n getID(GRANDPARENT),\n ON_CLICK_KEY,\n recordID.bind(null, getID(GRANDPARENT))\n );\n ReactTestUtils.Simulate.click(CHILD);\n expect(idCallOrder.length).toBe(1);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n });\n\n /**\n * The entire event registration state of the world should be \"locked-in\" at\n * the time the event occurs. This is to resolve many edge cases that come\n * about from a listener on a lower-in-DOM node causing structural changes at\n * places higher in the DOM. If this lower-in-DOM node causes new content to\n * be rendered at a place higher-in-DOM, we need to be careful not to invoke\n * these new listeners.\n */\n\n it('should invoke handlers that were removed while bubbling', function() {\n var handleParentClick = mocks.getMockFunction();\n var handleChildClick = function(event) {\n ReactEventEmitter.deleteAllListeners(getID(PARENT));\n };\n ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, handleChildClick);\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_CLICK_KEY,\n handleParentClick\n );\n ReactTestUtils.Simulate.click(CHILD);\n expect(handleParentClick.mock.calls.length).toBe(1);\n });\n\n it('should not invoke newly inserted handlers while bubbling', function() {\n var handleParentClick = mocks.getMockFunction();\n var handleChildClick = function(event) {\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_CLICK_KEY,\n handleParentClick\n );\n };\n ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, handleChildClick);\n ReactTestUtils.Simulate.click(CHILD);\n expect(handleParentClick.mock.calls.length).toBe(0);\n });\n\n it('should infer onTouchTap from a touchStart/End', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_TOUCH_TAP_KEY,\n recordID.bind(null, getID(CHILD))\n );\n ReactTestUtils.Simulate.touchStart(\n CHILD,\n ReactTestUtils.nativeTouchData(0, 0)\n );\n ReactTestUtils.Simulate.touchEnd(\n CHILD,\n ReactTestUtils.nativeTouchData(0, 0)\n );\n expect(idCallOrder.length).toBe(1);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n });\n\n it('should infer onTouchTap from when dragging below threshold', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_TOUCH_TAP_KEY,\n recordID.bind(null, getID(CHILD))\n );\n ReactTestUtils.Simulate.touchStart(\n CHILD,\n ReactTestUtils.nativeTouchData(0, 0)\n );\n ReactTestUtils.Simulate.touchEnd(\n CHILD,\n ReactTestUtils.nativeTouchData(0, tapMoveThreshold - 1)\n );\n expect(idCallOrder.length).toBe(1);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n });\n\n it('should not onTouchTap from when dragging beyond threshold', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_TOUCH_TAP_KEY,\n recordID.bind(null, getID(CHILD))\n );\n ReactTestUtils.Simulate.touchStart(\n CHILD,\n ReactTestUtils.nativeTouchData(0, 0)\n );\n ReactTestUtils.Simulate.touchEnd(\n CHILD,\n ReactTestUtils.nativeTouchData(0, tapMoveThreshold + 1)\n );\n expect(idCallOrder.length).toBe(0);\n });\n\n\n it('should bubble onTouchTap', function() {\n ReactEventEmitter.putListener(\n getID(CHILD),\n ON_TOUCH_TAP_KEY,\n recordID.bind(null, getID(CHILD))\n );\n ReactEventEmitter.putListener(\n getID(PARENT),\n ON_TOUCH_TAP_KEY,\n recordID.bind(null, getID(PARENT))\n );\n ReactEventEmitter.putListener(\n getID(GRANDPARENT),\n ON_TOUCH_TAP_KEY,\n recordID.bind(null, getID(GRANDPARENT))\n );\n ReactTestUtils.Simulate.touchStart(\n CHILD,\n ReactTestUtils.nativeTouchData(0, 0)\n );\n ReactTestUtils.Simulate.touchEnd(\n CHILD,\n ReactTestUtils.nativeTouchData(0, 0)\n );\n expect(idCallOrder.length).toBe(3);\n expect(idCallOrder[0]).toBe(getID(CHILD));\n expect(idCallOrder[1]).toBe(getID(PARENT));\n expect(idCallOrder[2]).toBe(getID(GRANDPARENT));\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactEventEmitter-test\", module);\n",
"core/__tests__/ReactIdentity-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTestUtils;\nvar reactComponentExpect;\nvar ReactMount;\n\ndescribe('ReactIdentity', function() {\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n ReactMount = require(\"../../ReactMount\");\n });\n\n var idExp = /^\\.r\\[.+?\\](.*)$/;\n function checkId(child, expectedId) {\n var actual = idExp.exec(ReactMount.getID(child));\n var expected = idExp.exec(expectedId);\n expect(actual).toBeTruthy();\n expect(expected).toBeTruthy();\n expect(actual[1]).toEqual(expected[1]);\n }\n\n it('should allow keyed objects to express identity', function() {\n var instance =\n React.DOM.div(null, \n {\n first: React.DOM.div(null ),\n second: React.DOM.div(null )\n }\n );\n\n React.renderComponent(instance, document.createElement('div'));\n var node = instance.getDOMNode();\n reactComponentExpect(instance).toBeDOMComponentWithChildCount(2);\n checkId(node.childNodes[0], '.r[0].{first}');\n checkId(node.childNodes[1], '.r[0].{second}');\n });\n\n it('should allow key property to express identity', function() {\n var instance =\n React.DOM.div(null, \n React.DOM.div( {key:\"apple\"} ),\n React.DOM.div( {key:\"banana\"} ),\n React.DOM.div( {key:0} ),\n React.DOM.div( {key:123} )\n );\n\n React.renderComponent(instance, document.createElement('div'));\n var node = instance.getDOMNode();\n reactComponentExpect(instance).toBeDOMComponentWithChildCount(4);\n checkId(node.childNodes[0], '.r[0].{apple}');\n checkId(node.childNodes[1], '.r[0].{banana}');\n checkId(node.childNodes[2], '.r[0].{0}');\n checkId(node.childNodes[3], '.r[0].{123}');\n });\n\n it('should use instance identity', function() {\n\n var Wrapper = React.createClass({displayName: 'Wrapper',\n render: function() {\n return React.DOM.a( {key:\"i_get_overwritten\"}, this.props.children);\n }\n });\n\n var instance =\n React.DOM.div(null, \n Wrapper( {key:\"wrap1\"}, React.DOM.span( {key:\"squirrel\"} )),\n Wrapper( {key:\"wrap2\"}, React.DOM.span( {key:\"bunny\"} )),\n Wrapper(null, React.DOM.span( {key:\"chipmunk\"} ))\n );\n\n React.renderComponent(instance, document.createElement('div'));\n var node = instance.getDOMNode();\n reactComponentExpect(instance).toBeDOMComponentWithChildCount(3);\n\n checkId(node.childNodes[0], '.r[0].{wrap1}');\n checkId(node.childNodes[0].firstChild, '.r[0].{wrap1}.{squirrel}');\n checkId(node.childNodes[1], '.r[0].{wrap2}');\n checkId(node.childNodes[1].firstChild, '.r[0].{wrap2}.{bunny}');\n checkId(node.childNodes[2], '.r[0].[2]');\n checkId(node.childNodes[2].firstChild, '.r[0].[2].{chipmunk}');\n });\n\n function renderAComponentWithKeyIntoContainer(key, container) {\n var span1 = React.DOM.span( {key:key} );\n var span2 = React.DOM.span(null );\n\n var map = {};\n map[key] = span2;\n\n React.renderComponent(React.DOM.div(null, [span1, map]), container);\n\n expect(span1.getDOMNode()).not.toBe(null);\n expect(span2.getDOMNode()).not.toBe(null);\n\n checkId(span1.getDOMNode(), '.r[0].{' + key + '}');\n checkId(span2.getDOMNode(), '.r[0].[1]{' + key + '}');\n }\n\n it('should allow any character as a key, in a detached parent', function() {\n var detachedContainer = document.createElement('div');\n renderAComponentWithKeyIntoContainer(\"<'WEIRD/&\\\\key'>\", detachedContainer);\n });\n\n it('should allow any character as a key, in an attached parent', function() {\n // This test exists to protect against implementation details that\n // incorrectly query escaped IDs using DOM tools like getElementById.\n var attachedContainer = document.createElement('div');\n document.body.appendChild(attachedContainer);\n\n renderAComponentWithKeyIntoContainer(\"<'WEIRD/&\\\\key'>\", attachedContainer);\n\n document.body.removeChild(attachedContainer);\n });\n\n it('should not allow scripts in keys to execute', function() {\n var h4x0rKey = '\"><script>window.YOUVEBEENH4X0RED=true;</script><div id=\"';\n\n var attachedContainer = document.createElement('div');\n document.body.appendChild(attachedContainer);\n\n renderAComponentWithKeyIntoContainer(h4x0rKey, attachedContainer);\n\n document.body.removeChild(attachedContainer);\n\n // If we get this far, make sure we haven't executed the code\n expect(window.YOUVEBEENH4X0RED).toBe(undefined);\n });\n\n it('should let restructured components retain their uniqueness', function() {\n var instance0 = React.DOM.span(null );\n var instance1 = React.DOM.span(null );\n var instance2 = React.DOM.span(null );\n\n var TestComponent = React.createClass({displayName: 'TestComponent',\n render: function() {\n return (\n React.DOM.div(null, \n instance2,\n this.props.children[0],\n this.props.children[1]\n )\n );\n }\n });\n\n var TestContainer = React.createClass({displayName: 'TestContainer',\n\n render: function() {\n return TestComponent(null, instance0, instance1);\n }\n\n });\n\n expect(function() {\n\n React.renderComponent(TestContainer(null ), document.createElement('div'));\n\n }).not.toThrow();\n });\n\n it('should let nested restructures retain their uniqueness', function() {\n var instance0 = React.DOM.span(null );\n var instance1 = React.DOM.span(null );\n var instance2 = React.DOM.span(null );\n\n var TestComponent = React.createClass({displayName: 'TestComponent',\n render: function() {\n return (\n React.DOM.div(null, \n instance2,\n this.props.children[0],\n this.props.children[1]\n )\n );\n }\n });\n\n var TestContainer = React.createClass({displayName: 'TestContainer',\n\n render: function() {\n return (\n React.DOM.div(null, \n TestComponent(null, instance0, instance1)\n )\n );\n }\n\n });\n\n expect(function() {\n\n React.renderComponent(TestContainer(null ), document.createElement('div'));\n\n }).not.toThrow();\n });\n\n it('should let text nodes retain their uniqueness', function() {\n var TestComponent = React.createClass({displayName: 'TestComponent',\n render: function() {\n return React.DOM.div(null, this.props.children,React.DOM.span(null ));\n }\n });\n\n var TestContainer = React.createClass({displayName: 'TestContainer',\n\n render: function() {\n return (\n TestComponent(null, \n React.DOM.div(null ),\n 'second'\n )\n );\n }\n\n });\n\n expect(function() {\n\n React.renderComponent(TestContainer(null ), document.createElement('div'));\n\n }).not.toThrow();\n });\n\n it('should retain key during updates in composite components', function() {\n\n var TestComponent = React.createClass({displayName: 'TestComponent',\n render: function() {\n return React.DOM.div(null, this.props.children);\n }\n });\n\n var TestContainer = React.createClass({displayName: 'TestContainer',\n\n getInitialState: function() {\n return { swapped: false };\n },\n\n swap: function() {\n this.setState({ swapped: true });\n },\n\n render: function() {\n return (\n TestComponent(null, \n this.state.swapped ? this.props.second : this.props.first,\n this.state.swapped ? this.props.first : this.props.second\n )\n );\n }\n\n });\n\n var instance0 = React.DOM.span( {key:\"A\"} );\n var instance1 = React.DOM.span( {key:\"B\"} );\n\n var wrapped = TestContainer( {first:instance0, second:instance1} );\n\n React.renderComponent(wrapped, document.createElement('div'));\n\n var beforeID = ReactMount.getID(wrapped.getDOMNode().firstChild);\n\n wrapped.swap();\n\n var afterID = ReactMount.getID(wrapped.getDOMNode().firstChild);\n\n expect(beforeID).not.toEqual(afterID);\n\n });\n\n it('should not allow implicit and explicit keys to collide', function() {\n var component =\n React.DOM.div(null, \n React.DOM.span(null ),\n React.DOM.span( {key:\"0\"} )\n );\n\n expect(function() {\n React.renderComponent(component, document.createElement('div'));\n }).not.toThrow();\n });\n\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactIdentity-test\", module);\n",
"core/__tests__/ReactInstanceHandles-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\nvar ReactMount = require(\"../../ReactMount\");\n\n/**\n * Ensure that all callbacks are invoked, passing this unique argument.\n */\nvar ARG = {arg: true};\nvar ARG2 = {arg2: true};\n\nvar ChildComponent = React.createClass({displayName: 'ChildComponent',\n render: function() {\n return (\n React.DOM.div( {ref:\"DIV\"}, \n React.DOM.div( {ref:\"DIV_1\"} ),\n React.DOM.div( {ref:\"DIV_2\"} )\n )\n );\n }\n});\n\nvar ParentComponent = React.createClass({displayName: 'ParentComponent',\n render: function() {\n return (\n React.DOM.div( {ref:\"P\"}, \n React.DOM.div( {ref:\"P_P1\"}, \n ChildComponent( {ref:\"P_P1_C1\"} ),\n ChildComponent( {ref:\"P_P1_C2\"} )\n ),\n React.DOM.div( {ref:\"P_OneOff\"} )\n )\n );\n }\n});\n\nfunction renderParentIntoDocument() {\n return ReactTestUtils.renderIntoDocument(ParentComponent(null ));\n}\n\ndescribe('ReactInstanceHandles', function() {\n var ReactInstanceHandles;\n\n var aggregatedArgs;\n function argAggregator(id, isUp, arg) {\n aggregatedArgs.push({\n id: id,\n isUp: isUp,\n arg: arg\n });\n }\n\n beforeEach(function() {\n ReactInstanceHandles = require(\"../../ReactInstanceHandles\");\n aggregatedArgs = [];\n });\n\n describe('isRenderedByReact', function() {\n it('should not crash on text nodes', function() {\n expect(function() {\n ReactMount.isRenderedByReact(document.createTextNode('yolo'));\n }).not.toThrow();\n });\n });\n\n describe('findComponentRoot', function() {\n it('should find the correct node with prefix sibling IDs', function() {\n var parentNode = document.createElement('div');\n var childNodeA = document.createElement('div');\n var childNodeB = document.createElement('div');\n parentNode.appendChild(childNodeA);\n parentNode.appendChild(childNodeB);\n\n ReactMount.setID(parentNode, '.react[0]');\n ReactMount.setID(childNodeA, '.react[0].0');\n ReactMount.setID(childNodeB, '.react[0].0:1');\n\n expect(\n ReactMount.findComponentRoot(\n parentNode,\n ReactMount.getID(childNodeB)\n )\n ).toBe(childNodeB);\n });\n\n it('should work around unidentified nodes', function() {\n var parentNode = document.createElement('div');\n var childNodeA = document.createElement('div');\n var childNodeB = document.createElement('div');\n parentNode.appendChild(childNodeA);\n parentNode.appendChild(childNodeB);\n\n ReactMount.setID(parentNode, '.react[0]');\n // No ID on `childNodeA`.\n ReactMount.setID(childNodeB, '.react[0].0:1');\n\n expect(\n ReactMount.findComponentRoot(\n parentNode,\n ReactMount.getID(childNodeB)\n )\n ).toBe(childNodeB);\n });\n\n it('should throw if a rendered element cannot be found', function() {\n var parentNode = document.createElement('table');\n var childNodeA = document.createElement('tbody');\n var childNodeB = document.createElement('tr');\n parentNode.appendChild(childNodeA);\n childNodeA.appendChild(childNodeB);\n\n ReactMount.setID(parentNode, '.react[0]');\n // No ID on `childNodeA`, it was \"rendered by the browser\".\n ReactMount.setID(childNodeB, '.react[0].1:0');\n\n expect(ReactMount.findComponentRoot(\n parentNode,\n ReactMount.getID(childNodeB)\n )).toBe(childNodeB);\n\n spyOn(console, 'error');\n expect(console.error.argsForCall.length).toBe(0);\n\n expect(function() {\n ReactMount.findComponentRoot(\n parentNode,\n ReactMount.getID(childNodeB) + \":junk\"\n );\n }).toThrow(\n 'Invariant Violation: findComponentRoot(..., .react[0].1:0:junk): ' +\n 'Unable to find element. This probably means the DOM was ' +\n 'unexpectedly mutated (e.g. by the browser).'\n );\n\n expect(console.error.argsForCall.length).toBe(1);\n });\n });\n\n describe('getReactRootIDFromNodeID', function() {\n it('should support strings', function() {\n var test = '.r[s_0_1][0]..[1]';\n var expected = '.r[s_0_1]';\n var actual = ReactInstanceHandles.getReactRootIDFromNodeID(test);\n expect(actual).toEqual(expected);\n });\n });\n\n describe('traverseTwoPhase', function() {\n it(\"should not traverse when traversing outside DOM\", function() {\n var targetID = '';\n var expectedAggregation = [];\n ReactInstanceHandles.traverseTwoPhase(targetID, argAggregator, ARG);\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should traverse two phase across component boundary\", function() {\n var parent = renderParentIntoDocument();\n var targetID = parent.refs.P_P1_C1.refs.DIV_1._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P._rootNodeID, isUp: false, arg: ARG},\n {id: parent.refs.P_P1._rootNodeID, isUp: false, arg: ARG},\n {id: parent.refs.P_P1_C1.refs.DIV._rootNodeID, isUp: false, arg: ARG},\n {id: parent.refs.P_P1_C1.refs.DIV_1._rootNodeID, isUp: false, arg: ARG},\n\n {id: parent.refs.P_P1_C1.refs.DIV_1._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P_P1_C1.refs.DIV._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P_P1._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P._rootNodeID, isUp: true, arg: ARG}\n ];\n ReactInstanceHandles.traverseTwoPhase(targetID, argAggregator, ARG);\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should traverse two phase at shallowest node\", function() {\n var parent = renderParentIntoDocument();\n var targetID = parent.refs.P._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P._rootNodeID, isUp: false, arg: ARG},\n {id: parent.refs.P._rootNodeID, isUp: true, arg: ARG}\n ];\n ReactInstanceHandles.traverseTwoPhase(targetID, argAggregator, ARG);\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n });\n\n describe('traverseEnterLeave', function() {\n it(\"should not traverse when enter/leaving outside DOM\", function() {\n var targetID = '';\n var expectedAggregation = [];\n ReactInstanceHandles.traverseEnterLeave(\n targetID, targetID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should not traverse if enter/leave the same node\", function() {\n var parent = renderParentIntoDocument();\n var leaveID = parent.refs.P_P1_C1.refs.DIV_1._rootNodeID;\n var enterID = parent.refs.P_P1_C1.refs.DIV_1._rootNodeID;\n var expectedAggregation = [];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should traverse enter/leave to sibling - avoids parent\", function() {\n var parent = renderParentIntoDocument();\n var leaveID = parent.refs.P_P1_C1.refs.DIV_1._rootNodeID;\n var enterID = parent.refs.P_P1_C1.refs.DIV_2._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P_P1_C1.refs.DIV_1._rootNodeID, isUp: true, arg: ARG},\n // enter/leave shouldn't fire antyhing on the parent\n {id: parent.refs.P_P1_C1.refs.DIV_2._rootNodeID, isUp: false, arg: ARG2}\n ];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should traverse enter/leave to parent - avoids parent\", function() {\n var parent = renderParentIntoDocument();\n var leaveID = parent.refs.P_P1_C1.refs.DIV_1._rootNodeID;\n var enterID = parent.refs.P_P1_C1.refs.DIV._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P_P1_C1.refs.DIV_1._rootNodeID, isUp: true, arg: ARG}\n ];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should enter from the window\", function() {\n var parent = renderParentIntoDocument();\n var leaveID = ''; // From the window or outside of the React sandbox.\n var enterID = parent.refs.P_P1_C1.refs.DIV._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P._rootNodeID, isUp: false, arg: ARG2},\n {id: parent.refs.P_P1._rootNodeID, isUp: false, arg: ARG2},\n {id: parent.refs.P_P1_C1.refs.DIV._rootNodeID, isUp: false, arg: ARG2}\n ];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should enter from the window to the shallowest\", function() {\n var parent = renderParentIntoDocument();\n var leaveID = ''; // From the window or outside of the React sandbox.\n var enterID = parent.refs.P._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P._rootNodeID, isUp: false, arg: ARG2}\n ];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should leave to the window\", function() {\n var parent = renderParentIntoDocument();\n var enterID = ''; // From the window or outside of the React sandbox.\n var leaveID = parent.refs.P_P1_C1.refs.DIV._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P_P1_C1.refs.DIV._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P_P1._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P._rootNodeID, isUp: true, arg: ARG}\n ];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n\n it(\"should leave to the window from the shallowest\", function() {\n var parent = renderParentIntoDocument();\n var enterID = ''; // From the window or outside of the React sandbox.\n var leaveID = parent.refs.P_P1_C1.refs.DIV._rootNodeID;\n var expectedAggregation = [\n {id: parent.refs.P_P1_C1.refs.DIV._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P_P1._rootNodeID, isUp: true, arg: ARG},\n {id: parent.refs.P._rootNodeID, isUp: true, arg: ARG}\n ];\n ReactInstanceHandles.traverseEnterLeave(\n leaveID, enterID, argAggregator, ARG, ARG2\n );\n expect(aggregatedArgs).toEqual(expectedAggregation);\n });\n });\n\n describe('getNextDescendantID', function() {\n it(\"should return next descendent from window\", function() {\n var parent = renderParentIntoDocument();\n expect(\n ReactInstanceHandles._getNextDescendantID(\n '',\n parent.refs.P_P1._rootNodeID\n )\n ).toBe(parent.refs.P._rootNodeID);\n });\n\n it(\"should return window for next descendent towards window\", function() {\n expect(ReactInstanceHandles._getNextDescendantID('', '')).toBe('');\n });\n\n it(\"should return self for next descendent towards self\", function() {\n var parent = renderParentIntoDocument();\n expect(\n ReactInstanceHandles._getNextDescendantID(\n parent.refs.P_P1._rootNodeID,\n parent.refs.P_P1._rootNodeID\n )\n ).toBe(parent.refs.P_P1._rootNodeID);\n });\n });\n\n describe('getFirstCommonAncestorID', function() {\n it(\"should determine the first common ancestor correctly\", function() {\n var parent = renderParentIntoDocument();\n var ancestors = [\n // Common ancestor from window to deep element is ''.\n { one: {_rootNodeID: ''},\n two: parent.refs.P_P1_C1.refs.DIV_1,\n com: {_rootNodeID: ''}\n },\n // Same as previous - reversed direction.\n { one: parent.refs.P_P1_C1.refs.DIV_1,\n two: {_rootNodeID: ''},\n com: {_rootNodeID: ''}\n },\n // Common ancestor from window to shallow id is ''.\n { one: parent.refs.P,\n two: {_rootNodeID: ''},\n com: {_rootNodeID: ''}\n },\n // Common ancestor with self is self.\n { one: parent.refs.P_P1_C1.refs.DIV_1,\n two: parent.refs.P_P1_C1.refs.DIV_1,\n com: parent.refs.P_P1_C1.refs.DIV_1\n },\n // Common ancestor with self is self - even if topmost DOM.\n { one: parent.refs.P, two: parent.refs.P, com: parent.refs.P },\n // Siblings\n {\n one: parent.refs.P_P1_C1.refs.DIV_1,\n two: parent.refs.P_P1_C1.refs.DIV_2,\n com: parent.refs.P_P1_C1.refs.DIV\n },\n // Common ancestor with parent is the parent.\n {\n one: parent.refs.P_P1_C1.refs.DIV_1,\n two: parent.refs.P_P1_C1.refs.DIV,\n com: parent.refs.P_P1_C1.refs.DIV\n },\n // Common ancestor with grandparent is the grandparent.\n {\n one: parent.refs.P_P1_C1.refs.DIV_1,\n two: parent.refs.P_P1_C1,\n com: parent.refs.P_P1_C1\n },\n // Grantparent across subcomponent boundaries.\n {\n one: parent.refs.P_P1_C1.refs.DIV_1,\n two: parent.refs.P_P1_C2.refs.DIV_1,\n com: parent.refs.P_P1\n },\n // Something deep with something one-off.\n {\n one: parent.refs.P_P1_C1.refs.DIV_1,\n two: parent.refs.P_OneOff,\n com: parent.refs.P\n }\n ];\n var i;\n for (i = 0; i < ancestors.length; i++) {\n var plan = ancestors[i];\n var firstCommon = ReactInstanceHandles._getFirstCommonAncestorID(\n plan.one._rootNodeID,\n plan.two._rootNodeID\n );\n expect(firstCommon).toBe(plan.com._rootNodeID);\n }\n });\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactInstanceHandles-test\", module);\n",
"core/__tests__/ReactMount-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\n\ndescribe('ReactMount', function() {\n var React = require(\"../../React\");\n var ReactMount = require(\"../../ReactMount\");\n\n it('should render different components in same root', function() {\n var container = document.createElement('container');\n document.documentElement.appendChild(container);\n\n ReactMount.renderComponent(React.DOM.div(null), container);\n expect(container.firstChild.nodeName).toBe('DIV');\n\n ReactMount.renderComponent(React.DOM.span(null), container);\n expect(container.firstChild.nodeName).toBe('SPAN');\n });\n\n it('should warn on unmountAndReleaseReactRootNode', function() {\n var _warn = console.warn;\n console.warn = mocks.getMockFunction();\n\n var container = document.createElement('container');\n ReactMount.renderComponent(React.DOM.span(null ), container);\n expect(console.warn.mock.calls.length).toBe(0);\n\n // This method should warn, nothing else should.\n ReactMount.unmountAndReleaseReactRootNode(container);\n expect(console.warn.mock.calls.length).toBe(1);\n\n ReactMount.renderComponent(React.DOM.span(null ), container);\n expect(console.warn.mock.calls.length).toBe(1);\n\n ReactMount.unmountComponentAtNode(container);\n expect(console.warn.mock.calls.length).toBe(1);\n\n console.warn = _warn;\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactMount-test\", module);\n",
"core/__tests__/ReactMountDestruction-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\n\ndescribe('ReactMount', function() {\n it(\"should destroy a react root upon request\", function() {\n var mainContainerDiv = document.createElement('div');\n document.documentElement.appendChild(mainContainerDiv);\n\n var instanceOne = (\n React.DOM.div( {className:\"firstReactDiv\"}\n )\n );\n var firstRootDiv = document.createElement('div');\n mainContainerDiv.appendChild(firstRootDiv);\n React.renderComponent(instanceOne, firstRootDiv);\n\n var instanceTwo = (\n React.DOM.div( {className:\"secondReactDiv\"}\n )\n );\n var secondRootDiv = document.createElement('div');\n mainContainerDiv.appendChild(secondRootDiv);\n React.renderComponent(instanceTwo, secondRootDiv);\n\n // Test that two react roots are rendered in isolation\n expect(firstRootDiv.getElementsByClassName('firstReactDiv').length)\n .toBe(1);\n expect(secondRootDiv.getElementsByClassName('secondReactDiv').length)\n .toBe(1);\n\n // Test that after unmounting each, they are no longer in the document.\n React.unmountComponentAtNode(firstRootDiv);\n expect(firstRootDiv.getElementsByClassName('firstReactDiv').length)\n .toBe(0);\n React.unmountComponentAtNode(secondRootDiv);\n expect(secondRootDiv.getElementsByClassName('secondReactDiv').length)\n .toBe(0);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactMountDestruction-test\", module);\n",
"core/__tests__/ReactMultiChild-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\ndescribe('ReactMultiChild', function() {\n var React;\n var setInnerHTML;\n\n // Only run this test suite if `Element.prototype.innerHTML` can be spied on.\n var innerHTMLDescriptor = Object.getOwnPropertyDescriptor(\n Element.prototype,\n 'innerHTML'\n );\n if (!innerHTMLDescriptor) {\n return;\n }\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n React = require(\"../../React\");\n\n Object.defineProperty(Element.prototype, 'innerHTML', {\n set: setInnerHTML = jasmine.createSpy().andCallFake(\n innerHTMLDescriptor.set\n )\n });\n });\n\n it('should only set `innerHTML` once on update', function() {\n var container = document.createElement('div');\n\n React.renderComponent(\n React.DOM.div(null, \n React.DOM.p(null, React.DOM.span(null )),\n React.DOM.p(null, React.DOM.span(null )),\n React.DOM.p(null, React.DOM.span(null ))\n ),\n container\n );\n // Warm the cache used by `getMarkupWrap`.\n React.renderComponent(\n React.DOM.div(null, \n React.DOM.p(null, React.DOM.span(null ),React.DOM.span(null )),\n React.DOM.p(null, React.DOM.span(null ),React.DOM.span(null )),\n React.DOM.p(null, React.DOM.span(null ),React.DOM.span(null ))\n ),\n container\n );\n expect(setInnerHTML).toHaveBeenCalled();\n var callCountOnMount = setInnerHTML.callCount;\n\n React.renderComponent(\n React.DOM.div(null, \n React.DOM.p(null, React.DOM.span(null ),React.DOM.span(null ),React.DOM.span(null )),\n React.DOM.p(null, React.DOM.span(null ),React.DOM.span(null ),React.DOM.span(null )),\n React.DOM.p(null, React.DOM.span(null ),React.DOM.span(null ),React.DOM.span(null ))\n ),\n container\n );\n expect(setInnerHTML.callCount).toBe(callCountOnMount + 1);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactMultiChild-test\", module);\n",
"core/__tests__/ReactMultiChildReconcile-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\");\n\nvar React = require(\"../../React\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\nvar ReactMount = require(\"../../ReactMount\");\n\nvar objMapKeyVal = require(\"../../objMapKeyVal\");\n\nvar stripEmptyValues = function(obj) {\n var ret = {};\n var name;\n for (name in obj) {\n if (!obj.hasOwnProperty(name)) {\n continue;\n }\n if (obj[name] !== null && obj[name] !== undefined) {\n ret[name] = obj[name];\n }\n }\n return ret;\n};\n\n/**\n * Child names is are wrapped in an prefix and suffix character. We strip those\n * out. This relies on a tiny implementation detail of the rendering system.\n */\nvar getOriginalKey = function(childName) {\n return childName.substr(1, childName.length - 2);\n};\n\n/**\n * Contains internal static internal state in order to test that updates to\n * existing children won't reinitialize components, when moving children -\n * reusing existing DOM/memory resources.\n */\nvar StatusDisplay = React.createClass({displayName: 'StatusDisplay',\n getInitialState: function() {\n return { internalState: Math.random() };\n },\n\n getStatus: function() {\n return this.props.status;\n },\n\n getInternalState: function() {\n return this.state.internalState;\n },\n\n render: function() {\n return (\n React.DOM.div(null, \n this.state.internalState\n )\n );\n }\n});\n\n/**\n * Displays friends statuses.\n */\nvar FriendsStatusDisplay = React.createClass({displayName: 'FriendsStatusDisplay',\n /**\n * Retrieves the rendered children in a nice format for comparing to the input\n * `this.props.usernameToStatus`. Gets the order directly from each rendered\n * child's `index` field. Refs are not maintained in the rendered order, and\n * neither is `this._renderedChildren` (surprisingly).\n */\n getStatusDisplays: function() {\n var name;\n var orderOfUsernames = [];\n var statusDisplays = this._renderedComponent._renderedChildren;\n for (name in statusDisplays) {\n var child = statusDisplays[name];\n var isPresent = !!child;\n if (isPresent) {\n orderOfUsernames[child._mountIndex] = getOriginalKey(name);\n }\n }\n var res = {};\n var i;\n for (i = 0; i < orderOfUsernames.length; i++) {\n var key = orderOfUsernames[i];\n res[key] = this.refs[key];\n }\n return res;\n },\n render: function() {\n var children = null;\n var key;\n for (key in this.props.usernameToStatus) {\n var status = this.props.usernameToStatus[key];\n children = children || {};\n children[key] = !status ? null :\n StatusDisplay( {ref:key, status:status} );\n }\n return (\n React.DOM.div(null, \n children\n )\n );\n }\n});\n\n\nfunction getInteralStateByUserName(statusDisplays) {\n return objMapKeyVal(statusDisplays, function(key, statusDisplay) {\n return statusDisplay.getInternalState();\n });\n}\n\n/**\n * Verifies that the rendered `StatusDisplay` instances match the `props` that\n * were responsible for allocating them. Checks the content of the user's status\n * message as well as the order of them.\n */\nfunction verifyStatuses(statusDisplays, props) {\n var nonEmptyStatusDisplays = stripEmptyValues(statusDisplays);\n var nonEmptyStatusProps = stripEmptyValues(props.usernameToStatus);\n var username;\n expect(Object.keys(nonEmptyStatusDisplays).length)\n .toEqual(Object.keys(nonEmptyStatusProps).length);\n for (username in nonEmptyStatusDisplays) {\n if (!nonEmptyStatusDisplays.hasOwnProperty(username)) {\n continue;\n }\n expect(nonEmptyStatusDisplays[username].getStatus())\n .toEqual(nonEmptyStatusProps[username]);\n }\n\n // now go the other way to make sure we got them all.\n for (username in nonEmptyStatusProps) {\n if (!nonEmptyStatusProps.hasOwnProperty(username)) {\n continue;\n }\n expect(nonEmptyStatusDisplays[username].getStatus())\n .toEqual(nonEmptyStatusProps[username]);\n }\n\n expect(Object.keys(nonEmptyStatusDisplays))\n .toEqual(Object.keys(nonEmptyStatusProps));\n}\n\n/**\n * For all statusDisplays that existed in the previous iteration of the\n * sequence, verify that the state has been preserved. `StatusDisplay` contains\n * a unique number that allows us to track internal state across ordering\n * movements.\n */\nfunction verifyStatesPreserved(lastInternalStates, statusDisplays) {\n var key;\n for (key in statusDisplays) {\n if (!statusDisplays.hasOwnProperty(key)) {\n continue;\n }\n if (lastInternalStates[key]) {\n expect(lastInternalStates[key])\n .toEqual(statusDisplays[key].getInternalState());\n }\n }\n}\n\n\n/**\n * Verifies that the internal representation of a set of `renderedChildren`\n * accurately reflects what is in the DOM.\n */\nfunction verifyDomOrderingAccurate(parentInstance, statusDisplays) {\n var containerNode = parentInstance.getDOMNode();\n var statusDisplayNodes = containerNode.childNodes;\n var i;\n var orderedDomIds = [];\n for (i=0; i < statusDisplayNodes.length; i++) {\n orderedDomIds.push(ReactMount.getID(statusDisplayNodes[i]));\n }\n\n var orderedLogicalIds = [];\n var username;\n for (username in statusDisplays) {\n if (!statusDisplays.hasOwnProperty(username)) {\n continue;\n }\n var statusDisplay = statusDisplays[username];\n orderedLogicalIds.push(statusDisplay._rootNodeID);\n }\n expect(orderedDomIds).toEqual(orderedLogicalIds);\n}\n\n/**\n * Todo: Check that internal state is preserved across transitions\n */\nfunction testPropsSequence(sequence) {\n var i;\n var parentInstance =\n ReactTestUtils.renderIntoDocument(FriendsStatusDisplay(sequence[0]));\n var statusDisplays = parentInstance.getStatusDisplays();\n var lastInternalStates = getInteralStateByUserName(statusDisplays);\n verifyStatuses(statusDisplays, sequence[0]);\n\n for (i = 1; i < sequence.length; i++) {\n parentInstance.replaceProps(sequence[i]);\n statusDisplays = parentInstance.getStatusDisplays();\n verifyStatuses(statusDisplays, sequence[i]);\n verifyStatesPreserved(lastInternalStates, statusDisplays);\n verifyDomOrderingAccurate(parentInstance, statusDisplays);\n\n lastInternalStates = getInteralStateByUserName(statusDisplays);\n }\n}\n\ndescribe('ReactMultiChildReconcile', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n it('should reset internal state if removed then readded', function() {\n // Test basics.\n var props = {\n usernameToStatus: {\n jcw: 'jcwStatus'\n }\n };\n\n var parentInstance =\n ReactTestUtils.renderIntoDocument(FriendsStatusDisplay(props));\n var statusDisplays = parentInstance.getStatusDisplays();\n var startingInternalState = statusDisplays.jcw.getInternalState();\n\n // Now remove the child.\n parentInstance.replaceProps({ usernameToStatus: {} });\n statusDisplays = parentInstance.getStatusDisplays();\n expect(statusDisplays.jcw).toBeFalsy();\n\n // Now reset the props that cause there to be a child\n parentInstance.replaceProps(props);\n statusDisplays = parentInstance.getStatusDisplays();\n expect(statusDisplays.jcw).toBeTruthy();\n expect(statusDisplays.jcw.getInternalState())\n .toNotBe(startingInternalState);\n });\n\n it('should create unique identity', function() {\n // Test basics.\n var usernameToStatus = {\n jcw: 'jcwStatus',\n awalke: 'awalkeStatus',\n bob: 'bobStatus'\n };\n\n testPropsSequence([ { usernameToStatus: usernameToStatus } ]);\n });\n\n it('should preserve order if children order has not changed', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwstatus2',\n jordanjcw: 'jordanjcwstatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should transition from zero to one children correctly', function() {\n var PROPS_SEQUENCE = [\n { usernameToStatus: {} },\n {\n usernameToStatus: {\n first: 'firstStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should transition from one to zero children correctly', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n first: 'firstStatus'\n }\n },\n { usernameToStatus: {} }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should transition from one child to null children', function() {\n testPropsSequence([\n {\n usernameToStatus: {\n first: 'firstStatus'\n }\n },\n { }\n ]);\n });\n\n it('should transition from null children to one child', function() {\n testPropsSequence([\n { },\n {\n usernameToStatus: {\n first: 'firstStatus'\n }\n }\n ]);\n });\n\n it('should transition from zero children to null children', function() {\n testPropsSequence([\n {\n usernameToStatus: { }\n },\n { }\n ]);\n });\n\n it('should transition from null children to zero children', function() {\n testPropsSequence([\n { },\n {\n usernameToStatus: { }\n }\n ]);\n });\n\n\n\n /**\n * `FriendsStatusDisplay` renders nulls as empty children (it's a convention\n * of `FriendsStatusDisplay`, nothing related to React or these test cases.\n */\n it('should remove nulled out children at the beginning', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: null,\n jordanjcw: 'jordanjcwstatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should remove nulled out children at the end', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwstatus2',\n jordanjcw: null\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should reverse the order of two children', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus'\n }\n },\n {\n usernameToStatus: {\n userTwo: 'userTwoStatus',\n userOne: 'userOneStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should reverse the order of more than two children', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus'\n }\n },\n {\n usernameToStatus: {\n userThree: 'userThreeStatus',\n userTwo: 'userTwoStatus',\n userOne: 'userOneStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should cycle order correctly', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus'\n }\n },\n {\n usernameToStatus: {\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus',\n userOne: 'userOneStatus'\n }\n },\n {\n usernameToStatus: {\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus',\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus'\n }\n },\n {\n usernameToStatus: {\n userFour: 'userFourStatus',\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus'\n }\n },\n {\n usernameToStatus: { // Full circle!\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should cycle order correctly in the other direction', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus'\n }\n },\n {\n usernameToStatus: {\n userFour: 'userFourStatus',\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus'\n }\n },\n {\n usernameToStatus: {\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus',\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus'\n }\n },\n {\n usernameToStatus: {\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus',\n userOne: 'userOneStatus'\n }\n },\n {\n usernameToStatus: { // Full circle!\n userOne: 'userOneStatus',\n userTwo: 'userTwoStatus',\n userThree: 'userThreeStatus',\n userFour: 'userFourStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n\n it('should remove nulled out children and ignore ' +\n 'new null children', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jordanjcw: 'jordanjcwstatus2',\n jcw: null,\n another: null\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should remove nulled out children and reorder remaining', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus',\n john: 'johnStatus', // john will go away\n joe: 'joeStatus'\n }\n },\n {\n usernameToStatus: {\n jordanjcw: 'jordanjcwStatus',\n joe: 'joeStatus',\n jcw: 'jcwStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should append children to the end', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus',\n jordanjcwnew: 'jordanjcwnewStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should append multiple children to the end', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus',\n jordanjcwnew: 'jordanjcwnewStatus',\n jordanjcwnew2: 'jordanjcwnewStatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should prepend children to the beginning', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n newUsername: 'newUsernameStatus',\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should prepend multiple children to the beginning', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n newNewUsername: 'newNewUsernameStatus',\n newUsername: 'newUsernameStatus',\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should not prepend an empty child to the beginning', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n emptyUsername: null,\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should not append an empty child to the end', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus',\n emptyUsername: null\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should not insert empty children in the middle', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwstatus2',\n skipOverMe: null,\n skipOverMeToo: null,\n definitelySkipOverMe: null,\n jordanjcw: 'jordanjcwstatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should insert one new child in the middle', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwstatus2',\n insertThis: 'insertThisStatus',\n jordanjcw: 'jordanjcwstatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should insert multiple new truthy children in the middle', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwstatus2',\n insertThis: 'insertThisStatus',\n insertThisToo: 'insertThisTooStatus',\n definitelyInsertThisToo: 'definitelyInsertThisTooStatus',\n jordanjcw: 'jordanjcwstatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n\n it('should insert non-empty children in middle where nulls were', function() {\n var PROPS_SEQUENCE = [\n {\n usernameToStatus: {\n jcw: 'jcwStatus',\n insertThis: null,\n insertThisToo: null,\n definitelyInsertThisToo: null,\n jordanjcw: 'jordanjcwStatus'\n }\n },\n {\n usernameToStatus: {\n jcw: 'jcwstatus2',\n insertThis: 'insertThisStatus',\n insertThisToo: 'insertThisTooStatus',\n definitelyInsertThisToo: 'definitelyInsertThisTooStatus',\n jordanjcw: 'jordanjcwstatus2'\n }\n }\n ];\n testPropsSequence(PROPS_SEQUENCE);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactMultiChildReconcile-test\", module);\n",
"core/__tests__/ReactMultiChildText-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\");\n\nvar React = require(\"../../React\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\n\nvar reactComponentExpect = require(\"../../reactComponentExpect\");\n\nvar assertNodeText = function(instance, text) {\n expect(instance.getDOMNode().childNodes.length).toBe(1);\n expect(instance.getDOMNode().innerHTML).toBe('' + text);\n};\n\nvar assertEmptyNode = function(instance) {\n expect(instance.getDOMNode().childNodes.length).toBe(0);\n};\n\nvar assertMultiChild = function(instance, textOne, textTwo) {\n expect(instance.getDOMNode().childNodes.length).toBe(2);\n var firstTextDOMNode =\n reactComponentExpect(instance)\n .expectRenderedChildAt(0)\n .toBeTextComponent()\n .instance()\n .getDOMNode();\n expect(firstTextDOMNode.childNodes.length).toBe(textOne === '' ? 0 : 1);\n expect(firstTextDOMNode.innerHTML).toBe('' + textOne);\n\n var secondTextDOMNode =\n reactComponentExpect(instance)\n .expectRenderedChildAt(1)\n .toBeTextComponent()\n .instance()\n .getDOMNode();\n expect(secondTextDOMNode.childNodes.length).toBe(textTwo === '' ? 0 : 1);\n expect(secondTextDOMNode.innerHTML).toBe('' + textTwo);\n};\n\nvar assertSingleChild = function(instance, text) {\n expect(instance.getDOMNode().childNodes.length).toBe(1);\n var textDOMNode =\n reactComponentExpect(instance)\n .expectRenderedChildAt(0)\n .toBeTextComponent()\n .instance()\n .getDOMNode();\n expect(textDOMNode.childNodes.length).toBe(1);\n expect(textDOMNode.innerHTML).toBe('' + text);\n};\n\n// Helpers\nvar renderSingleTextChild = function(text) {\n var d = ReactTestUtils.renderIntoDocument(React.DOM.div(null, text));\n return d;\n};\nvar renderMultipleTextChildren = function(textOne, textTwo) {\n var d = ReactTestUtils.renderIntoDocument(React.DOM.div(null, textOne,textTwo));\n return d;\n};\n\nvar TestCompositeComponent = React.createClass({displayName: 'TestCompositeComponent',\n render: function() {\n return (\n React.DOM.div(null )\n );\n }\n});\n\n/**\n * ReactMultiChild DOM integration test. In ReactDOM components, we make sure\n * that single children that are strings are treated as \"content\" which is much\n * faster to render and update.\n */\ndescribe('ReactMultiChildText', function() {\n it('should render null as empty', function() {\n var d = renderSingleTextChild(null);\n // false should act exactly as a null child\n assertEmptyNode(d);\n });\n\n it('should render undefined as empty', function() {\n var d = renderSingleTextChild(undefined);\n // false should act exactly as a null child\n assertEmptyNode(d);\n });\n\n it('should render null as empty then switch to text node', function() {\n var d = renderSingleTextChild(null);\n // false should act exactly as a null child\n assertEmptyNode(d);\n d.replaceProps({children: 'hello'});\n assertNodeText(d, 'hello');\n });\n\n it('should render undefined as empty then switch to text node', function() {\n var d = renderSingleTextChild(undefined);\n // false should act exactly as a null child\n assertEmptyNode(d);\n d.replaceProps({children: 'hello'});\n assertNodeText(d, 'hello');\n });\n\n it('should render null as empty then switch to span children', function() {\n var d = renderSingleTextChild(null);\n // false should act exactly as a null child\n assertEmptyNode(d);\n d.replaceProps({children: ['hello', 'goodbye']});\n assertMultiChild(d, 'hello', 'goodbye');\n });\n\n it('should render null as empty then switch to span children', function() {\n var d = renderSingleTextChild(undefined);\n // false should act exactly as a null child\n assertEmptyNode(d);\n d.replaceProps({children: ['hello', 'goodbye']});\n assertMultiChild(d, 'hello', 'goodbye');\n });\n\n it('should render zero string as text node then switch to spans', function() {\n var d = renderSingleTextChild('0');\n // false should act exactly as a null child\n assertNodeText(d, '0');\n d.replaceProps({children: ['hello', 'goodbye']});\n assertMultiChild(d, 'hello', 'goodbye');\n });\n\n it('should render zero number as text node then switch to spans', function() {\n var d = renderSingleTextChild(0);\n // false should act exactly as a null child\n assertNodeText(d, '0');\n d.replaceProps({children: ['hello', 'goodbye']});\n assertMultiChild(d, 'hello', 'goodbye');\n });\n\n it('should render a single text child to a single text node', function() {\n var d = renderSingleTextChild('hello');\n assertNodeText(d, 'hello');\n });\n\n it('should render two string children to two spans', function() {\n var d = renderMultipleTextChildren('hello', 'goodbye');\n assertMultiChild(d, 'hello', 'goodbye');\n });\n\n it('should render false as a null child', function() {\n var d = renderMultipleTextChildren(false, 234.2);\n // false should act exactly as a null child\n assertSingleChild(d, '234.2');\n });\n\n it('should render true as a null child', function() {\n var d = renderMultipleTextChildren(true, 234.2);\n // false should act exactly as a null child\n assertSingleChild(d, '234.2');\n });\n\n it('should render true as a null child', function() {\n var d = renderMultipleTextChildren(true, 234.2);\n // false should act exactly as a null child\n assertSingleChild(d, '234.2');\n });\n\n it('should render one true as no children', function() {\n var d = renderSingleTextChild(true);\n assertEmptyNode(d);\n });\n\n it('should render one false as no children', function() {\n var d = renderSingleTextChild(false);\n assertEmptyNode(d);\n });\n\n it('should render empty string as no children', function() {\n var d = renderSingleTextChild('');\n assertEmptyNode(d);\n });\n\n it('should render two empty strings as two empty spans', function() {\n var d = renderMultipleTextChildren('', '');\n assertMultiChild(d, '', '');\n });\n\n it('should render empty string and string as two spans', function() {\n var d = renderMultipleTextChildren('', 'yo');\n assertMultiChild(d, '', 'yo');\n });\n\n it('should render child string zero as text node', function() {\n var d = renderSingleTextChild('0');\n // false should act exactly as a null child\n assertNodeText(d, '0');\n });\n\n it('should render child number zero as text node', function() {\n var d = renderSingleTextChild(0);\n // false should act exactly as a null child\n assertNodeText(d, '0');\n });\n\n it('should render content string zero as text node', function() {\n var d = renderSingleTextChild('0');\n // false should act exactly as a null child\n assertNodeText(d, '0');\n });\n\n it('should render zero string as string child', function() {\n var d = renderMultipleTextChildren('0', 234.2);\n // false should act exactly as a null child\n assertMultiChild(d, '0', '234.2');\n });\n\n it('should render zero string as string child then text node', function() {\n var d = renderMultipleTextChildren('0', 234.2);\n // false should act exactly as a null child\n assertMultiChild(d, '0', '234.2');\n d.replaceProps({children: '0'});\n assertNodeText(d, '0');\n });\n\n it('should render zero number as string child then text node', function() {\n var d = renderMultipleTextChildren(0, 234.2);\n // false should act exactly as a null child\n assertMultiChild(d, '0', '234.2');\n d.replaceProps({children: 0});\n // BELOW REVEALS A BUG IN JSDOM\n // assertNodeText(d, '0'); // This works in the browser.\n });\n\n it('should render multiple children then switch to inline', function() {\n var d = renderMultipleTextChildren('hello', 'goodbye');\n assertMultiChild(d, 'hello', 'goodbye');\n d.replaceProps({children: 'hello'});\n assertNodeText(d, 'hello');\n });\n\n it('should render multiple children then switch to inline child', function() {\n var d = renderMultipleTextChildren('hello', 'goodbye');\n assertMultiChild(d, 'hello', 'goodbye');\n // Even when switching from content to a single child, it should render\n // that single child as inline content.\n d.replaceProps({children: 'hello'});\n assertNodeText(d, 'hello');\n });\n\n it('should render inline child, then switch to text components ', function() {\n var d = renderSingleTextChild('hello');\n assertNodeText(d, 'hello');\n d.replaceProps({children: ['hello', 'goodbye']});\n assertMultiChild(d, 'hello', 'goodbye');\n });\n\n it('should render inline child, then switch to composite', function() {\n var d = renderSingleTextChild('hello');\n assertNodeText(d, 'hello');\n d.replaceProps({children: TestCompositeComponent(null )});\n reactComponentExpect(d)\n .expectRenderedChildAt(0)\n .toBeCompositeComponentWithType(TestCompositeComponent);\n });\n\n it('should throw if rendering both HTML and children', function() {\n expect(function() {\n ReactTestUtils.renderIntoDocument(\n React.DOM.div( {dangerouslySetInnerHTML:{_html: 'abcdef'}}, \"ghjkl\")\n );\n }).toThrow();\n });\n\n it('should render between nested components and inline children', function() {\n var container = document.createElement('div');\n React.renderComponent(React.DOM.div(null, React.DOM.h1(null, React.DOM.span(null ),React.DOM.span(null ))), container);\n\n expect(function() {\n React.renderComponent(React.DOM.div(null, React.DOM.h1(null, \"A\")), container);\n }).not.toThrow();\n\n React.renderComponent(React.DOM.div(null, React.DOM.h1(null, React.DOM.span(null ),React.DOM.span(null ))), container);\n\n expect(function() {\n React.renderComponent(React.DOM.div(null, React.DOM.h1(null, ['A'])), container);\n }).not.toThrow();\n\n React.renderComponent(React.DOM.div(null, React.DOM.h1(null, React.DOM.span(null ),React.DOM.span(null ))), container);\n\n expect(function() {\n React.renderComponent(React.DOM.div(null, React.DOM.h1(null, ['A', 'B'])), container);\n }).not.toThrow();\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactMultiChildText-test\", module);\n",
"core/__tests__/ReactPropTransferer-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTestUtils;\nvar reactComponentExpect;\n\nvar TestComponent;\n\ndescribe('ReactPropTransferer', function() {\n\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n\n TestComponent = React.createClass({\n render: function() {\n return this.transferPropsTo(\n React.DOM.input(\n {className:\"textinput\",\n style:{display: 'block'},\n type:\"text\",\n value:\"\"}\n )\n );\n }\n });\n });\n\n it('should leave explicitly specified properties intact', function() {\n var instance = TestComponent( {type:\"radio\"} );\n ReactTestUtils.renderIntoDocument(instance);\n\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeComponentOfType(React.DOM.input)\n .scalarPropsEqual({\n className: 'textinput',\n style: {display: 'block'},\n type: 'text',\n value: ''\n });\n });\n\n it('should transfer unspecified properties', function() {\n var instance = TestComponent( {placeholder:\"Type here...\"} );\n ReactTestUtils.renderIntoDocument(instance);\n\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeComponentOfType(React.DOM.input)\n .scalarPropsEqual({placeholder: 'Type here...'});\n });\n\n it('should transfer using merge strategies', function() {\n var instance =\n TestComponent(\n {className:\"hidden_elem\",\n style:{width: '100%'}}\n );\n ReactTestUtils.renderIntoDocument(instance);\n\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeComponentOfType(React.DOM.input)\n .scalarPropsEqual({\n className: 'textinput hidden_elem',\n style: {\n display: 'block',\n width: '100%'\n }\n });\n });\n\n it('should not transfer children', function() {\n var ChildrenTestComponent = React.createClass({displayName: 'ChildrenTestComponent',\n render: function() {\n return this.transferPropsTo(React.DOM.div(null ));\n }\n });\n\n var instance =\n ChildrenTestComponent(null, \n React.DOM.span(null, \"Hello!\")\n );\n\n ReactTestUtils.renderIntoDocument(instance);\n reactComponentExpect(instance)\n .expectRenderedChild()\n .toBeDOMComponentWithTag('div')\n .toBeDOMComponentWithNoChildren();\n });\n\n it('should not transfer ref', function() {\n var RefTestComponent = React.createClass({displayName: 'RefTestComponent',\n render: function() {\n expect(this.props.ref).toBeUndefined();\n return React.DOM.div(null );\n }\n });\n var OuterRefTestComponent = React.createClass({displayName: 'OuterRefTestComponent',\n render: function() {\n return this.transferPropsTo(RefTestComponent(null ));\n }\n });\n var OuterOuterRefTestComponent = React.createClass({displayName: 'OuterOuterRefTestComponent',\n render: function() {\n return OuterRefTestComponent( {ref:\"testref\"} );\n }\n });\n\n ReactTestUtils.renderIntoDocument(OuterOuterRefTestComponent(null ));\n });\n\n it('should not transferPropsTo() a component you don\\'t own', function() {\n var Parent = React.createClass({displayName: 'Parent',\n render: function() {\n return Child(null, React.DOM.span(null ));\n }\n });\n\n var Child = React.createClass({displayName: 'Child',\n render: function() {\n return this.transferPropsTo(this.props.children);\n }\n });\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(Parent(null ));\n }).toThrow(\n 'Invariant Violation: ' +\n 'Child: You can\\'t call transferPropsTo() on a component that you ' +\n 'don\\'t own, span. ' +\n 'This usually means you are calling transferPropsTo() on a component ' +\n 'passed in as props or children.'\n );\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactPropTransferer-test\", module);\n",
"core/__tests__/ReactPropTypes-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar Props = require(\"../../ReactPropTypes\");\n\nfunction typeCheck(declaration, value) {\n var props = {};\n if (arguments.length > 1) {\n props.testProp = value;\n }\n return declaration.bind(null, props, 'testProp', 'testComponent');\n}\n\ndescribe('Primitive Types', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n it(\"should throw for invalid strings\", function() {\n expect(typeCheck(Props.string, [])).toThrow(\n 'Invariant Violation: Invalid prop `testProp` of type `array` ' +\n 'supplied to `testComponent`, expected `string`.'\n );\n expect(typeCheck(Props.string, false)).toThrow(\n 'Invariant Violation: Invalid prop `testProp` of type `boolean` ' +\n 'supplied to `testComponent`, expected `string`.'\n );\n expect(typeCheck(Props.string, 1)).toThrow(\n 'Invariant Violation: Invalid prop `testProp` of type `number` ' +\n 'supplied to `testComponent`, expected `string`.'\n );\n expect(typeCheck(Props.string, {})).toThrow(\n 'Invariant Violation: Invalid prop `testProp` of type `object` ' +\n 'supplied to `testComponent`, expected `string`.'\n );\n });\n\n it(\"should not throw for valid values\", function() {\n expect(typeCheck(Props.array, [])).not.toThrow();\n expect(typeCheck(Props.bool, false)).not.toThrow();\n expect(typeCheck(Props.func, function() {})).not.toThrow();\n expect(typeCheck(Props.number, 0)).not.toThrow();\n expect(typeCheck(Props.object, {})).not.toThrow();\n expect(typeCheck(Props.string, '')).not.toThrow();\n });\n\n it(\"should be implicitly optional and not throw without values\", function() {\n expect(typeCheck(Props.string, null)).not.toThrow();\n expect(typeCheck(Props.string, undefined)).not.toThrow();\n });\n\n it(\"should throw for missing required values\", function() {\n expect(typeCheck(Props.string.isRequired, null)).toThrow(\n 'Invariant Violation: Required prop `testProp` was not specified in ' +\n '`testComponent`.'\n );\n expect(typeCheck(Props.string.isRequired, undefined)).toThrow(\n 'Invariant Violation: Required prop `testProp` was not specified in ' +\n '`testComponent`.'\n );\n });\n});\n\ndescribe('Enum Types', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n it(\"should throw for invalid strings\", function() {\n expect(typeCheck(Props.oneOf(['red', 'blue']), true)).toThrow(\n 'Invariant Violation: Invalid prop `testProp` supplied to ' +\n '`testComponent`, expected one of [\"blue\",\"red\"].'\n );\n expect(typeCheck(Props.oneOf(['red', 'blue']), [])).toThrow(\n 'Invariant Violation: Invalid prop `testProp` supplied to ' +\n '`testComponent`, expected one of [\"blue\",\"red\"].'\n );\n expect(typeCheck(Props.oneOf(['red', 'blue']), '')).toThrow(\n 'Invariant Violation: Invalid prop `testProp` supplied to ' +\n '`testComponent`, expected one of [\"blue\",\"red\"].'\n );\n });\n\n it(\"should not throw for valid values\", function() {\n expect(typeCheck(Props.oneOf(['red', 'blue']), 'red')).not.toThrow();\n expect(typeCheck(Props.oneOf(['red', 'blue']), 'blue')).not.toThrow();\n });\n\n it(\"should be implicitly optional and not throw without values\", function() {\n expect(typeCheck(Props.oneOf(['red', 'blue']), null)).not.toThrow();\n expect(typeCheck(Props.oneOf(['red', 'blue']), undefined)).not.toThrow();\n });\n});\n\ndescribe('Instance Types', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n it(\"should throw for invalid instances\", function() {\n function Person() {}\n\n expect(typeCheck(Props.instanceOf(Person), false)).toThrow(\n 'Invariant Violation: Invalid prop `testProp` supplied to ' +\n '`testComponent`, expected instance of `Person`.'\n );\n expect(typeCheck(Props.instanceOf(Person), {})).toThrow(\n 'Invariant Violation: Invalid prop `testProp` supplied to ' +\n '`testComponent`, expected instance of `Person`.'\n );\n expect(typeCheck(Props.instanceOf(Person), '')).toThrow(\n 'Invariant Violation: Invalid prop `testProp` supplied to ' +\n '`testComponent`, expected instance of `Person`.'\n );\n });\n\n it(\"should not throw for valid values\", function() {\n function Person() {}\n function Engineer() {}\n Engineer.prototype = new Person();\n\n expect(typeCheck(Props.instanceOf(Person), new Person())).not.toThrow();\n expect(typeCheck(Props.instanceOf(Person), new Engineer())).not.toThrow();\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactPropTypes-test\", module);\n",
"core/__tests__/ReactRenderDocument-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar React;\nvar ReactMount;\n\nvar getTestDocument;\n\nvar testDocument;\n\ndescribe('rendering React components at document', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n\n React = require(\"../../React\");\n ReactMount = require(\"../../ReactMount\");\n getTestDocument = require(\"../../getTestDocument\");\n\n testDocument = getTestDocument();\n });\n\n it('should be able to switch root constructors via state', function() {\n if (!testDocument) {\n // These tests are not applicable in jst, since jsdom is buggy.\n return;\n }\n\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n return (\n React.DOM.html(null, \n React.DOM.head(null, \n React.DOM.title(null, \"Hello World\")\n ),\n React.DOM.body(null, \n \" Hello world \"\n )\n )\n );\n }\n });\n\n var Component2 = React.createClass({displayName: 'Component2',\n render: function() {\n return (\n React.DOM.html(null, \n React.DOM.head(null, \n React.DOM.title(null, \"Hello World\")\n ),\n React.DOM.body(null, \n \" Goodbye world \"\n )\n )\n );\n }\n });\n\n var Root = React.createClass({displayName: 'Root',\n getInitialState: function() {\n return {toggled: false};\n },\n toggle: function() {\n this.setState({toggled: !this.state.toggled});\n },\n render: function() {\n if (this.state.toggled) {\n return Component2(null );\n }\n return Component(null );\n }\n });\n\n ReactMount.allowFullPageRender = true;\n var component = React.renderComponent(Root(null ), testDocument);\n expect(testDocument.body.innerHTML).toBe(' Hello world ');\n\n // Reactive update via state transition\n component.toggle();\n\n expect(testDocument.body.innerHTML).toBe(' Goodbye world ');\n\n });\n\n it('should be able to switch root constructors', function() {\n if (!testDocument) {\n // These tests are not applicable in jst, since jsdom is buggy.\n return;\n }\n\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n return (\n React.DOM.html(null, \n React.DOM.head(null, \n React.DOM.title(null, \"Hello World\")\n ),\n React.DOM.body(null, \n \" Hello world \"\n )\n )\n );\n }\n });\n\n var Component2 = React.createClass({displayName: 'Component2',\n render: function() {\n return (\n React.DOM.html(null, \n React.DOM.head(null, \n React.DOM.title(null, \"Hello World\")\n ),\n React.DOM.body(null, \n \" Goodbye world \"\n )\n )\n );\n }\n });\n\n ReactMount.allowFullPageRender = true;\n React.renderComponent(Component(null ), testDocument);\n\n expect(testDocument.body.innerHTML).toBe(' Hello world ');\n\n // Reactive update\n React.renderComponent(Component2(null ), testDocument);\n\n expect(testDocument.body.innerHTML).toBe(' Goodbye world ');\n\n });\n\n it('should be able to mount into document', function() {\n if (!testDocument) {\n // These tests are not applicable in jst, since jsdom is buggy.\n return;\n }\n\n var Component = React.createClass({displayName: 'Component',\n render: function() {\n return (\n React.DOM.html(null, \n React.DOM.head(null, \n React.DOM.title(null, \"Hello World\")\n ),\n React.DOM.body(null, \n this.props.text\n )\n )\n );\n }\n });\n ReactMount.allowFullPageRender = true;\n React.renderComponent(Component( {text:\"Hello world\"} ), testDocument);\n\n expect(testDocument.body.innerHTML).toBe('Hello world');\n });\n\n it('should throw on full document render', function() {\n if (!testDocument) {\n // These tests are not applicable in jst, since jsdom is buggy.\n return;\n }\n\n var container = testDocument;\n expect(function() {\n React.renderComponent(React.DOM.html(null ), container);\n }).toThrow(\n 'Invariant Violation: mountComponentIntoNode(...): Target container is ' +\n 'not valid.'\n );\n ReactMount.allowFullPageRender = true;\n expect(function() {\n React.renderComponent(React.DOM.html(null ), container);\n }).not.toThrow();\n });\n\n it('should throw on full document render of non-html', function() {\n if (!testDocument) {\n // These tests are not applicable in jst, since jsdom is buggy.\n return;\n }\n\n var container = testDocument;\n ReactMount.allowFullPageRender = true;\n expect(function() {\n React.renderComponent(React.DOM.div(null ), container);\n }).toThrow(\n 'Invariant Violation: mutateHTMLNodeWithMarkup(): ' +\n 'markup must start with <html'\n );\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactRenderDocument-test\", module);\n",
"core/__tests__/ReactStateSetters-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\nvar ReactStateSetters = require(\"../../ReactStateSetters\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\n\nvar TestComponent;\nvar TestComponentWithMixin;\n\ndescribe('ReactStateSetters', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n\n TestComponent = React.createClass({\n getInitialState: function() {\n return {foo: 'foo'};\n },\n\n render: function() {\n return React.DOM.div(null );\n }\n });\n\n TestComponentWithMixin = React.createClass({\n mixins: [ReactStateSetters.Mixin],\n\n getInitialState: function() {\n return {foo: 'foo'};\n },\n\n render: function() {\n return React.DOM.div(null );\n }\n });\n });\n\n it('createStateSetter should update state', function() {\n var instance = TestComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toEqual({foo: 'foo'});\n\n var setter = ReactStateSetters.createStateSetter(\n instance,\n function(a, b, c) {\n return {\n foo: a + b + c,\n bar: a * b * c\n };\n }\n );\n expect(instance.state).toEqual({foo: 'foo'});\n\n setter(1, 2, 3);\n expect(instance.state).toEqual({foo: 6, bar: 6});\n\n setter(10, 11, 12);\n expect(instance.state).toEqual({foo: 33, bar: 1320});\n });\n\n it('createStateKeySetter should update state', function() {\n var instance = TestComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toEqual({foo: 'foo'});\n\n var setter = ReactStateSetters.createStateKeySetter(instance, 'foo');\n\n expect(instance.state).toEqual({foo: 'foo'});\n\n setter('bar');\n expect(instance.state).toEqual({foo: 'bar'});\n\n setter('baz');\n expect(instance.state).toEqual({foo: 'baz'});\n });\n\n it('createStateKeySetter is memoized', function() {\n var instance = TestComponent(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toEqual({foo: 'foo'});\n\n var foo1 = ReactStateSetters.createStateKeySetter(instance, 'foo');\n var bar1 = ReactStateSetters.createStateKeySetter(instance, 'bar');\n\n var foo2 = ReactStateSetters.createStateKeySetter(instance, 'foo');\n var bar2 = ReactStateSetters.createStateKeySetter(instance, 'bar');\n\n expect(foo2).toBe(foo1);\n expect(bar2).toBe(bar1);\n });\n\n it('createStateSetter should update state from mixin', function() {\n var instance = TestComponentWithMixin(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toEqual({foo: 'foo'});\n\n var setter = instance.createStateSetter(\n function(a, b, c) {\n return {\n foo: a + b + c,\n bar: a * b * c\n };\n }\n );\n expect(instance.state).toEqual({foo: 'foo'});\n\n setter(1, 2, 3);\n expect(instance.state).toEqual({foo: 6, bar: 6});\n\n setter(10, 11, 12);\n expect(instance.state).toEqual({foo: 33, bar: 1320});\n });\n\n it('createStateKeySetter should update state with mixin', function() {\n var instance = TestComponentWithMixin(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toEqual({foo: 'foo'});\n\n var setter = instance.createStateKeySetter('foo');\n\n expect(instance.state).toEqual({foo: 'foo'});\n\n setter('bar');\n expect(instance.state).toEqual({foo: 'bar'});\n\n setter('baz');\n expect(instance.state).toEqual({foo: 'baz'});\n });\n\n it('createStateKeySetter is memoized with mixin', function() {\n var instance = TestComponentWithMixin(null );\n ReactTestUtils.renderIntoDocument(instance);\n expect(instance.state).toEqual({foo: 'foo'});\n\n var foo1 = instance.createStateKeySetter('foo');\n var bar1 = instance.createStateKeySetter('bar');\n\n var foo2 = instance.createStateKeySetter('foo');\n var bar2 = instance.createStateKeySetter('bar');\n\n expect(foo2).toBe(foo1);\n expect(bar2).toBe(bar1);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactStateSetters-test\", module);\n",
"core/__tests__/ReactUpdates-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React;\nvar ReactTestUtils;\nvar ReactUpdates;\n\ndescribe('ReactUpdates', function() {\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n ReactUpdates = require(\"../../ReactUpdates\");\n });\n\n it('should batch state when updating state twice', function() {\n var updateCount = 0;\n var Component = React.createClass({displayName: 'Component',\n getInitialState: function() {\n return {x: 0};\n },\n componentDidUpdate: function() {\n updateCount++;\n },\n render: function() {\n return React.DOM.div(null, this.state.x);\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Component(null ));\n expect(instance.state.x).toBe(0);\n\n ReactUpdates.batchedUpdates(function() {\n instance.setState({x: 1});\n instance.setState({x: 2});\n expect(instance.state.x).toBe(0);\n expect(updateCount).toBe(0);\n });\n\n expect(instance.state.x).toBe(2);\n expect(updateCount).toBe(1);\n });\n\n it('should batch state when updating two different state keys', function() {\n var updateCount = 0;\n var Component = React.createClass({displayName: 'Component',\n getInitialState: function() {\n return {x: 0, y: 0};\n },\n componentDidUpdate: function() {\n updateCount++;\n },\n render: function() {\n return React.DOM.div(null, \"(\",this.state.x,\", \", this.state.y,\")\");\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Component(null ));\n expect(instance.state.x).toBe(0);\n expect(instance.state.y).toBe(0);\n\n ReactUpdates.batchedUpdates(function() {\n instance.setState({x: 1});\n instance.setState({y: 2});\n expect(instance.state.x).toBe(0);\n expect(instance.state.y).toBe(0);\n expect(updateCount).toBe(0);\n });\n\n expect(instance.state.x).toBe(1);\n expect(instance.state.y).toBe(2);\n expect(updateCount).toBe(1);\n });\n\n it('should batch state and props together', function() {\n var updateCount = 0;\n var Component = React.createClass({displayName: 'Component',\n getInitialState: function() {\n return {y: 0};\n },\n componentDidUpdate: function() {\n updateCount++;\n },\n render: function() {\n return React.DOM.div(null, \"(\",this.props.x,\", \", this.state.y,\")\");\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Component( {x:0} ));\n expect(instance.props.x).toBe(0);\n expect(instance.state.y).toBe(0);\n\n ReactUpdates.batchedUpdates(function() {\n instance.setProps({x: 1});\n instance.setState({y: 2});\n expect(instance.props.x).toBe(0);\n expect(instance.state.y).toBe(0);\n expect(updateCount).toBe(0);\n });\n\n expect(instance.props.x).toBe(1);\n expect(instance.state.y).toBe(2);\n expect(updateCount).toBe(1);\n });\n\n it('should batch parent/child state updates together', function() {\n var parentUpdateCount = 0;\n var Parent = React.createClass({displayName: 'Parent',\n getInitialState: function() {\n return {x: 0};\n },\n componentDidUpdate: function() {\n parentUpdateCount++;\n },\n render: function() {\n return React.DOM.div(null, Child( {ref:\"child\", x:this.state.x} ));\n }\n });\n var childUpdateCount = 0;\n var Child = React.createClass({displayName: 'Child',\n getInitialState: function() {\n return {y: 0};\n },\n componentDidUpdate: function() {\n childUpdateCount++;\n },\n render: function() {\n return React.DOM.div(null, this.props.x + this.state.y);\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Parent(null ));\n var child = instance.refs.child;\n expect(instance.state.x).toBe(0);\n expect(child.state.y).toBe(0);\n\n ReactUpdates.batchedUpdates(function() {\n instance.setState({x: 1});\n child.setState({y: 2});\n expect(instance.state.x).toBe(0);\n expect(child.state.y).toBe(0);\n expect(parentUpdateCount).toBe(0);\n expect(childUpdateCount).toBe(0);\n });\n\n expect(instance.state.x).toBe(1);\n expect(child.state.y).toBe(2);\n expect(parentUpdateCount).toBe(1);\n expect(childUpdateCount).toBe(1);\n });\n\n it('should batch child/parent state updates together', function() {\n var parentUpdateCount = 0;\n var Parent = React.createClass({displayName: 'Parent',\n getInitialState: function() {\n return {x: 0};\n },\n componentDidUpdate: function() {\n parentUpdateCount++;\n },\n render: function() {\n return React.DOM.div(null, Child( {ref:\"child\", x:this.state.x} ));\n }\n });\n var childUpdateCount = 0;\n var Child = React.createClass({displayName: 'Child',\n getInitialState: function() {\n return {y: 0};\n },\n componentDidUpdate: function() {\n childUpdateCount++;\n },\n render: function() {\n return React.DOM.div(null, this.props.x + this.state.y);\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Parent(null ));\n var child = instance.refs.child;\n expect(instance.state.x).toBe(0);\n expect(child.state.y).toBe(0);\n\n ReactUpdates.batchedUpdates(function() {\n child.setState({y: 2});\n instance.setState({x: 1});\n expect(instance.state.x).toBe(0);\n expect(child.state.y).toBe(0);\n expect(parentUpdateCount).toBe(0);\n expect(childUpdateCount).toBe(0);\n });\n\n expect(instance.state.x).toBe(1);\n expect(child.state.y).toBe(2);\n expect(parentUpdateCount).toBe(1);\n\n // Batching reduces the number of updates here to 1.\n expect(childUpdateCount).toBe(1);\n });\n\n it('should support chained state updates', function() {\n var updateCount = 0;\n var Component = React.createClass({displayName: 'Component',\n getInitialState: function() {\n return {x: 0};\n },\n componentDidUpdate: function() {\n updateCount++;\n },\n render: function() {\n return React.DOM.div(null, this.state.x);\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Component(null ));\n expect(instance.state.x).toBe(0);\n\n var innerCallbackRun = false;\n ReactUpdates.batchedUpdates(function() {\n instance.setState({x: 1}, function() {\n instance.setState({x: 2}, function() {\n expect(this).toBe(instance);\n innerCallbackRun = true;\n expect(instance.state.x).toBe(2);\n expect(updateCount).toBe(2);\n });\n expect(instance.state.x).toBe(1);\n expect(updateCount).toBe(1);\n });\n expect(instance.state.x).toBe(0);\n expect(updateCount).toBe(0);\n });\n\n expect(innerCallbackRun).toBeTruthy();\n expect(instance.state.x).toBe(2);\n expect(updateCount).toBe(2);\n });\n\n it('should batch forceUpdate together', function() {\n var shouldUpdateCount = 0;\n var updateCount = 0;\n var Component = React.createClass({displayName: 'Component',\n getInitialState: function() {\n return {x: 0};\n },\n shouldComponentUpdate: function() {\n shouldUpdateCount++;\n },\n componentDidUpdate: function() {\n updateCount++;\n },\n render: function() {\n return React.DOM.div(null, this.state.x);\n }\n });\n\n var instance = ReactTestUtils.renderIntoDocument(Component(null ));\n expect(instance.state.x).toBe(0);\n\n var callbacksRun = 0;\n ReactUpdates.batchedUpdates(function() {\n instance.setState({x: 1}, function() {\n callbacksRun++;\n });\n instance.forceUpdate(function() {\n callbacksRun++;\n });\n expect(instance.state.x).toBe(0);\n expect(updateCount).toBe(0);\n });\n\n expect(callbacksRun).toBe(2);\n // shouldComponentUpdate shouldn't be called since we're forcing\n expect(shouldUpdateCount).toBe(0);\n expect(instance.state.x).toBe(1);\n expect(updateCount).toBe(1);\n });\n\n it('should update children even if parent blocks updates', function() {\n var parentRenderCount = 0;\n var childRenderCount = 0;\n\n var Parent = React.createClass({displayName: 'Parent',\n shouldComponentUpdate: function() {\n return false;\n },\n\n render: function() {\n parentRenderCount++;\n return Child( {ref:\"child\"} );\n }\n });\n\n var Child = React.createClass({displayName: 'Child',\n render: function() {\n childRenderCount++;\n return React.DOM.div(null );\n }\n });\n\n expect(parentRenderCount).toBe(0);\n expect(childRenderCount).toBe(0);\n\n var instance = Parent(null );\n ReactTestUtils.renderIntoDocument(instance);\n\n expect(parentRenderCount).toBe(1);\n expect(childRenderCount).toBe(1);\n\n ReactUpdates.batchedUpdates(function() {\n instance.setState({x: 1});\n });\n\n expect(parentRenderCount).toBe(1);\n expect(childRenderCount).toBe(1);\n\n ReactUpdates.batchedUpdates(function() {\n instance.refs.child.setState({x: 1});\n });\n\n expect(parentRenderCount).toBe(1);\n expect(childRenderCount).toBe(2);\n });\n\n it('should flow updates correctly', function() {\n var willUpdates = [];\n var didUpdates = [];\n\n var UpdateLoggingMixin = {\n componentWillUpdate: function() {\n willUpdates.push(this.constructor.displayName);\n },\n componentDidUpdate: function() {\n didUpdates.push(this.constructor.displayName);\n }\n };\n\n var Box = React.createClass({displayName: 'Box',\n mixins: [UpdateLoggingMixin],\n\n render: function() {\n return React.DOM.div( {ref:\"boxDiv\"}, this.props.children);\n }\n });\n\n var Child = React.createClass({displayName: 'Child',\n mixins: [UpdateLoggingMixin],\n\n render: function() {\n return React.DOM.span( {ref:\"span\"}, \"child\");\n }\n });\n\n var Switcher = React.createClass({displayName: 'Switcher',\n mixins: [UpdateLoggingMixin],\n\n getInitialState: function() {\n return {tabKey: 'hello'};\n },\n\n render: function() {\n var child = this.props.children;\n\n return (\n Box( {ref:\"box\"}, \n React.DOM.div(\n {ref:\"switcherDiv\",\n style:{\n display: this.state.tabKey === child.key ? '' : 'none'\n }}, \n child\n )\n )\n );\n }\n });\n\n var App = React.createClass({displayName: 'App',\n mixins: [UpdateLoggingMixin],\n\n render: function() {\n return (\n Switcher( {ref:\"switcher\"}, \n Child( {key:\"hello\", ref:\"child\"} )\n )\n );\n }\n });\n\n var root = App(null );\n ReactTestUtils.renderIntoDocument(root);\n\n function expectUpdates(sequence) {\n // didUpdate() occurs in reverse order\n didUpdates.reverse();\n expect(willUpdates).toEqual(didUpdates);\n expect(willUpdates).toEqual(sequence);\n willUpdates.length = 0;\n didUpdates.length = 0;\n }\n\n function triggerUpdate(c) {\n c.setState({x: 1});\n }\n\n function testUpdates(components, expectation) {\n var i;\n\n ReactUpdates.batchedUpdates(function() {\n for (i = 0; i < components.length; i++) {\n triggerUpdate(components[i]);\n }\n });\n\n expectUpdates(expectation);\n\n // Try them in reverse order\n\n ReactUpdates.batchedUpdates(function() {\n for (i = components.length - 1; i >= 0; i--) {\n triggerUpdate(components[i]);\n }\n });\n\n expectUpdates(expectation);\n }\n\n testUpdates(\n [root.refs.switcher.refs.box, root.refs.switcher],\n ['Switcher', 'Box', 'Child']\n );\n\n testUpdates(\n [root.refs.child, root.refs.switcher.refs.box],\n ['Box', 'Child']\n );\n\n testUpdates(\n [root.refs.child, root.refs.switcher],\n ['Switcher', 'Box', 'Child']\n );\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/ReactUpdates-test\", module);\n",
"core/__tests__/refs-destruction-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\nvar reactComponentExpect= require(\"../../reactComponentExpect\");\n\nvar TestComponent = React.createClass({displayName: 'TestComponent',\n render: function() {\n return (\n React.DOM.div(null, \n React.DOM.div( {ref:\"theInnerDiv\"}, \n \" Lets try to destroy this. \"\n )\n )\n );\n }\n});\n\ndescribe('refs-destruction', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n it(\"should remove refs when destroying the parent\", function() {\n var testInstance = ReactTestUtils.renderIntoDocument(TestComponent(null ));\n reactComponentExpect(testInstance.refs.theInnerDiv)\n .toBeDOMComponentWithTag('div');\n expect(Object.keys(testInstance.refs || {}).length).toEqual(1);\n testInstance.unmountComponent();\n expect(Object.keys(testInstance.refs || {}).length).toEqual(0);\n });\n\n it(\"should remove refs when destroying the child\", function() {\n var testInstance = ReactTestUtils.renderIntoDocument(TestComponent(null ));\n reactComponentExpect(testInstance.refs.theInnerDiv)\n .toBeDOMComponentWithTag('div');\n expect(Object.keys(testInstance.refs || {}).length).toEqual(1);\n testInstance.refs.theInnerDiv.unmountComponent();\n expect(Object.keys(testInstance.refs || {}).length).toEqual(0);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/refs-destruction-test\", module);\n",
"core/__tests__/refs-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\nvar ReactTestUtils = require(\"../../ReactTestUtils\");\n\nvar reactComponentExpect= require(\"../../reactComponentExpect\");\n\n\n/**\n * Counts clicks and has a renders an item for each click. Each item rendered\n * has a ref of the form \"clickLogN\".\n */\nvar ClickCounter = React.createClass({displayName: 'ClickCounter',\n getInitialState: function() {\n return {count: this.props.initialCount};\n },\n triggerReset: function() {\n this.setState({count: this.props.initialCount});\n },\n handleClick: function() {\n this.setState({count: this.state.count + 1});\n },\n render: function() {\n var children = [];\n var i;\n for (i=0; i < this.state.count; i++) {\n children.push(\n React.DOM.div(\n {className:\"clickLogDiv\",\n key:\"clickLog\" + i,\n ref:\"clickLog\" + i}\n )\n );\n }\n return (\n React.DOM.span( {className:\"clickIncrementer\", onClick:this.handleClick}, \n children\n )\n );\n }\n});\n\n/**\n * Only purpose is to test that refs are tracked even when applied to a\n * component that is injected down several layers. Ref systems are difficult to\n * build in such a way that ownership is maintained in an airtight manner.\n */\nvar GeneralContainerComponent = React.createClass({displayName: 'GeneralContainerComponent',\n render: function() {\n return React.DOM.div(null, this.props.children );\n }\n});\n\n/**\n * Notice how refs ownership is maintained even when injecting a component\n * into a different parent.\n */\nvar TestRefsComponent = React.createClass({displayName: 'TestRefsComponent',\n doReset: function() {\n this.refs.myCounter.triggerReset();\n },\n render: function() {\n return (\n React.DOM.div(null, \n React.DOM.div( {ref:\"resetDiv\", onClick:this.doReset}, \n \" Reset Me By Clicking This. \"\n ),\n GeneralContainerComponent( {ref:\"myContainer\"}, \n ClickCounter( {ref:\"myCounter\", initialCount:1})\n )\n )\n );\n }\n});\n\n/**\n * Render a TestRefsComponent and ensure that the main refs are wired up.\n */\nvar renderTestRefsComponent = function() {\n var testRefsComponent =\n ReactTestUtils.renderIntoDocument(TestRefsComponent(null ));\n\n reactComponentExpect(testRefsComponent)\n .toBeCompositeComponentWithType(TestRefsComponent);\n\n var generalContainer = testRefsComponent.refs.myContainer;\n var counter = testRefsComponent.refs.myCounter;\n\n reactComponentExpect(generalContainer)\n .toBeCompositeComponentWithType(GeneralContainerComponent);\n reactComponentExpect(counter)\n .toBeCompositeComponentWithType(ClickCounter);\n\n return testRefsComponent;\n};\n\n\nvar expectClickLogsLengthToBe = function(instance, length) {\n var clickLogs =\n ReactTestUtils.scryRenderedDOMComponentsWithClass(instance, 'clickLogDiv');\n expect(clickLogs.length).toBe(length);\n expect(Object.keys(instance.refs.myCounter.refs).length).toBe(length);\n};\n\ndescribe('reactiverefs', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n /**\n * Ensure that for every click log there is a corresponding ref (from the\n * perspective of the injected ClickCounter component.\n */\n it(\"Should increase refs with an increase in divs\", function() {\n var testRefsComponent = renderTestRefsComponent();\n var clickIncrementer =\n ReactTestUtils.findRenderedDOMComponentWithClass(\n testRefsComponent,\n 'clickIncrementer'\n );\n\n expectClickLogsLengthToBe(testRefsComponent, 1);\n\n // After clicking the reset, there should still only be one click log ref.\n ReactTestUtils.Simulate.click(testRefsComponent.refs.resetDiv);\n expectClickLogsLengthToBe(testRefsComponent, 1);\n\n // Begin incrementing clicks (and therefore refs).\n ReactTestUtils.Simulate.click(clickIncrementer);\n expectClickLogsLengthToBe(testRefsComponent, 2);\n\n ReactTestUtils.Simulate.click(clickIncrementer);\n expectClickLogsLengthToBe(testRefsComponent, 3);\n\n // Now reset again\n ReactTestUtils.Simulate.click(testRefsComponent.refs.resetDiv);\n expectClickLogsLengthToBe(testRefsComponent, 1);\n\n });\n\n});\n\n\n\n/**\n * Tests that when a ref hops around children, we can track that correctly.\n */\ndescribe('ref swapping', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n });\n\n var RefHopsAround = React.createClass({displayName: 'RefHopsAround',\n getInitialState: function() {\n return {count: 0};\n },\n moveRef: function() {\n this.setState({ count: this.state.count + 1 });\n },\n render: function() {\n var count = this.state.count;\n /**\n * What we have here, is three divs with refs (div1/2/3), but a single\n * moving cursor ref `hopRef` that \"hops\" around the three. We'll call the\n * `moveRef()` function several times and make sure that the hop ref\n * points to the correct divs.\n */\n return (\n React.DOM.div(null, \n React.DOM.div(\n {className:\"first\",\n ref:count % 3 === 0 ? 'hopRef' : 'divOneRef'}\n ),\n React.DOM.div(\n {className:\"second\",\n ref:count % 3 === 1 ? 'hopRef' : 'divTwoRef'}\n ),\n React.DOM.div(\n {className:\"third\",\n ref:count % 3 === 2 ? 'hopRef' : 'divThreeRef'}\n )\n )\n );\n }\n });\n\n it(\"Allow refs to hop around children correctly\", function() {\n var refHopsAround = ReactTestUtils.renderIntoDocument(RefHopsAround(null ));\n\n var firstDiv =\n ReactTestUtils.findRenderedDOMComponentWithClass(refHopsAround, 'first');\n var secondDiv =\n ReactTestUtils.findRenderedDOMComponentWithClass(refHopsAround, 'second');\n var thirdDiv =\n ReactTestUtils.findRenderedDOMComponentWithClass(refHopsAround, 'third');\n\n expect(refHopsAround.refs.hopRef).toEqual(firstDiv);\n expect(refHopsAround.refs.divTwoRef).toEqual(secondDiv);\n expect(refHopsAround.refs.divThreeRef).toEqual(thirdDiv);\n\n refHopsAround.moveRef();\n expect(refHopsAround.refs.divOneRef).toEqual(firstDiv);\n expect(refHopsAround.refs.hopRef).toEqual(secondDiv);\n expect(refHopsAround.refs.divThreeRef).toEqual(thirdDiv);\n\n refHopsAround.moveRef();\n expect(refHopsAround.refs.divOneRef).toEqual(firstDiv);\n expect(refHopsAround.refs.divTwoRef).toEqual(secondDiv);\n expect(refHopsAround.refs.hopRef).toEqual(thirdDiv);\n\n /**\n * Make sure that after the third, we're back to where we started and the\n * refs are completely restored.\n */\n refHopsAround.moveRef();\n expect(refHopsAround.refs.hopRef).toEqual(firstDiv);\n expect(refHopsAround.refs.divTwoRef).toEqual(secondDiv);\n expect(refHopsAround.refs.divThreeRef).toEqual(thirdDiv);\n });\n});\n\n\nrequire(\"../../mock-modules\").register(\"core/__tests__/refs-test\", module);\n",
"dom/__tests__/CSSPropertyOperations-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar React = require(\"../../React\");\n\ndescribe('CSSPropertyOperations', function() {\n var CSSPropertyOperations;\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n CSSPropertyOperations = require(\"../../CSSPropertyOperations\");\n });\n\n it('should create markup for simple styles', function() {\n expect(CSSPropertyOperations.createMarkupForStyles({\n backgroundColor: '#3b5998',\n display: 'none'\n })).toBe('background-color:#3b5998;display:none;');\n });\n\n it('should ignore undefined styles', function() {\n expect(CSSPropertyOperations.createMarkupForStyles({\n backgroundColor: undefined,\n display: 'none'\n })).toBe('display:none;');\n });\n\n it('should ignore null styles', function() {\n expect(CSSPropertyOperations.createMarkupForStyles({\n backgroundColor: null,\n display: 'none'\n })).toBe('display:none;');\n });\n\n it('should return null for no styles', function() {\n expect(CSSPropertyOperations.createMarkupForStyles({\n backgroundColor: null,\n display: null\n })).toBe(null);\n });\n\n it('should automatically append `px` to relevant styles', function() {\n expect(CSSPropertyOperations.createMarkupForStyles({\n left: 0,\n margin: 16,\n opacity: 0.5,\n padding: '4px'\n })).toBe('left:0;margin:16px;opacity:0.5;padding:4px;');\n });\n\n it('should not append `px` to styles that might need a number', function() {\n expect(CSSPropertyOperations.createMarkupForStyles({\n fillOpacity: 1,\n fontWeight: 2,\n opacity: 3,\n orphans: 4,\n zIndex: 5,\n zoom: 6,\n lineHeight: 7\n })).toBe(\n 'fill-opacity:1;font-weight:2;opacity:3;orphans:4;z-index:5;zoom:6;' +\n 'line-height:7;'\n );\n });\n\n it('should set style attribute when styles exist', function() {\n var styles = {\n backgroundColor: '#000',\n display: 'none'\n };\n var div = React.DOM.div( {style:styles} );\n var root = document.createElement('div');\n React.renderComponent(div, root);\n expect(/style=\".*\"/.test(root.innerHTML)).toBe(true);\n });\n\n it('should not set style attribute when no styles exist', function() {\n var styles = {\n backgroundColor: null,\n display: null\n };\n var div = React.DOM.div( {style:styles} );\n var root = document.createElement('div');\n React.renderComponent(div, root);\n expect(/style=\".*\"/.test(root.innerHTML)).toBe(false);\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"dom/__tests__/CSSPropertyOperations-test\", module);\n",
"dom/__tests__/DOMPropertyOperations-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\ndescribe('DOMPropertyOperations', function() {\n var DOMPropertyOperations;\n var DOMProperty;\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n var ReactDefaultInjection = require(\"../../ReactDefaultInjection\");\n ReactDefaultInjection.inject();\n\n DOMPropertyOperations = require(\"../../DOMPropertyOperations\");\n DOMProperty = require(\"../../DOMProperty\");\n });\n\n describe('createMarkupForProperty', function() {\n\n it('should create markup for simple properties', function() {\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'name',\n 'simple'\n )).toBe('name=\"simple\"');\n\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'name',\n false\n )).toBe('name=\"false\"');\n\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'name',\n null\n )).toBe('');\n });\n\n it('should work with the id attribute', function() {\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'id',\n 'simple'\n )).toBe('id=\"simple\"');\n });\n\n it('should warn about incorrect casing', function() {\n spyOn(console, 'warn');\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'tabindex',\n '1'\n )).toBe(null);\n expect(console.warn.argsForCall.length).toBe(1);\n expect(console.warn.argsForCall[0][0]).toContain('tabIndex');\n });\n\n it('should warn about class', function() {\n spyOn(console, 'warn');\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'class',\n 'muffins'\n )).toBe(null);\n expect(console.warn.argsForCall.length).toBe(1);\n expect(console.warn.argsForCall[0][0]).toContain('className');\n });\n\n it('should create markup for boolean properties', function() {\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'checked',\n 'simple'\n )).toBe('checked=\"simple\"');\n\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'checked',\n true\n )).toBe('checked=\"true\"');\n\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'checked',\n false\n )).toBe('');\n });\n\n it('should create markup for custom attributes', function() {\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'aria-label',\n 'simple'\n )).toBe('aria-label=\"simple\"');\n\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'aria-label',\n false\n )).toBe('aria-label=\"false\"');\n\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'aria-label',\n null\n )).toBe('');\n });\n\n });\n\n describe('setValueForProperty', function() {\n var stubNode;\n\n beforeEach(function() {\n stubNode = document.createElement('div');\n });\n\n it('should set values as properties by default', function() {\n DOMPropertyOperations.setValueForProperty(stubNode, 'title', 'Tip!');\n expect(stubNode.title).toBe('Tip!');\n });\n\n it('should set values as attributes if necessary', function() {\n DOMPropertyOperations.setValueForProperty(stubNode, 'role', '#');\n expect(stubNode.getAttribute('role')).toBe('#');\n expect(stubNode.role).toBeUndefined();\n });\n\n it('should convert attribute values to string first', function() {\n // Browsers default to this behavior, but some test environments do not.\n // This ensures that we have consistent behavior.\n var obj = {toString: function() { return '<html>'; }};\n DOMPropertyOperations.setValueForProperty(stubNode, 'role', obj);\n expect(stubNode.getAttribute('role')).toBe('<html>');\n });\n\n it('should remove for falsey boolean properties', function() {\n DOMPropertyOperations.setValueForProperty(\n stubNode,\n 'allowFullScreen',\n false\n );\n expect(stubNode.hasAttribute('allowFullScreen')).toBe(false);\n });\n\n it('should use mutation method where applicable', function() {\n DOMPropertyOperations.setValueForProperty(\n stubNode,\n 'className',\n 'selected'\n );\n expect(stubNode.className).toBe('selected');\n\n DOMPropertyOperations.setValueForProperty(\n stubNode,\n 'className',\n null\n );\n expect(stubNode.className).toBe('');\n });\n\n });\n\n describe('injectDOMPropertyConfig', function() {\n it('should support custom attributes', function() {\n // foobar does not exist yet\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'foobar',\n 'simple'\n )).toBe(null);\n\n // foo-* does not exist yet\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'foo-xyz',\n 'simple'\n )).toBe(null);\n\n // inject foobar DOM property\n DOMProperty.injection.injectDOMPropertyConfig({\n isCustomAttribute: function(name) {\n return name.indexOf('foo-') === 0;\n },\n Properties: {foobar: null}\n });\n\n // Ensure old attributes still work\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'name',\n 'simple'\n )).toBe('name=\"simple\"');\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'data-name',\n 'simple'\n )).toBe('data-name=\"simple\"');\n\n // foobar should work\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'foobar',\n 'simple'\n )).toBe('foobar=\"simple\"');\n\n // foo-* should work\n expect(DOMPropertyOperations.createMarkupForProperty(\n 'foo-xyz',\n 'simple'\n )).toBe('foo-xyz=\"simple\"');\n\n // It should complain about double injections.\n expect(function() {\n DOMProperty.injection.injectDOMPropertyConfig(\n {Properties: {foobar: null}}\n );\n }).toThrow();\n });\n });\n});\n\nrequire(\"../../mock-modules\").register(\"dom/__tests__/DOMPropertyOperations-test\", module);\n",
"dom/__tests__/Danger-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\nvar React = require(\"../../React\");\n\ndescribe('Danger', function() {\n\n describe('dangerouslyRenderMarkup', function() {\n var Danger;\n var transaction;\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n Danger = require(\"../../Danger\");\n\n var ReactReconcileTransaction = require(\"../../ReactReconcileTransaction\");\n transaction = new ReactReconcileTransaction();\n });\n\n it('should render markup', function() {\n var markup = (React.DOM.div(null )).mountComponent('.rX', transaction, 0);\n var output = Danger.dangerouslyRenderMarkup([markup])[0];\n\n expect(output.nodeName).toBe('DIV');\n });\n\n it('should render markup with props', function() {\n var markup = (React.DOM.div( {className:\"foo\"} )).mountComponent(\n '.rX',\n transaction,\n 0\n );\n var output = Danger.dangerouslyRenderMarkup([markup])[0];\n\n expect(output.nodeName).toBe('DIV');\n expect(output.className).toBe('foo');\n });\n\n it('should render wrapped markup', function() {\n var markup = (React.DOM.th(null )).mountComponent('.rX', transaction, 0);\n var output = Danger.dangerouslyRenderMarkup([markup])[0];\n\n expect(output.nodeName).toBe('TH');\n });\n\n it('should render lists of markup with similar `nodeName`', function() {\n var renderedMarkup = Danger.dangerouslyRenderMarkup(\n ['<p id=\"A\">1</p>', '<p id=\"B\">2</p>', '<p id=\"C\">3</p>']\n );\n\n expect(renderedMarkup.length).toBe(3);\n\n expect(renderedMarkup[0].nodeName).toBe('P');\n expect(renderedMarkup[1].nodeName).toBe('P');\n expect(renderedMarkup[2].nodeName).toBe('P');\n\n expect(renderedMarkup[0].innerHTML).toBe('1');\n expect(renderedMarkup[1].innerHTML).toBe('2');\n expect(renderedMarkup[2].innerHTML).toBe('3');\n });\n\n it('should render lists of markup with different `nodeName`', function() {\n var renderedMarkup = Danger.dangerouslyRenderMarkup(\n ['<p id=\"A\">1</p>', '<td id=\"B\">2</td>', '<p id=\"C\">3</p>']\n );\n\n expect(renderedMarkup.length).toBe(3);\n\n expect(renderedMarkup[0].nodeName).toBe('P');\n expect(renderedMarkup[1].nodeName).toBe('TD');\n expect(renderedMarkup[2].nodeName).toBe('P');\n\n expect(renderedMarkup[0].innerHTML).toBe('1');\n expect(renderedMarkup[1].innerHTML).toBe('2');\n expect(renderedMarkup[2].innerHTML).toBe('3');\n });\n\n it('should throw when rendering invalid markup', function() {\n expect(function() {\n Danger.dangerouslyRenderMarkup(['']);\n }).toThrow(\n 'Invariant Violation: dangerouslyRenderMarkup(...): Missing markup.'\n );\n\n spyOn(console, \"error\");\n\n var renderedMarkup = Danger.dangerouslyRenderMarkup(['<p></p><p></p>']);\n var args = console.error.argsForCall[0];\n\n expect(renderedMarkup.length).toBe(1);\n expect(renderedMarkup[0].nodeName).toBe('P');\n\n expect(console.error.argsForCall.length).toBe(1);\n\n expect(args.length).toBe(2);\n expect(args[0]).toBe('Danger: Discarding unexpected node:');\n expect(args[1].nodeName).toBe('P');\n });\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"dom/__tests__/Danger-test\", module);\n",
"dom/__tests__/getNodeForCharacterOffset-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar getTestDocument = require(\"../../getTestDocument\");\n\nvar getNodeForCharacterOffset = require(\"../../getNodeForCharacterOffset\");\n\n// Create node from HTML string\nfunction createNode(html) {\n var node = (getTestDocument() || document).createElement('div');\n node.innerHTML = html;\n return node;\n}\n\n// Check getNodeForCharacterOffset return value matches expected result.\nfunction expectNodeOffset(result, textContent, nodeOffset) {\n expect(result.node.textContent).toBe(textContent);\n expect(result.offset).toBe(nodeOffset);\n}\n\ndescribe('getNodeForCharacterOffset', function() {\n it('should handle siblings', function() {\n var node = createNode('<i>123</i><i>456</i><i>789</i>');\n\n expectNodeOffset(getNodeForCharacterOffset(node, 0), '123', 0);\n expectNodeOffset(getNodeForCharacterOffset(node, 4), '456', 1);\n });\n\n it('should handle trailing chars', function() {\n var node = createNode('<i>123</i><i>456</i><i>789</i>');\n\n expectNodeOffset(getNodeForCharacterOffset(node, 3), '123', 3);\n expectNodeOffset(getNodeForCharacterOffset(node, 9), '789', 3);\n });\n\n it('should handle trees', function() {\n var node = createNode(\n '<i>' +\n '<i>1</i>' +\n '<i>' +\n '<i>' +\n '<i>2</i>' +\n '<i></i>' +\n '</i>' +\n '</i>' +\n '<i>' +\n '3' +\n '<i>45</i>' +\n '</i>' +\n '</i>'\n );\n\n expectNodeOffset(getNodeForCharacterOffset(node, 3), '3', 1);\n expectNodeOffset(getNodeForCharacterOffset(node, 5), '45', 2);\n expect(getNodeForCharacterOffset(node, 10)).toBeUndefined();\n });\n\n it('should handle non-existent offset', function() {\n var node = createNode('<i>123</i>');\n\n expect(getNodeForCharacterOffset(node, -1)).toBeUndefined();\n expect(getNodeForCharacterOffset(node, 4)).toBeUndefined();\n });\n});\n\nrequire(\"../../mock-modules\").register(\"dom/__tests__/getNodeForCharacterOffset-test\", module);\n",
"dom/__tests__/mutateHTMLNodeWithMarkup-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar getTestDocument = require(\"../../getTestDocument\");\n\nvar mutateHTMLNodeWithMarkup = require(\"../../mutateHTMLNodeWithMarkup\");\n\ndescribe('mutateHTMLNodeWithMarkup', function() {\n it('should mutate the document html', function() {\n var html = '<html><head><title>test</title></head><body>test</body></html>';\n var testDocument = getTestDocument() || document;\n\n mutateHTMLNodeWithMarkup(testDocument.documentElement, html);\n expect(testDocument.body.innerHTML).toBe('test');\n });\n\n it('should change attributes', function() {\n var html = '<html><head><title>test</title></head><body>test</body></html>';\n var testDocument = getTestDocument() || document;\n\n mutateHTMLNodeWithMarkup(testDocument.documentElement, html);\n expect(!!testDocument.documentElement.getAttribute('lang')).toBe(false);\n\n var html2 = '<html lang=\"en\"><head><title>test</title></head>' +\n '<body>test</body></html>';\n mutateHTMLNodeWithMarkup(testDocument.documentElement, html2);\n expect(testDocument.documentElement.getAttribute('lang')).toBe('en');\n\n mutateHTMLNodeWithMarkup(testDocument.documentElement, html);\n expect(!!testDocument.documentElement.getAttribute('lang')).toBe(false);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"dom/__tests__/mutateHTMLNodeWithMarkup-test\", module);\n",
"dom/components/__tests__/ReactDOMButton-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\n/*jshint evil:true */\n\nvar mocks = require(\"../../../mocks\");\n\ndescribe('ReactDOMButton', function() {\n var React;\n var ReactTestUtils;\n\n var onClick = mocks.getMockFunction();\n\n function expectClickThru(button) {\n onClick.mockClear();\n ReactTestUtils.Simulate.click(button.getDOMNode());\n expect(onClick.mock.calls.length).toBe(1);\n }\n\n function expectNoClickThru(button) {\n onClick.mockClear();\n ReactTestUtils.Simulate.click(button.getDOMNode());\n expect(onClick.mock.calls.length).toBe(0);\n }\n\n function mounted(button) {\n ReactTestUtils.renderIntoDocument(button);\n return button;\n }\n\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactTestUtils = require(\"../../../ReactTestUtils\");\n });\n\n it('should forward clicks when it starts out not disabled', function() {\n expectClickThru(mounted(React.DOM.button( {onClick:onClick} )));\n });\n\n it('should not forward clicks when it starts out disabled', function() {\n expectNoClickThru(\n mounted(React.DOM.button( {disabled:true, onClick:onClick} ))\n );\n });\n\n it('should forward clicks when it becomes not disabled', function() {\n var btn = mounted(React.DOM.button( {disabled:true, onClick:onClick} ));\n btn.setProps({disabled: false});\n expectClickThru(btn);\n });\n\n it('should not forward clicks when it becomes disabled', function() {\n var btn = mounted(React.DOM.button( {onClick:onClick} ));\n btn.setProps({disabled: true});\n expectNoClickThru(btn);\n });\n\n it('should work correctly if the listener is changed', function() {\n var btn = mounted(\n React.DOM.button( {disabled:true, onClick:function() {}} )\n );\n\n btn.setProps({\n disabled: false,\n onClick: onClick\n });\n\n expectClickThru(btn);\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"dom/components/__tests__/ReactDOMButton-test\", module);\n",
"dom/components/__tests__/ReactDOMInput-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\n/*jshint evil:true */\n\nvar emptyFunction = require(\"../../../emptyFunction\");\nvar mocks = require(\"../../../mocks\");\n\ndescribe('ReactDOMInput', function() {\n var React;\n var ReactLink;\n var ReactTestUtils;\n\n var renderTextInput;\n\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactLink = require(\"../../../ReactLink\");\n ReactTestUtils = require(\"../../../ReactTestUtils\");\n\n renderTextInput = function(component) {\n var stub = ReactTestUtils.renderIntoDocument(component);\n var node = stub.getDOMNode();\n return node;\n };\n });\n\n it('should display `defaultValue` of number 0', function() {\n var stub = React.DOM.input( {type:\"text\", defaultValue:0} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('0');\n });\n\n it('should display \"true\" for `defaultValue` of `true`', function() {\n var stub = React.DOM.input( {type:\"text\", defaultValue:true} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('true');\n });\n\n it('should display \"false\" for `defaultValue` of `false`', function() {\n var stub = React.DOM.input( {type:\"text\", defaultValue:false} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('false');\n });\n\n it('should display \"foobar\" for `defaultValue` of `objToString`', function() {\n var objToString = {\n toString: function() {\n return \"foobar\";\n }\n };\n\n var stub = React.DOM.input( {type:\"text\", defaultValue:objToString} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('foobar');\n });\n\n it('should display `value` of number 0', function() {\n var stub = React.DOM.input( {type:\"text\", value:0} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('0');\n });\n\n it('should allow setting `value` to `true`', function() {\n var stub = React.DOM.input( {type:\"text\", value:\"yolo\"} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('yolo');\n\n stub.replaceProps({value: true});\n expect(node.value).toEqual('true');\n });\n\n it(\"should allow setting `value` to `false`\", function() {\n var stub = React.DOM.input( {type:\"text\", value:\"yolo\"} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('yolo');\n\n stub.replaceProps({value: false});\n expect(node.value).toEqual('false');\n });\n\n it('should allow setting `value` to `objToString`', function() {\n var stub = React.DOM.input( {type:\"text\", value:\"foo\"} );\n var node = renderTextInput(stub);\n\n expect(node.value).toBe('foo');\n\n var objToString = {\n toString: function() {\n return \"foobar\";\n }\n };\n\n stub.replaceProps({value: objToString});\n expect(node.value).toEqual('foobar');\n });\n\n it('should properly control a value of number `0`', function() {\n var stub = React.DOM.input( {type:\"text\", value:0} );\n var node = renderTextInput(stub);\n\n node.value = 'giraffe';\n ReactTestUtils.Simulate.input(node);\n expect(node.value).toBe('0');\n });\n\n it('should control radio buttons', function() {\n var RadioGroup = React.createClass({displayName: 'RadioGroup',\n render: function() {\n return (\n React.DOM.div(null, \n React.DOM.input( {ref:\"a\", type:\"radio\", name:\"fruit\", checked:true} ),\"A \",\n React.DOM.input( {ref:\"b\", type:\"radio\", name:\"fruit\"} ),\"B \",\n React.DOM.form(null, \n React.DOM.input( {ref:\"c\", type:\"radio\", name:\"fruit\", defaultChecked:true} )\n )\n )\n );\n }\n });\n\n var stub = ReactTestUtils.renderIntoDocument(RadioGroup(null ));\n var aNode = stub.refs.a.getDOMNode();\n var bNode = stub.refs.b.getDOMNode();\n var cNode = stub.refs.c.getDOMNode();\n\n expect(aNode.checked).toBe(true);\n expect(bNode.checked).toBe(false);\n // c is in a separate form and shouldn't be affected at all here\n expect(cNode.checked).toBe(true);\n\n bNode.checked = true;\n // This next line isn't necessary in a proper browser environment, but\n // jsdom doesn't uncheck the others in a group (which makes this whole test\n // a little less effective)\n aNode.checked = false;\n expect(cNode.checked).toBe(true);\n\n // Now let's run the actual ReactDOMInput change event handler (on radio\n // inputs, ChangeEventPlugin listens for the `click` event so trigger that)\n ReactTestUtils.Simulate.click(bNode);\n\n // The original state should have been restored\n expect(aNode.checked).toBe(true);\n expect(cNode.checked).toBe(true);\n });\n\n it('should support ReactLink', function() {\n var container = document.createElement('div');\n var link = new ReactLink('yolo', mocks.getMockFunction());\n var instance = React.DOM.input( {type:\"text\", valueLink:link} );\n\n React.renderComponent(instance, container);\n\n expect(instance.getDOMNode().value).toBe('yolo');\n expect(link.value).toBe('yolo');\n expect(link.requestChange.mock.calls.length).toBe(0);\n\n instance.getDOMNode().value = 'test';\n ReactTestUtils.Simulate.input(instance.getDOMNode());\n\n expect(link.requestChange.mock.calls.length).toBe(1);\n expect(link.requestChange.mock.calls[0][0]).toEqual('test');\n });\n\n it('should throw if both value and valueLink are provided', function() {\n var node = document.createElement('div');\n var link = new ReactLink('yolo', mocks.getMockFunction());\n var instance = React.DOM.input( {type:\"text\", valueLink:link} );\n\n expect(React.renderComponent.bind(React, instance, node)).not.toThrow();\n\n instance = React.DOM.input( {type:\"text\", valueLink:link, value:\"test\"} );\n expect(React.renderComponent.bind(React, instance, node)).toThrow();\n\n instance = React.DOM.input( {type:\"text\", valueLink:link, onChange:emptyFunction} );\n expect(React.renderComponent.bind(React, instance, node)).toThrow();\n\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"dom/components/__tests__/ReactDOMInput-test\", module);\n",
"dom/components/__tests__/ReactDOMSelect-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\n/*jshint evil:true */\n\nvar mocks = require(\"../../../mocks\");\n\ndescribe('ReactDOMSelect', function() {\n var React;\n var ReactLink;\n var ReactTestUtils;\n\n var renderSelect;\n\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactLink = require(\"../../../ReactLink\");\n ReactTestUtils = require(\"../../../ReactTestUtils\");\n\n renderSelect = function(component) {\n var stub = ReactTestUtils.renderIntoDocument(component);\n var node = stub.getDOMNode();\n return node;\n };\n });\n\n it('should allow setting `defaultValue`', function() {\n var stub =\n React.DOM.select( {defaultValue:\"giraffe\"}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.value).toBe('giraffe');\n\n // Changing `defaultValue` should do nothing.\n stub.setProps({defaultValue: 'gorilla'});\n expect(node.value).toEqual('giraffe');\n });\n\n it('should allow setting `defaultValue` with multiple', function() {\n var stub =\n React.DOM.select( {multiple:true, defaultValue:['giraffe', 'gorilla']}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(true); // gorilla\n\n // Changing `defaultValue` should do nothing.\n stub.setProps({defaultValue: ['monkey']});\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(true); // gorilla\n });\n\n it('should allow setting `value`', function() {\n var stub =\n React.DOM.select( {value:\"giraffe\"}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.value).toBe('giraffe');\n\n // Changing the `value` prop should change the selected option.\n stub.setProps({value: 'gorilla'});\n expect(node.value).toEqual('gorilla');\n });\n\n it('should allow setting `value` with multiple', function() {\n var stub =\n React.DOM.select( {multiple:true, value:['giraffe', 'gorilla']}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(true); // gorilla\n\n // Changing the `value` prop should change the selected options.\n stub.setProps({value: ['monkey']});\n\n expect(node.options[0].selected).toBe(true); // monkey\n expect(node.options[1].selected).toBe(false); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n });\n\n it('should allow setting `value` with `objectToString`', function() {\n var objectToString = {\n animal: \"giraffe\",\n toString: function() {\n return this.animal;\n }\n };\n\n var stub =\n React.DOM.select( {multiple:true, value:[objectToString]}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n\n // Changing the `value` prop should change the selected options.\n objectToString.animal = \"monkey\";\n stub.forceUpdate();\n\n expect(node.options[0].selected).toBe(true); // monkey\n expect(node.options[1].selected).toBe(false); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n });\n\n it('should allow switching to multiple', function() {\n var stub =\n React.DOM.select( {defaultValue:\"giraffe\"}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n\n // When making it multiple, giraffe should still be selected\n stub.setProps({multiple: true, defaultValue: null});\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n });\n\n it('should allow switching from multiple', function() {\n var stub =\n React.DOM.select( {multiple:true, defaultValue:['giraffe', 'gorilla']}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(true); // gorilla\n\n // When removing multiple, giraffe should still be selected (but gorilla\n // will no longer be)\n stub.setProps({multiple: false, defaultValue: null});\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n });\n\n it('should support ReactLink', function() {\n var link = new ReactLink('giraffe', mocks.getMockFunction());\n var stub =\n React.DOM.select( {valueLink:link}, \n React.DOM.option( {value:\"monkey\"}, \"A monkey!\"),\n React.DOM.option( {value:\"giraffe\"}, \"A giraffe!\"),\n React.DOM.option( {value:\"gorilla\"}, \"A gorilla!\")\n );\n var node = renderSelect(stub);\n\n expect(node.options[0].selected).toBe(false); // monkey\n expect(node.options[1].selected).toBe(true); // giraffe\n expect(node.options[2].selected).toBe(false); // gorilla\n expect(link.requestChange.mock.calls.length).toBe(0);\n\n node.options[1].selected = false;\n node.options[2].selected = true;\n ReactTestUtils.Simulate.change(node);\n\n expect(link.requestChange.mock.calls.length).toBe(1);\n expect(link.requestChange.mock.calls[0][0]).toEqual('gorilla');\n\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"dom/components/__tests__/ReactDOMSelect-test\", module);\n",
"dom/components/__tests__/ReactDOMTextarea-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\n/*jshint evil:true */\n\nvar mocks = require(\"../../../mocks\");\n\ndescribe('ReactDOMTextarea', function() {\n var React;\n var ReactLink;\n var ReactTestUtils;\n\n var renderTextarea;\n\n beforeEach(function() {\n React = require(\"../../../React\");\n ReactLink = require(\"../../../ReactLink\");\n ReactTestUtils = require(\"../../../ReactTestUtils\");\n\n renderTextarea = function(component) {\n var stub = ReactTestUtils.renderIntoDocument(component);\n var node = stub.getDOMNode();\n // Polyfilling the browser's quirky behavior.\n node.value = node.innerHTML;\n return node;\n };\n });\n\n it('should allow setting `defaultValue`', function() {\n var stub = React.DOM.textarea( {defaultValue:\"giraffe\"} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('giraffe');\n\n // Changing `defaultValue` should do nothing.\n stub.replaceProps({defaultValue: 'gorilla'});\n expect(node.value).toEqual('giraffe');\n });\n\n it('should display `defaultValue` of number 0', function() {\n var stub = React.DOM.textarea( {defaultValue:0} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('0');\n });\n\n it('should display \"false\" for `defaultValue` of `false`', function() {\n var stub = React.DOM.textarea( {type:\"text\", defaultValue:false} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('false');\n });\n\n it('should display \"foobar\" for `defaultValue` of `objToString`', function() {\n var objToString = {\n toString: function() {\n return \"foobar\";\n }\n };\n\n var stub = React.DOM.textarea( {type:\"text\", defaultValue:objToString} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('foobar');\n });\n\n it('should display `value` of number 0', function() {\n var stub = React.DOM.textarea( {value:0} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('0');\n });\n\n it('should allow setting `value` to `giraffe`', function() {\n var stub = React.DOM.textarea( {value:\"giraffe\"} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('giraffe');\n\n stub.replaceProps({value: 'gorilla'});\n expect(node.value).toEqual('gorilla');\n });\n\n it('should allow setting `value` to `true`', function() {\n var stub = React.DOM.textarea( {value:\"giraffe\"} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('giraffe');\n\n stub.replaceProps({value: true});\n expect(node.value).toEqual('true');\n });\n\n it('should allow setting `value` to `false`', function() {\n var stub = React.DOM.textarea( {value:\"giraffe\"} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('giraffe');\n\n stub.replaceProps({value: false});\n expect(node.value).toEqual('false');\n });\n\n it('should allow setting `value` to `objToString`', function() {\n var stub = React.DOM.textarea( {value:\"giraffe\"} );\n var node = renderTextarea(stub);\n\n expect(node.value).toBe('giraffe');\n\n var objToString = {\n toString: function() {\n return \"foo\";\n }\n };\n stub.replaceProps({value: objToString});\n expect(node.value).toEqual('foo');\n });\n\n it('should properly control a value of number `0`', function() {\n var stub = React.DOM.textarea( {value:0} );\n var node = renderTextarea(stub);\n\n node.value = 'giraffe';\n ReactTestUtils.Simulate.input(node);\n expect(node.value).toBe('0');\n });\n\n it('should treat children like `defaultValue`', function() {\n spyOn(console, 'warn');\n\n var stub = React.DOM.textarea(null, \"giraffe\");\n var node = renderTextarea(stub);\n\n expect(console.warn.argsForCall.length).toBe(1);\n expect(node.value).toBe('giraffe');\n\n // Changing children should do nothing, it functions like `defaultValue`.\n stub.replaceProps({children: 'gorilla'});\n expect(node.value).toEqual('giraffe');\n });\n\n it('should allow numbers as children', function() {\n spyOn(console, 'warn');\n var node = renderTextarea(React.DOM.textarea(null, 17));\n expect(console.warn.argsForCall.length).toBe(1);\n expect(node.value).toBe('17');\n });\n\n it('should allow booleans as children', function() {\n spyOn(console, 'warn');\n var node = renderTextarea(React.DOM.textarea(null, false));\n expect(console.warn.argsForCall.length).toBe(1);\n expect(node.value).toBe('false');\n });\n\n it('should allow objects as children', function() {\n spyOn(console, 'warn');\n var obj = {\n toString: function() {\n return \"sharkswithlasers\";\n }\n };\n var node = renderTextarea(React.DOM.textarea(null, obj));\n expect(console.warn.argsForCall.length).toBe(1);\n expect(node.value).toBe('sharkswithlasers');\n });\n\n it('should throw with multiple or invalid children', function() {\n spyOn(console, 'warn');\n\n expect(function() {\n ReactTestUtils.renderIntoDocument(\n React.DOM.textarea(null, 'hello','there')\n );\n }).toThrow();\n\n expect(console.warn.argsForCall.length).toBe(1);\n\n var stub;\n expect(function() {\n stub = renderTextarea(React.DOM.textarea(null, React.DOM.strong(null )));\n }).not.toThrow();\n\n expect(stub.value).toBe('[object Object]');\n\n expect(console.warn.argsForCall.length).toBe(2);\n });\n\n it('should support ReactLink', function() {\n var container = document.createElement('div');\n var link = new ReactLink('yolo', mocks.getMockFunction());\n var instance = React.DOM.textarea( {valueLink:link} );\n\n React.renderComponent(instance, container);\n\n expect(instance.getDOMNode().value).toBe('yolo');\n expect(link.value).toBe('yolo');\n expect(link.requestChange.mock.calls.length).toBe(0);\n\n instance.getDOMNode().value = 'test';\n ReactTestUtils.Simulate.input(instance.getDOMNode());\n\n expect(link.requestChange.mock.calls.length).toBe(1);\n expect(link.requestChange.mock.calls[0][0]).toEqual('test');\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"dom/components/__tests__/ReactDOMTextarea-test\", module);\n",
"environment/__tests__/ReactServerRendering-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\")\n .dontMock('ExecutionEnvironment')\n .dontMock('React')\n .dontMock('ReactMount')\n .dontMock('ReactServerRendering')\n .dontMock('ReactTestUtils')\n .dontMock('ReactMarkupChecksum');\n\nvar mocks = require(\"../../mocks\");\n\nvar React;\nvar ReactMount;\nvar ReactTestUtils;\nvar ReactServerRendering;\nvar ReactMarkupChecksum;\nvar ExecutionEnvironment;\n\ndescribe('ReactServerRendering', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n React = require(\"../../React\");\n ReactMount = require(\"../../ReactMount\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n ExecutionEnvironment = require(\"../../ExecutionEnvironment\");\n ExecutionEnvironment.canUseDOM = false;\n ReactServerRendering = require(\"../../ReactServerRendering\");\n ReactMarkupChecksum = require(\"../../ReactMarkupChecksum\");\n });\n\n it('should generate simple markup', function() {\n var response;\n ReactServerRendering.renderComponentToString(\n React.DOM.span(null, \"hello world\"),\n function(response_) {\n response = response_;\n }\n );\n expect(response).toMatch(\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\" ' +\n ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '=\"[^\"]+\">hello world</span>'\n );\n });\n\n it('should render composite components', function() {\n var Parent = React.createClass({displayName: 'Parent',\n render: function() {\n return React.DOM.div(null, Child( {name:\"child\"} ));\n }\n });\n var Child = React.createClass({displayName: 'Child',\n render: function() {\n return React.DOM.span(null, \"My name is \", this.props.name);\n }\n });\n var response;\n ReactServerRendering.renderComponentToString(\n Parent(null ),\n function(response_) {\n response = response_;\n }\n );\n expect(response).toMatch(\n '<div ' + ReactMount.ATTR_NAME + '=\"[^\"]+\" ' +\n ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '=\"[^\"]+\">' +\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\">' +\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\">My name is </span>' +\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\">child</span>' +\n '</span>' +\n '</div>'\n );\n });\n\n it('should only execute certain lifecycle methods', function() {\n var lifecycle = [];\n var TestComponent = React.createClass({displayName: 'TestComponent',\n componentWillMount: function() {\n lifecycle.push('componentWillMount');\n },\n componentDidMount: function() {\n lifecycle.push('componentDidMount');\n },\n getInitialState: function() {\n lifecycle.push('getInitialState');\n return {name: 'TestComponent'};\n },\n render: function() {\n lifecycle.push('render');\n return React.DOM.span(null, \"Component name: \", this.state.name);\n },\n componentWillUpdate: function() {\n lifecycle.push('componentWillUpdate');\n },\n componentDidUpdate: function() {\n lifecycle.push('componentDidUpdate');\n },\n shouldComponentUpdate: function() {\n lifecycle.push('shouldComponentUpdate');\n },\n componentWillReceiveProps: function() {\n lifecycle.push('componentWillReceiveProps');\n },\n componentWillUnmount: function() {\n lifecycle.push('componentWillUnmount');\n }\n });\n\n var response;\n\n ReactServerRendering.renderComponentToString(\n TestComponent(null ),\n function (_response) {\n response = _response;\n }\n );\n\n expect(response).toMatch(\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\" ' +\n ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '=\"[^\"]+\">' +\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\">Component name: </span>' +\n '<span ' + ReactMount.ATTR_NAME + '=\"[^\"]+\">TestComponent</span>' +\n '</span>'\n );\n expect(lifecycle).toEqual(\n ['getInitialState', 'componentWillMount', 'render']\n );\n });\n\n it('should have the correct mounting behavior', function() {\n // This test is testing client-side behavior.\n ExecutionEnvironment.canUseDOM = true;\n\n var mountCount = 0;\n var numClicks = 0;\n\n var TestComponent = React.createClass({displayName: 'TestComponent',\n componentDidMount: function() {\n mountCount++;\n },\n click: function() {\n numClicks++;\n },\n render: function() {\n return (\n React.DOM.span( {ref:\"span\", onClick:this.click}, \"Name: \", this.props.name)\n );\n }\n });\n\n var element = document.createElement('div');\n React.renderComponent(TestComponent(null ), element);\n\n var lastMarkup = element.innerHTML;\n\n // Exercise the update path. Markup should not change,\n // but some lifecycle methods should be run again.\n React.renderComponent(TestComponent( {name:\"x\"} ), element);\n expect(mountCount).toEqual(1);\n\n // Unmount and remount. We should get another mount event and\n // we should get different markup, as the IDs are unique each time.\n React.unmountComponentAtNode(element);\n expect(element.innerHTML).toEqual('');\n React.renderComponent(TestComponent( {name:\"x\"} ), element);\n expect(mountCount).toEqual(2);\n expect(element.innerHTML).not.toEqual(lastMarkup);\n\n // Now kill the node and render it on top of server-rendered markup, as if\n // we used server rendering. We should mount again, but the markup should be\n // unchanged. We will append a sentinel at the end of innerHTML to be sure\n // that innerHTML was not changed.\n React.unmountComponentAtNode(element);\n expect(element.innerHTML).toEqual('');\n\n ExecutionEnvironment.canUseDOM = false;\n ReactServerRendering.renderComponentToString(\n TestComponent( {name:\"x\"} ),\n function(markup) {\n lastMarkup = markup;\n }\n );\n ExecutionEnvironment.canUseDOM = true;\n\n element.innerHTML = lastMarkup + ' __sentinel__';\n\n React.renderComponent(TestComponent( {name:\"x\"} ), element);\n expect(mountCount).toEqual(3);\n expect(element.innerHTML.indexOf('__sentinel__') > -1).toBe(true);\n React.unmountComponentAtNode(element);\n expect(element.innerHTML).toEqual('');\n\n // Now simulate a situation where the app is not idempotent. React should\n // warn but do the right thing.\n var _warn = console.warn;\n console.warn = mocks.getMockFunction();\n element.innerHTML = lastMarkup;\n var instance = React.renderComponent(TestComponent( {name:\"y\"} ), element);\n expect(mountCount).toEqual(4);\n expect(console.warn.mock.calls.length).toBe(1);\n expect(element.innerHTML.length > 0).toBe(true);\n expect(element.innerHTML).not.toEqual(lastMarkup);\n console.warn = _warn;\n\n // Ensure the events system works\n expect(numClicks).toEqual(0);\n ReactTestUtils.Simulate.click(instance.refs.span.getDOMNode());\n expect(numClicks).toEqual(1);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"environment/__tests__/ReactServerRendering-test\", module);\n",
"environment/__tests__/ReactWebWorker-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\ndescribe('ReactWebWorker', function() {\n ;(typeof Worker == 'undefined' ? xit : it)('can run React in a web worker', function() {\n var done = false;\n var error;\n\n var worker = new Worker(window.ReactWebWorker_URL || '/src/test/worker.js?_=' + Date.now().toString(36));\n worker.addEventListener('message', function(e) {\n var data = JSON.parse(e.data);\n if (data.type == 'error') {\n error = data.message + \"\\n\" + data.stack;\n } else {\n expect(data.type).toBe('done');\n done = true;\n }\n });\n\n waitsFor(function() {\n return done;\n });\n runs(function() {\n if (error) {\n console.log(error);\n throw new Error(error);\n }\n });\n });\n});\n\nrequire(\"../../mock-modules\").register(\"environment/__tests__/ReactWebWorker-test\", module);\n",
"event/__tests__/EventPluginRegistry-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nvar merge = require(\"../../merge\");\n\ndescribe('EventPluginRegistry', function() {\n var EventPluginRegistry;\n var createPlugin;\n\n beforeEach(function() {\n EventPluginRegistry = require(\"../../EventPluginRegistry\");\n EventPluginRegistry._resetEventPlugins();\n\n createPlugin = function(properties) {\n return merge({extractEvents: function() {}}, properties);\n };\n });\n\n it('should be able to inject ordering before plugins', function() {\n var OnePlugin = createPlugin();\n var TwoPlugin = createPlugin();\n var ThreePlugin = createPlugin();\n\n EventPluginRegistry.injectEventPluginOrder(['one', 'two', 'three']);\n EventPluginRegistry.injectEventPluginsByName({\n one: OnePlugin,\n two: TwoPlugin\n });\n EventPluginRegistry.injectEventPluginsByName({\n three: ThreePlugin\n });\n\n expect(EventPluginRegistry.plugins.length).toBe(3);\n expect(EventPluginRegistry.plugins[0]).toBe(OnePlugin);\n expect(EventPluginRegistry.plugins[1]).toBe(TwoPlugin);\n expect(EventPluginRegistry.plugins[2]).toBe(ThreePlugin);\n });\n\n it('should be able to inject plugins before and after ordering', function() {\n var OnePlugin = createPlugin();\n var TwoPlugin = createPlugin();\n var ThreePlugin = createPlugin();\n\n EventPluginRegistry.injectEventPluginsByName({\n one: OnePlugin,\n two: TwoPlugin\n });\n EventPluginRegistry.injectEventPluginOrder(['one', 'two', 'three']);\n EventPluginRegistry.injectEventPluginsByName({\n three: ThreePlugin\n });\n\n expect(EventPluginRegistry.plugins.length).toBe(3);\n expect(EventPluginRegistry.plugins[0]).toBe(OnePlugin);\n expect(EventPluginRegistry.plugins[1]).toBe(TwoPlugin);\n expect(EventPluginRegistry.plugins[2]).toBe(ThreePlugin);\n });\n\n it('should be able to inject repeated plugins and out-of-order', function() {\n var OnePlugin = createPlugin();\n var TwoPlugin = createPlugin();\n var ThreePlugin = createPlugin();\n\n EventPluginRegistry.injectEventPluginsByName({\n one: OnePlugin,\n three: ThreePlugin\n });\n EventPluginRegistry.injectEventPluginOrder(['one', 'two', 'three']);\n EventPluginRegistry.injectEventPluginsByName({\n two: TwoPlugin,\n three: ThreePlugin\n });\n\n expect(EventPluginRegistry.plugins.length).toBe(3);\n expect(EventPluginRegistry.plugins[0]).toBe(OnePlugin);\n expect(EventPluginRegistry.plugins[1]).toBe(TwoPlugin);\n expect(EventPluginRegistry.plugins[2]).toBe(ThreePlugin);\n });\n\n it('should throw if plugin does not implement `extractEvents`', function() {\n var BadPlugin = {};\n\n EventPluginRegistry.injectEventPluginOrder(['bad']);\n\n expect(function() {\n EventPluginRegistry.injectEventPluginsByName({\n bad: BadPlugin\n });\n }).toThrow(\n 'Invariant Violation: EventPluginRegistry: Event plugins must ' +\n 'implement an `extractEvents` method, but `bad` does not.'\n );\n });\n\n it('should throw if plugin does not exist in ordering', function() {\n var OnePlugin = createPlugin();\n var RandomPlugin = createPlugin();\n\n EventPluginRegistry.injectEventPluginOrder(['one']);\n\n expect(function() {\n EventPluginRegistry.injectEventPluginsByName({\n one: OnePlugin,\n random: RandomPlugin\n });\n }).toThrow(\n 'Invariant Violation: EventPluginRegistry: Cannot inject event plugins ' +\n 'that do not exist in the plugin ordering, `random`.'\n );\n });\n\n it('should throw if ordering is injected more than once', function() {\n var pluginOrdering = [];\n\n EventPluginRegistry.injectEventPluginOrder(pluginOrdering);\n\n expect(function() {\n EventPluginRegistry.injectEventPluginOrder(pluginOrdering);\n }).toThrow(\n 'Invariant Violation: EventPluginRegistry: Cannot inject event plugin ' +\n 'ordering more than once.'\n );\n });\n\n it('should throw if different plugins injected using same name', function() {\n var OnePlugin = createPlugin();\n var TwoPlugin = createPlugin();\n\n EventPluginRegistry.injectEventPluginsByName({same: OnePlugin});\n\n expect(function() {\n EventPluginRegistry.injectEventPluginsByName({same: TwoPlugin});\n }).toThrow(\n 'Invariant Violation: EventPluginRegistry: Cannot inject two different ' +\n 'event plugins using the same name, `same`.'\n );\n });\n\n it('should publish registration names of injected plugins', function() {\n var OnePlugin = createPlugin({\n eventTypes: {\n click: {registrationName: 'onClick'},\n focus: {registrationName: 'onFocus'}\n }\n });\n var TwoPlugin = createPlugin({\n eventTypes: {\n magic: {\n phasedRegistrationNames: {\n bubbled: 'onMagicBubble',\n captured: 'onMagicCapture'\n }\n }\n }\n });\n\n EventPluginRegistry.injectEventPluginsByName({one: OnePlugin});\n EventPluginRegistry.injectEventPluginOrder(['one', 'two']);\n\n expect(EventPluginRegistry.registrationNamesKeys.length).toBe(2);\n expect(EventPluginRegistry.registrationNames.onClick).toBe(OnePlugin);\n expect(EventPluginRegistry.registrationNames.onFocus).toBe(OnePlugin);\n\n EventPluginRegistry.injectEventPluginsByName({two: TwoPlugin});\n\n expect(EventPluginRegistry.registrationNamesKeys.length).toBe(4);\n expect(EventPluginRegistry.registrationNames.onMagicBubble).toBe(TwoPlugin);\n expect(\n EventPluginRegistry.registrationNames.onMagicCapture\n ).toBe(TwoPlugin);\n });\n\n it('should throw if multiple registration names collide', function() {\n var OnePlugin = createPlugin({\n eventTypes: {\n photoCapture: {registrationName: 'onPhotoCapture'}\n }\n });\n var TwoPlugin = createPlugin({\n eventTypes: {\n photo: {\n phasedRegistrationNames: {\n bubbled: 'onPhotoBubble',\n captured: 'onPhotoCapture'\n }\n }\n }\n });\n\n EventPluginRegistry.injectEventPluginsByName({\n one: OnePlugin,\n two: TwoPlugin\n });\n\n expect(function() {\n EventPluginRegistry.injectEventPluginOrder(['one', 'two']);\n }).toThrow(\n 'Invariant Violation: EventPluginHub: More than one plugin attempted ' +\n 'to publish the same registration name, `onPhotoCapture`.'\n );\n });\n\n it('should throw if an invalid event is published', function() {\n var OnePlugin = createPlugin({\n eventTypes: {\n badEvent: {/* missing configuration */}\n }\n });\n\n EventPluginRegistry.injectEventPluginsByName({one: OnePlugin});\n\n expect(function() {\n EventPluginRegistry.injectEventPluginOrder(['one']);\n }).toThrow(\n 'Invariant Violation: EventPluginRegistry: Failed to publish event ' +\n '`badEvent` for plugin `one`.'\n );\n });\n\n it('should be able to get the plugin from synthetic events', function() {\n var clickDispatchConfig = {\n registrationName: 'onClick'\n };\n var magicDispatchConfig = {\n phasedRegistrationNames: {\n bubbled: 'onMagicBubble',\n captured: 'onMagicCapture'\n }\n };\n\n var OnePlugin = createPlugin({\n eventTypes: {\n click: clickDispatchConfig,\n magic: magicDispatchConfig\n }\n });\n\n var clickEvent = {dispatchConfig: clickDispatchConfig};\n var magicEvent = {dispatchConfig: magicDispatchConfig};\n\n expect(EventPluginRegistry.getPluginModuleForEvent(clickEvent)).toBe(null);\n expect(EventPluginRegistry.getPluginModuleForEvent(magicEvent)).toBe(null);\n\n EventPluginRegistry.injectEventPluginsByName({one: OnePlugin});\n EventPluginRegistry.injectEventPluginOrder(['one']);\n\n expect(\n EventPluginRegistry.getPluginModuleForEvent(clickEvent)\n ).toBe(OnePlugin);\n expect(\n EventPluginRegistry.getPluginModuleForEvent(magicEvent)\n ).toBe(OnePlugin);\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"event/__tests__/EventPluginRegistry-test\", module);\n",
"event/synthetic/__tests__/SyntheticEvent-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nvar SyntheticEvent;\n\ndescribe('SyntheticEvent', function() {\n var createEvent;\n\n beforeEach(function() {\n SyntheticEvent = require(\"../../../SyntheticEvent\");\n\n createEvent = function(nativeEvent) {\n return SyntheticEvent.getPooled({}, '', nativeEvent);\n };\n });\n\n it('should normalize `target` from the nativeEvent', function() {\n var target = document.createElement('div');\n var syntheticEvent = createEvent({srcElement: target});\n\n expect(syntheticEvent.target).toBe(target);\n expect(syntheticEvent.type).toBe(undefined);\n });\n\n it('should be able to `preventDefault`', function() {\n var nativeEvent = {};\n var syntheticEvent = createEvent(nativeEvent);\n\n expect(syntheticEvent.isDefaultPrevented()).toBe(false);\n syntheticEvent.preventDefault();\n expect(syntheticEvent.isDefaultPrevented()).toBe(true);\n\n expect(syntheticEvent.defaultPrevented).toBe(true);\n\n expect(nativeEvent.returnValue).toBe(false);\n });\n\n it('should be prevented if nativeEvent is prevented', function() {\n expect(\n createEvent({defaultPrevented: true}).isDefaultPrevented()\n ).toBe(true);\n expect(createEvent({returnValue: false}).isDefaultPrevented()).toBe(true);\n });\n\n it('should be able to `stopPropagation`', function() {\n var nativeEvent = {};\n var syntheticEvent = createEvent(nativeEvent);\n\n expect(syntheticEvent.isPropagationStopped()).toBe(false);\n syntheticEvent.stopPropagation();\n expect(syntheticEvent.isPropagationStopped()).toBe(true);\n\n expect(nativeEvent.cancelBubble).toBe(true);\n });\n\n it('should be able to `persist`', function() {\n var syntheticEvent = createEvent({});\n\n expect(syntheticEvent.isPersistent()).toBe(false);\n syntheticEvent.persist();\n expect(syntheticEvent.isPersistent()).toBe(true);\n });\n\n});\n\nrequire(\"../../../mock-modules\").register(\"event/synthetic/__tests__/SyntheticEvent-test\", module);\n",
"event/synthetic/__tests__/SyntheticWheelEvent-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nvar SyntheticWheelEvent;\n\ndescribe('SyntheticWheelEvent', function() {\n var createEvent;\n\n beforeEach(function() {\n SyntheticWheelEvent = require(\"../../../SyntheticWheelEvent\");\n\n createEvent = function(nativeEvent) {\n return SyntheticWheelEvent.getPooled({}, '', nativeEvent);\n };\n });\n\n it('should normalize properties from the Event interface', function() {\n var target = document.createElement('div');\n var syntheticEvent = createEvent({srcElement: target});\n\n expect(syntheticEvent.target).toBe(target);\n expect(syntheticEvent.type).toBe(undefined);\n });\n\n it('should normalize properties from the MouseEvent interface', function() {\n expect(createEvent({which: 2, button: 1}).button).toBe(1);\n });\n\n it('should normalize properties from the WheelEvent interface', function() {\n var standardEvent = createEvent({deltaX: 10, deltaY: -50});\n expect(standardEvent.deltaX).toBe(10);\n expect(standardEvent.deltaY).toBe(50);\n\n var webkitEvent = createEvent({wheelDeltaX: -10, wheelDeltaY: 50});\n expect(webkitEvent.deltaX).toBe(10);\n expect(webkitEvent.deltaY).toBe(50);\n });\n\n it('should be able to `preventDefault` and `stopPropagation`', function() {\n var nativeEvent = {};\n var syntheticEvent = createEvent(nativeEvent);\n\n expect(syntheticEvent.isDefaultPrevented()).toBe(false);\n syntheticEvent.preventDefault();\n expect(syntheticEvent.isDefaultPrevented()).toBe(true);\n\n expect(syntheticEvent.isPropagationStopped()).toBe(false);\n syntheticEvent.stopPropagation();\n expect(syntheticEvent.isPropagationStopped()).toBe(true);\n });\n\n it('should be able to `persist`', function() {\n var syntheticEvent = createEvent({});\n\n expect(syntheticEvent.isPersistent()).toBe(false);\n syntheticEvent.persist();\n expect(syntheticEvent.isPersistent()).toBe(true);\n });\n\n});\n\nrequire(\"../../../mock-modules\").register(\"event/synthetic/__tests__/SyntheticWheelEvent-test\", module);\n",
"eventPlugins/__tests__/AnalyticsEventPlugin-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @jsx React.DOM\n * @emails react-core\n */\n\n\"use strict\";\n\nvar mocks = require(\"../../mocks\");\n\ndescribe('AnalyticsEventPlugin', function() {\n var AnalyticsEventPluginFactory;\n var EventPluginHub;\n var EventPluginRegistry;\n var React;\n var ReactEventEmitter;\n var ReactTestUtils;\n\n var DefaultEventPluginOrder;\n var EnterLeaveEventPlugin;\n var ChangeEventPlugin;\n var ReactInstanceHandles;\n var SimpleEventPlugin;\n\n beforeEach(function() {\n AnalyticsEventPluginFactory = require(\"../../AnalyticsEventPluginFactory\");\n EventPluginHub = require(\"../../EventPluginHub\");\n EventPluginRegistry = require(\"../../EventPluginRegistry\");\n React = require(\"../../React\");\n ReactEventEmitter = require(\"../../ReactEventEmitter\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n\n EventPluginRegistry._resetEventPlugins();\n\n // Re-inject default events system after resetting.\n DefaultEventPluginOrder = require(\"../../DefaultEventPluginOrder\");\n EnterLeaveEventPlugin = require(\"../../EnterLeaveEventPlugin\");\n ChangeEventPlugin = require(\"../../ChangeEventPlugin\");\n ReactInstanceHandles = require(\"../../ReactInstanceHandles\");\n SimpleEventPlugin = require(\"../../SimpleEventPlugin\");\n\n EventPluginHub.injection.injectEventPluginOrder(DefaultEventPluginOrder);\n EventPluginHub.injection.injectInstanceHandle(ReactInstanceHandles);\n\n EventPluginHub.injection.injectEventPluginsByName({\n 'SimpleEventPlugin': SimpleEventPlugin,\n 'EnterLeaveEventPlugin': EnterLeaveEventPlugin,\n 'ChangeEventPlugin': ChangeEventPlugin\n });\n\n ReactEventEmitter.ensureListening(false, document);\n });\n\n it('should count events correctly', function() {\n var numClickEvents = 5;\n var numDoubleClickEvents = 7;\n var TEST_ANALYTICS_ID = 'test_analytics_id';\n var TestValidEvents = React.createClass({displayName: 'TestValidEvents',\n render: function() {\n return (\n React.DOM.div( {ref:\"testDiv\",\n 'data-analytics-id':TEST_ANALYTICS_ID,\n 'data-analytics-events':\"click,doubleClick\"}, \n \" Test \"\n )\n );\n }\n });\n var renderedComponent =\n ReactTestUtils.renderIntoDocument(TestValidEvents(null ));\n\n var cb = mocks.getMockFunction().mockImplementation(\n function(analyticsData) {\n expect(Object.keys(analyticsData).length).toBe(1);\n expect(Object.keys(analyticsData[TEST_ANALYTICS_ID]).length).toBe(2);\n expect(analyticsData[TEST_ANALYTICS_ID].click).toBe(numClickEvents);\n expect(analyticsData[TEST_ANALYTICS_ID].doubleClick).toBe(\n numDoubleClickEvents\n );\n }\n );\n\n EventPluginHub.injection.injectEventPluginsByName({\n AnalyticsEventPlugin:\n AnalyticsEventPluginFactory.createAnalyticsPlugin(cb)\n });\n\n // Simulate some clicks\n for (var i = 0; i < numClickEvents; i++) {\n ReactTestUtils.Simulate.click(renderedComponent.refs.testDiv);\n }\n // Simulate some double clicks\n for (i = 0; i < numDoubleClickEvents; i++) {\n ReactTestUtils.Simulate.doubleClick(renderedComponent.refs.testDiv);\n }\n // Simulate some other events not being tracked for analytics\n ReactTestUtils.Simulate.focus(renderedComponent.refs.testDiv);\n\n window.mockRunTimersOnce();\n expect(cb).toBeCalled();\n });\n\n it('error non no callback', function() {\n expect(function() {\n AnalyticsEventPluginFactory.createAnalyticsPlugin(null);\n }).toThrow();\n });\n\n it('error on invalid analytics events', function() {\n var TestInvalidEvents = React.createClass({displayName: 'TestInvalidEvents',\n render: function() {\n return (\n React.DOM.div( {ref:\"testDiv\",\n 'data-analytics-id':\"test_invalid_events\",\n 'data-analytics-events':\"click,123\"}, \n \" Test \"\n )\n );\n }\n });\n var renderedComponent =\n ReactTestUtils.renderIntoDocument(TestInvalidEvents(null ));\n\n var cb = mocks.getMockFunction();\n\n EventPluginHub.injection.injectEventPluginsByName({\n AnalyticsEventPlugin: AnalyticsEventPluginFactory.createAnalyticsPlugin(\n cb\n )\n });\n\n var error = false;\n try {\n ReactTestUtils.Simulate.click(renderedComponent.refs.testDiv);\n } catch(e) {\n error = true;\n }\n\n expect(error).toBe(true);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"eventPlugins/__tests__/AnalyticsEventPlugin-test\", module);\n",
"eventPlugins/__tests__/ResponderEventPlugin-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nvar CallbackRegistry;\nvar EventConstants;\nvar EventPropagators;\nvar ReactInstanceHandles;\nvar ResponderEventPlugin;\nvar SyntheticEvent;\n\nvar GRANDPARENT_ID = '.r[0]';\nvar PARENT_ID = '.r[0].0';\nvar CHILD_ID = '.r[0].0.0';\n\nvar topLevelTypes;\nvar responderEventTypes;\nvar spies;\n\nvar DUMMY_NATIVE_EVENT = {};\nvar DUMMY_RENDERED_TARGET = {};\n\nvar onStartShouldSetResponder = function(id, cb, capture) {\n var registrationNames = responderEventTypes\n .startShouldSetResponder\n .phasedRegistrationNames;\n CallbackRegistry.putListener(\n id,\n capture ? registrationNames.captured : registrationNames.bubbled,\n cb\n );\n};\n\nvar onScrollShouldSetResponder = function(id, cb, capture) {\n var registrationNames = responderEventTypes\n .scrollShouldSetResponder\n .phasedRegistrationNames;\n CallbackRegistry.putListener(\n id,\n capture ? registrationNames.captured : registrationNames.bubbled,\n cb\n );\n};\n\nvar onMoveShouldSetResponder = function(id, cb, capture) {\n var registrationNames = responderEventTypes\n .moveShouldSetResponder\n .phasedRegistrationNames;\n CallbackRegistry.putListener(\n id,\n capture ? registrationNames.captured : registrationNames.bubbled,\n cb\n );\n};\n\n\nvar onResponderGrant = function(id, cb) {\n CallbackRegistry.putListener(\n id,\n responderEventTypes.responderGrant.registrationName,\n cb\n );\n};\n\nvar extractForTouchStart = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topTouchStart,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\nvar extractForTouchMove = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topTouchMove,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\nvar extractForTouchEnd = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topTouchEnd,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\nvar extractForMouseDown = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topMouseDown,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\nvar extractForMouseMove = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topMouseMove,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\n\nvar extractForMouseUp = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topMouseUp,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\nvar extractForScroll = function(renderedTargetID) {\n return ResponderEventPlugin.extractEvents(\n topLevelTypes.topScroll,\n DUMMY_NATIVE_EVENT,\n renderedTargetID,\n DUMMY_RENDERED_TARGET\n );\n};\n\n\nvar onGrantChild;\nvar onGrantParent;\nvar onGrantGrandParent;\n\n\nvar existsInExtraction = function(extracted, test) {\n if (Array.isArray(extracted)) {\n for (var i = 0; i < extracted.length; i++) {\n if (test(extracted[i])) {\n return true;\n }\n }\n } else if (extracted) {\n return test(extracted);\n }\n return false;\n};\n\n/**\n * Helper validators.\n */\nfunction assertGrantEvent(id, extracted) {\n var test = function(event) {\n return event instanceof SyntheticEvent &&\n event.dispatchConfig === responderEventTypes.responderGrant &&\n event.dispatchMarker === id;\n };\n expect(ResponderEventPlugin.getResponderID()).toBe(id);\n expect(existsInExtraction(extracted, test)).toBe(true);\n}\n\nfunction assertResponderMoveEvent(id, extracted) {\n var test = function(event) {\n return event instanceof SyntheticEvent &&\n event.dispatchConfig === responderEventTypes.responderMove &&\n event.dispatchMarker === id;\n };\n expect(ResponderEventPlugin.getResponderID()).toBe(id);\n expect(existsInExtraction(extracted, test)).toBe(true);\n}\n\nfunction assertTerminateEvent(id, extracted) {\n var test = function(event) {\n return event instanceof SyntheticEvent &&\n event.dispatchConfig === responderEventTypes.responderTerminate &&\n event.dispatchMarker === id;\n };\n expect(ResponderEventPlugin.getResponderID()).not.toBe(id);\n expect(existsInExtraction(extracted, test)).toBe(true);\n}\n\nfunction assertRelease(id, extracted) {\n var test = function(event) {\n return event instanceof SyntheticEvent &&\n event.dispatchConfig === responderEventTypes.responderRelease &&\n event.dispatchMarker === id;\n };\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n expect(existsInExtraction(extracted, test)).toBe(true);\n}\n\n\nfunction assertNothingExtracted(extracted) {\n expect(Array.isArray(extracted)).toBe(false); // No grant events.\n expect(Array.isArray(extracted)).toBeFalsy();\n}\n\n\n/**\n * TODO:\n * - Test that returning false from `responderTerminationRequest` will never\n * cause the responder to be lost.\n * - Automate some of this testing by providing config data - generalize.\n */\n\ndescribe('ResponderEventPlugin', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n\n CallbackRegistry = require(\"../../CallbackRegistry\");\n EventConstants = require(\"../../EventConstants\");\n EventPropagators = require(\"../../EventPropagators\");\n ReactInstanceHandles = require(\"../../ReactInstanceHandles\");\n ResponderEventPlugin = require(\"../../ResponderEventPlugin\");\n SyntheticEvent = require(\"../../SyntheticEvent\");\n EventPropagators.injection.injectInstanceHandle(ReactInstanceHandles);\n\n // dumpCache, in open-source tests, only resets existing mocks. It does not\n // reset module-state though -- so we need to do this explicitly in the test\n // for now. Once that's no longer the case, we can delete this line.\n CallbackRegistry.__purge();\n\n topLevelTypes = EventConstants.topLevelTypes;\n responderEventTypes = ResponderEventPlugin.eventTypes;\n\n spies = {\n onStartShouldSetResponderChild: function() {},\n onStartShouldSetResponderParent: function() {},\n onStartShouldSetResponderParentCapture: function() {},\n onStartShouldSetResponderGrandParent: function() {},\n onMoveShouldSetResponderParent: function() {},\n onScrollShouldSetResponderParent: function() {}\n };\n\n onGrantChild = function() {};\n onGrantParent = function() {};\n onGrantGrandParent = function() {};\n });\n\n it('should not auto-set responder on touch start', function() {\n // Notice we're not registering the startShould* handler.\n var extracted = extractForTouchStart(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n });\n\n it('should not auto-set responder on mouse down', function() {\n // Notice we're not registering the startShould* handler.\n var extracted = extractForMouseDown(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n extractForMouseUp(CHILD_ID); // Let up!\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n\n // Register `onMoveShould*` handler.\n spyOn(spies, 'onMoveShouldSetResponderParent').andReturn(true);\n onMoveShouldSetResponder(PARENT_ID, spies.onMoveShouldSetResponderParent);\n onResponderGrant(PARENT_ID, onGrantParent);\n // Move mouse while not pressing down\n extracted = extractForMouseMove(CHILD_ID);\n assertNothingExtracted(extracted);\n // Not going to call `onMoveShould`* if not touching.\n expect(spies.onMoveShouldSetResponderParent.callCount).toBe(0);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n\n // Now try the move extraction again, this time while holding down, and not\n // letting up.\n extracted = extractForMouseDown(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n\n // Now moving can set the responder, if pressing down, even if there is no\n // current responder.\n extracted = extractForMouseMove(CHILD_ID);\n expect(spies.onMoveShouldSetResponderParent.callCount).toBe(1);\n expect(ResponderEventPlugin.getResponderID()).toBe(PARENT_ID);\n assertGrantEvent(PARENT_ID, extracted);\n\n extractForMouseUp(CHILD_ID);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n });\n\n it('should not extract a grant/release event if double start', function() {\n // Return true - we should become the responder.\n var extracted;\n spyOn(spies, 'onStartShouldSetResponderChild').andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n onResponderGrant(CHILD_ID, onGrantChild);\n\n extracted = extractForTouchStart(CHILD_ID);\n assertGrantEvent(CHILD_ID, extracted);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(1);\n\n // Now we do *not* clear out the touch via a simulated touch end. This mocks\n // out an environment that likely will never happen, but could in some odd\n // error state so it's nice to make sure we recover gracefully.\n // extractForTouchEnd(CHILD_ID); // Clear the responder\n extracted = extractForTouchStart(CHILD_ID);\n assertNothingExtracted();\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(2);\n });\n\n it('should bubble/capture responder on start', function() {\n // Return true - we should become the responder.\n var extracted;\n spyOn(spies, 'onStartShouldSetResponderParent').andReturn(true);\n spyOn(spies, 'onStartShouldSetResponderChild').andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n onStartShouldSetResponder(PARENT_ID, spies.onStartShouldSetResponderParent);\n onResponderGrant(CHILD_ID, onGrantChild);\n onResponderGrant(PARENT_ID, onGrantParent);\n\n // Nothing extracted if no responder.\n extracted = extractForTouchMove(GRANDPARENT_ID);\n assertNothingExtracted(extracted);\n\n extracted = extractForTouchStart(CHILD_ID);\n assertGrantEvent(CHILD_ID, extracted);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(1);\n expect(spies.onStartShouldSetResponderParent.callCount).toBe(0);\n\n // Even if moving on the grandparent, the child will receive responder moves\n // (This is even true for mouse interactions - which we should absolutely\n // test)\n extracted = extractForTouchMove(GRANDPARENT_ID);\n assertResponderMoveEvent(CHILD_ID, extracted);\n extracted = extractForTouchMove(CHILD_ID); // Test move on child node too.\n assertResponderMoveEvent(CHILD_ID, extracted);\n\n // Reset the responder - id passed here shouldn't matter:\n // TODO: Test varying the id here.\n extracted = extractForTouchEnd(GRANDPARENT_ID); // Clear the responder\n assertRelease(CHILD_ID, extracted);\n\n // Now make sure the parent requests responder on capture.\n spyOn(spies, 'onStartShouldSetResponderParentCapture').andReturn(true);\n onStartShouldSetResponder(\n PARENT_ID,\n spies.onStartShouldSetResponderParent,\n true // Capture\n );\n onResponderGrant(PARENT_ID, onGrantGrandParent);\n extracted = extractForTouchStart(PARENT_ID);\n expect(ResponderEventPlugin.getResponderID()).toBe(PARENT_ID);\n assertGrantEvent(PARENT_ID, extracted);\n // Now move on various nodes, ensuring that the responder move is emitted to\n // the parent node.\n extracted = extractForTouchMove(GRANDPARENT_ID);\n assertResponderMoveEvent(PARENT_ID, extracted);\n extracted = extractForTouchMove(CHILD_ID); // Test move on child node too.\n assertResponderMoveEvent(PARENT_ID, extracted);\n\n // Reset the responder - id passed here shouldn't matter:\n // TODO: Test varying the id here.\n extracted = extractForTouchEnd(GRANDPARENT_ID); // Clear the responder\n assertRelease(PARENT_ID, extracted);\n\n });\n\n it('should invoke callback to ask if responder is desired', function() {\n // Return true - we should become the responder.\n spyOn(spies, 'onStartShouldSetResponderChild').andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n\n var extracted = extractForTouchStart(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(1);\n expect(ResponderEventPlugin.getResponderID()).toBe(CHILD_ID);\n extractForTouchEnd(CHILD_ID); // Clear the responder\n\n // Now try returning false - we should not become the responder.\n spies.onStartShouldSetResponderChild.andReturn(false);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n extracted = extractForTouchStart(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(2);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n extractForTouchEnd(CHILD_ID);\n expect(ResponderEventPlugin.getResponderID()).toBe(null); // Still null\n\n // Same thing as before but return true from \"shouldSet\".\n spies.onStartShouldSetResponderChild.andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n onResponderGrant(CHILD_ID, onGrantChild);\n extracted = extractForTouchStart(CHILD_ID);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(3);\n assertGrantEvent(CHILD_ID, extracted);\n extracted = extractForTouchEnd(CHILD_ID); // Clear the responder\n assertRelease(CHILD_ID, extracted);\n });\n\n it('should give up responder to parent on move iff allowed', function() {\n // Return true - we should become the responder.\n var extracted;\n spyOn(spies, 'onStartShouldSetResponderChild').andReturn(true);\n spyOn(spies, 'onMoveShouldSetResponderParent').andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n onMoveShouldSetResponder(PARENT_ID, spies.onMoveShouldSetResponderParent);\n onResponderGrant(CHILD_ID, onGrantChild);\n onResponderGrant(PARENT_ID, onGrantParent);\n\n spies.onStartShouldSetResponderChild.andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n extracted = extractForTouchStart(CHILD_ID);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(1);\n expect(spies.onMoveShouldSetResponderParent.callCount).toBe(0); // none yet\n assertGrantEvent(CHILD_ID, extracted); // Child is the current responder\n\n extracted = extractForTouchMove(CHILD_ID);\n expect(spies.onMoveShouldSetResponderParent.callCount).toBe(1);\n assertGrantEvent(PARENT_ID, extracted);\n assertTerminateEvent(CHILD_ID, extracted);\n\n extracted = extractForTouchEnd(CHILD_ID); // Clear the responder\n assertRelease(PARENT_ID, extracted);\n });\n\n it('should responder move only on direct responder', function() {\n // Return true - we should become the responder.\n spyOn(spies, 'onStartShouldSetResponderChild').andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n\n var extracted = extractForTouchStart(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(1);\n expect(ResponderEventPlugin.getResponderID()).toBe(CHILD_ID);\n extractForTouchEnd(CHILD_ID); // Clear the responder\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n\n // Now try returning false - we should not become the responder.\n spies.onStartShouldSetResponderChild.andReturn(false);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n extracted = extractForTouchStart(CHILD_ID);\n assertNothingExtracted(extracted);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(2);\n expect(ResponderEventPlugin.getResponderID()).toBe(null);\n extractForTouchEnd(CHILD_ID); // Clear the responder\n\n // Same thing as before but return true from \"shouldSet\".\n spies.onStartShouldSetResponderChild.andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n onResponderGrant(CHILD_ID, onGrantChild);\n extracted = extractForTouchStart(CHILD_ID);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(3);\n assertGrantEvent(CHILD_ID, extracted);\n extracted = extractForTouchEnd(CHILD_ID); // Clear the responder\n assertRelease(CHILD_ID, extracted);\n });\n\n it('should give up responder to parent on scroll iff allowed', function() {\n // Return true - we should become the responder.\n var extracted;\n spyOn(spies, 'onStartShouldSetResponderChild').andReturn(true);\n spyOn(spies, 'onMoveShouldSetResponderParent').andReturn(false);\n spyOn(spies, 'onScrollShouldSetResponderParent').andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n onMoveShouldSetResponder(PARENT_ID, spies.onMoveShouldSetResponderParent);\n onScrollShouldSetResponder(\n PARENT_ID,\n spies.onScrollShouldSetResponderParent\n );\n onResponderGrant(CHILD_ID, onGrantChild);\n onResponderGrant(PARENT_ID, onGrantParent);\n\n spies.onStartShouldSetResponderChild.andReturn(true);\n onStartShouldSetResponder(CHILD_ID, spies.onStartShouldSetResponderChild);\n extracted = extractForTouchStart(CHILD_ID);\n expect(spies.onStartShouldSetResponderChild.callCount).toBe(1);\n expect(spies.onMoveShouldSetResponderParent.callCount).toBe(0); // none yet\n assertGrantEvent(CHILD_ID, extracted); // Child is the current responder\n\n extracted = extractForTouchMove(CHILD_ID);\n expect(spies.onMoveShouldSetResponderParent.callCount).toBe(1);\n assertNothingExtracted(extracted);\n\n extracted = extractForScroll(CHILD_ID); // Could have been parent here too.\n expect(spies.onScrollShouldSetResponderParent.callCount).toBe(1);\n assertGrantEvent(PARENT_ID, extracted);\n assertTerminateEvent(CHILD_ID, extracted);\n\n extracted = extractForTouchEnd(CHILD_ID); // Clear the responder\n assertRelease(PARENT_ID, extracted);\n });\n\n\n});\n\nrequire(\"../../mock-modules\").register(\"eventPlugins/__tests__/ResponderEventPlugin-test\", module);\n",
"utils/__tests__/ImmutableObject-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\")\n .dontMock('ImmutableObject');\n\nvar ImmutableObject;\n\n/**\n * To perform performance testing of using `ImmutableObject` vs. not using\n * `ImmutableObject`, such testing must be done with __DEV__ set to false.\n */\ndescribe('ImmutableObject', function() {\n var message;\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n ImmutableObject = require(\"../../ImmutableObject\");\n this.addMatchers({\n /**\n * Equivalent with respect to serialization. Must stringify because\n * constructors are different and other comparison methods will not\n * consider them structurally equal. Probably not useful for use outside\n * of this test module.\n */\n toBeSeriallyEqualTo: function(expected) {\n var actual = this.actual;\n var notText = this.isNot ? \" not\" : \"\";\n this.message = function () {\n return \"Expected \" + JSON.stringify(actual) + notText +\n \" to be serially equal to \" + JSON.stringify(expected);\n };\n\n return JSON.stringify(actual) === JSON.stringify(expected);\n }\n });\n });\n\n /**\n * We are in __DEV__ by default.\n */\n var testDev = function(message, testFunc) {\n it(message, testFunc);\n };\n\n var testProd = function(message, testFunc) {\n // Temporarily enter production mode\n window.true = false;\n it(message, testFunc);\n window.true = true;\n };\n\n var testDevAndProd = function(message, testFunc) {\n testDev(message + ':DEV', testFunc);\n testProd(message + ':PROD', testFunc);\n };\n\n testDev('should be running in DEV', function() {\n expect(window.true).toBe(true);\n });\n\n testDev('should require initial map to be an object', function() {\n expect(function() {\n new ImmutableObject([1,2,3]);\n }).toThrow();\n\n expect(function() {\n new ImmutableObject('asdf');\n }).toThrow();\n\n expect(function() {\n new ImmutableObject({oldField: 'asdf', fieldTwo: null});\n }).not.toThrow();\n });\n\n testDev('should not exceed maximum call stack size with nodes', function() {\n var node = document.createElement('div');\n var object = new ImmutableObject({node: node});\n expect(object.node).toBe(node);\n });\n\n testDevAndProd('should not throw when not mutating directly', function() {\n var io = new ImmutableObject({oldField: 'asdf'});\n expect(function() {\n ImmutableObject.set(io, {newField: null}); // not a mutation!\n }).not.toThrow();\n });\n\n testDev('should prevent shallow field addition when strict', function() {\n if (window.callPhantom) return;\n expect(function() {\n var io = new ImmutableObject({oldField: 'asdf'});\n io.newField = 'this will not work';\n }).toThrow();\n });\n\n testDev('should prevent shallow field mutation when strict', function() {\n if (window.callPhantom) return;\n expect(function() {\n var io = new ImmutableObject({oldField: 'asdf'});\n io.oldField = 'this will not work!';\n }).toThrow();\n });\n\n testDev('should prevent deep field addition when strict', function() {\n if (window.callPhantom) return;\n expect(function() {\n var io =\n new ImmutableObject({shallowField: {deepField: {oldField: null}}});\n io.shallowField.deepField.oldField = 'this will not work!';\n }).toThrow();\n });\n\n testDev('should prevent deep field mutation when strict', function() {\n if (window.callPhantom) return;\n expect(function() {\n var io =\n new ImmutableObject({shallowField: {deepField: {oldField: null}}});\n io.shallowField.deepField.newField = 'this will not work!';\n }).toThrow();\n });\n\n testDevAndProd(\n 'should create object with same structure when set with {}',\n function() {\n var beforeIO =\n new ImmutableObject({shallowField: {deepField: {oldField: null}}});\n var afterIO = ImmutableObject.set(beforeIO, {});\n expect(afterIO).toBeSeriallyEqualTo(beforeIO);\n expect(afterIO).not.toBe(beforeIO);\n }\n );\n\n testDevAndProd(\n 'should create distinct object with shallow field insertion',\n function() {\n var beforeStructure = {\n oldShallowField: {\n deepField: {\n oldField: null\n }\n }\n };\n\n var delta = {\n newShallowField: 'newShallowFieldHere'\n };\n\n var expectedAfterStructure = {\n oldShallowField: {\n deepField: {\n oldField: null\n }\n },\n newShallowField: 'newShallowFieldHere'\n };\n\n var beforeIO = new ImmutableObject(beforeStructure);\n var afterIO = ImmutableObject.set(beforeIO, delta);\n expect(afterIO).toBeSeriallyEqualTo(expectedAfterStructure);\n expect(afterIO).not.toBe(beforeIO);\n }\n );\n\n testDevAndProd(\n 'should create distinct object with shallow field mutation',\n function() {\n var beforeStructure = {\n oldShallowField: {\n deepField: {\n oldField: null\n }\n }\n };\n\n var delta = {\n oldShallowField: 'this will clobber the old field'\n };\n\n var expectedAfterStructure = {\n oldShallowField: 'this will clobber the old field'\n };\n\n var beforeIO = new ImmutableObject(beforeStructure);\n var afterIO = ImmutableObject.set(beforeIO, delta);\n expect(afterIO).toBeSeriallyEqualTo(expectedAfterStructure);\n expect(afterIO).not.toBe(beforeIO);\n }\n );\n\n message = 'should create distinct object with deep field insertion';\n testDevAndProd(message, function() {\n var beforeStructure = {\n oldShallowField: {\n deepField: {\n oldField: null\n }\n }\n };\n\n var delta = {\n oldShallowField: {newDeepField: 'hello'}\n };\n\n // ImmutableObject does not yet support deep merging with\n // ImmutableObject.set().\n var expectedAfterStructure = {\n oldShallowField: {newDeepField: 'hello'}\n };\n\n var beforeIO = new ImmutableObject(beforeStructure);\n var afterIO = ImmutableObject.set(beforeIO, delta);\n expect(afterIO).toBeSeriallyEqualTo(expectedAfterStructure);\n expect(afterIO).not.toBe(beforeIO);\n });\n\n message =\n 'should tolerate arrays at deeper levels and prevent mutation on them';\n testDevAndProd(message, function() {\n if (window.callPhantom) {\n // PhantomJS has a bug with Object.freeze and Arrays.\n // https://github.com/ariya/phantomjs/issues/10817\n return;\n }\n var beforeStructure = {\n shallowField: [1,'second field',3]\n };\n var io = new ImmutableObject(beforeStructure);\n expect(function() {\n io.newField = 'nope!';\n }).toThrow();\n expect(function() {\n io.shallowField[0] = 'nope!';\n }).toThrow();\n expect(io.shallowField[1]).toEqual('second field');\n });\n\n message = 'should provide a setField interface as sugar for set()';\n testDevAndProd(message, function() {\n var beforeIO = new ImmutableObject({initialField: null});\n var afterIO =\n ImmutableObject.setField(beforeIO, 'anotherField', 'anotherValue');\n expect(afterIO).toBeSeriallyEqualTo({\n initialField: null,\n anotherField: 'anotherValue'\n });\n expect(afterIO).not.toBe(beforeIO);\n });\n\n message = 'should recursively create distinct objects when deep copying';\n testDevAndProd(message, function() {\n var beforeIO = new ImmutableObject({\n a: {b: 'b', c: {}, d: 'd', e: new ImmutableObject({f: 'f'}) }\n });\n var afterIO = ImmutableObject.setDeep(beforeIO, {\n a: {b: {}, c: 'C', e: {f: 'F', g: 'G'}, h: 'H'}\n });\n expect(afterIO).toBeSeriallyEqualTo({\n a: {b: {}, c: 'C', d: 'd', e: {f: 'F', g: 'G'}, h: 'H'}\n });\n expect(afterIO).not.toBe(beforeIO);\n expect(afterIO.a).not.toBe(beforeIO.a);\n expect(afterIO.a.e).not.toBe(beforeIO.a.e);\n });\n\n testDevAndProd('should deep copy member immutability', function() {\n var beforeIO = new ImmutableObject({\n a: {b: new ImmutableObject({c: 'c'}), e: {f: 'f'}}\n });\n var afterIO = ImmutableObject.setDeep(beforeIO, {\n a: {b: {d: 'D'}, e: new ImmutableObject({g: 'G'})}\n });\n expect(afterIO).toBeSeriallyEqualTo({\n a: {b: {c: 'c', d: 'D'}, e: {f: 'f', g: 'G'}}\n });\n expect(afterIO instanceof ImmutableObject).toBe(true);\n expect(afterIO.a.b instanceof ImmutableObject).toBe(true);\n expect(afterIO.a.e instanceof ImmutableObject).toBe(true);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/ImmutableObject-test\", module);\n",
"utils/__tests__/OrderedMap-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nvar OrderedMap;\n\n/**\n * Shared, reusable objects.\n */\nvar hasEmptyStringKey = {\n 'thisKeyIsFine': {data: []},\n '': {thisShouldCauseAFailure: []},\n 'thisKeyIsAlsoFine': {data: []}\n};\n\n/**\n * Used as map/forEach callback.\n */\nvar duplicate = function(itm, key, count) {\n return {\n uniqueID: itm.uniqueID,\n val: itm.val + key + count + this.justToTestScope\n };\n};\n\n// Should not be allowed - because then null/'null' become impossible to\n// distinguish. Every key MUST be a string period!\nvar hasNullAndUndefStringKey = [\n {uniqueID: 'undefined', val: 'thisIsUndefined'},\n {uniqueID: 'null', val: 'thisIsNull'}\n];\nvar hasNullKey = [\n {uniqueID: 'thisKeyIsFine', data: []},\n {uniqueID: 'thisKeyIsAlsoFine', data: []},\n {uniqueID: null, data: []}\n];\n\nvar hasObjectKey = [\n {uniqueID: 'thisKeyIsFine', data: []},\n {uniqueID: 'thisKeyIsAlsoFine', data: []},\n {uniqueID: {}, data: []}\n];\n\nvar hasArrayKey = [\n {uniqueID: 'thisKeyIsFine', data: []},\n {uniqueID: 'thisKeyIsAlsoFine', data: []},\n {uniqueID: [], data: []}\n];\n\n// This should be allowed\nvar hasNullStringKey = [\n {uniqueID: 'thisKeyIsFine', data: []},\n {uniqueID: 'thisKeyIsAlsoFine', data: []},\n {uniqueID: 'null', data: []}\n];\n\nvar hasUndefinedKey = [\n {uniqueID: 'thisKeyIsFine', data: []},\n {uniqueID: 'thisKeyIsAlsoFine', data: []},\n {uniqueID: undefined, data: []}\n];\n\nvar hasUndefinedStringKey = [\n {uniqueID: 'thisKeyIsFine', data: []},\n {uniqueID: 'thisKeyIsAlsoFine', data: []},\n {uniqueID: 'undefined', data: []}\n];\n\nvar hasPositiveNumericKey = [\n {uniqueID: 'notANumber', data: []},\n {uniqueID: '5', data: []},\n {uniqueID: 'notAnotherNumber',data: []}\n];\n\nvar hasZeroStringKey = [\n {uniqueID: 'greg', data: 'grego'},\n {uniqueID: '0', data: '0o'},\n {uniqueID: 'tom', data: 'tomo'}\n];\n\nvar hasZeroNumberKey = [\n {uniqueID: 'greg', data: 'grego'},\n {uniqueID: 0, data: '0o'},\n {uniqueID: 'tom', data: 'tomo'}\n];\n\nvar hasAllNumericStringKeys = [\n {uniqueID: '0', name: 'Gregory'},\n {uniqueID: '2', name: 'James'},\n {uniqueID: '1', name: 'Tom'}\n];\n\nvar hasAllNumericKeys = [\n {uniqueID: 0, name: 'Gregory'},\n {uniqueID: 2, name: 'James'},\n {uniqueID: 1, name: 'Tom'}\n];\n\nvar hasAllValidKeys = [\n {uniqueID: 'keyOne', value: 'valueOne'},\n {uniqueID: 'keyTwo', value: 'valueTwo'}\n];\n\nvar hasDuplicateKeys = [\n {uniqueID: 'keyOne', value: 'valueOne'},\n {uniqueID: 'keyTwo', value: 'valueTwo'},\n {uniqueID: 'keyOne', value: 'valueThree'}\n];\n\nvar idEntities = [\n {uniqueID: 'greg', name: 'Gregory'},\n {uniqueID: 'james', name: 'James'},\n {uniqueID: 'tom', name: 'Tom'}\n];\n\nvar hasEmptyKey = [\n {uniqueID: 'greg', name: 'Gregory'},\n {uniqueID: '', name: 'James'},\n {uniqueID: 'tom', name: 'Tom'}\n];\n\nvar extractUniqueID = function(entity) {\n return entity.uniqueID;\n};\n\ndescribe('OrderedMap', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n OrderedMap = require(\"../../OrderedMap\");\n });\n\n it('should create according to simple object with keys', function() {\n OrderedMap.fromArray(hasAllValidKeys, extractUniqueID);\n // Iterate over and ensure key order.\n });\n\n it('should create from array when providing an identity CB', function() {\n expect(function() {\n OrderedMap.fromArray(idEntities, extractUniqueID);\n }).not.toThrow();\n });\n\n it('should throw if constructing from Array without identity CB', function() {\n OrderedMap.fromArray(idEntities, extractUniqueID);\n // Iterate and ensure key order\n });\n\n it('should not throw when fromArray extracts a numeric key', function() {\n expect(function() {\n OrderedMap.fromArray(hasPositiveNumericKey, extractUniqueID);\n }).not.toThrow();\n\n });\n\n it('should throw when any key is the empty string', function() {\n expect(function() {\n OrderedMap.fromArray(hasEmptyKey, extractUniqueID);\n }).toThrow();\n });\n\n it('should not throw when a key is the string \"undefined\" or \"null\"',\n function() {\n var om = OrderedMap.fromArray(hasNullAndUndefStringKey, extractUniqueID);\n expect(om.length).toBe(2);\n expect(om.indexOfKey('undefined')).toBe(0);\n expect(om.indexOfKey('null')).toBe(1);\n expect(om.keyAfter('undefined')).toBe('null');\n expect(om.keyAfter('null')).toBe(undefined);\n expect(om.keyBefore('undefined')).toBe(undefined);\n expect(om.has('undefined')).toBe(true);\n expect(om.has('null')).toBe(true);\n expect(om.get('undefined').val).toBe('thisIsUndefined');\n expect(om.get('null').val).toBe('thisIsNull');\n });\n\n\n /**\n * Numeric keys are cast to strings.\n */\n it('should not throw when a key is the number zero', function() {\n var om = OrderedMap.fromArray(hasZeroNumberKey, extractUniqueID);\n expect(om.length).toBe(3);\n expect(om.indexOfKey('0')).toBe(1);\n expect(om.indexOfKey(0)).toBe(1);\n });\n\n it('should throw when any key is falsey', function() {\n expect(function() {\n OrderedMap.fromArray(hasEmptyStringKey, extractUniqueID);\n }).toThrow();\n\n expect(function() {\n OrderedMap.fromArray(hasNullKey, extractUniqueID);\n }).toThrow();\n\n expect(function() {\n OrderedMap.fromArray(hasUndefinedKey, extractUniqueID);\n }).toThrow();\n });\n\n it('should not throw on string keys \"undefined/null\"', function() {\n expect(function() {\n OrderedMap.fromArray(hasNullStringKey, extractUniqueID);\n }).not.toThrow();\n\n expect(function() {\n OrderedMap.fromArray(hasUndefinedStringKey, extractUniqueID);\n }).not.toThrow();\n });\n\n it('should throw on extracting keys that are not strings/nums', function() {\n expect(function() {\n OrderedMap.fromArray(hasObjectKey, extractUniqueID);\n }).toThrow();\n\n expect(function() {\n OrderedMap.fromArray(hasArrayKey, extractUniqueID);\n }).toThrow();\n });\n\n it('should throw if instantiating with duplicate key', function() {\n expect(function() {\n OrderedMap.fromArray(hasDuplicateKeys, extractUniqueID);\n }).toThrow();\n });\n\n it('should not throw when a key is the string \"0\"', function() {\n var verifyOM = function(om) {\n expect(om.length).toBe(3);\n expect(om.indexOfKey('greg')).toBe(0);\n expect(om.indexOfKey('0')).toBe(1);\n expect(om.indexOfKey(0)).toBe(1); // Casts on writes and reads.\n expect(om.indexOfKey('tom')).toBe(2);\n expect(om.keyAfter('greg')).toBe('0');\n expect(om.keyAfter('0')).toBe('tom');\n expect(om.keyAfter(0)).toBe('tom');\n expect(om.keyAfter('tom')).toBe(undefined);\n expect(om.keyBefore('greg')).toBe(undefined);\n expect(om.keyBefore(0)).toBe('greg');\n expect(om.keyBefore('0')).toBe('greg');\n expect(om.keyBefore('tom')).toBe('0');\n expect(om.has('undefined')).toBe(false);\n expect(om.has(0)).toBe(true);\n expect(om.has('0')).toBe(true);\n };\n var om = OrderedMap.fromArray(hasZeroStringKey, extractUniqueID);\n verifyOM(om);\n om = OrderedMap.fromArray(hasZeroNumberKey, extractUniqueID);\n verifyOM(om);\n });\n\n it('should throw when getting invalid public key', function() {\n var om = OrderedMap.fromArray(hasAllValidKeys, extractUniqueID);\n expect(function() {\n om.has(undefined);\n }).toThrow();\n expect(function() {\n om.get(undefined);\n }).toThrow();\n expect(function() {\n om.has(null);\n }).toThrow();\n expect(function() {\n om.get(null);\n }).toThrow();\n expect(function() {\n om.has('');\n }).toThrow();\n expect(function() {\n om.get('');\n }).toThrow();\n });\n\n it('should throw when any key is falsey', function() {\n expect(function() {\n OrderedMap.fromArray(hasEmptyStringKey, extractUniqueID);\n }).toThrow();\n\n expect(function() {\n OrderedMap.fromArray(hasNullKey, extractUniqueID);\n }).toThrow();\n\n expect(function() {\n OrderedMap.fromArray(hasUndefinedKey, extractUniqueID);\n }).toThrow();\n });\n\n\n it('should throw when fromArray is passed crazy args', function() {\n // Test passing another OrderedMap (when it expects a plain object.)\n // This is probably not what you meant to do! We should error.\n var validOM = OrderedMap.fromArray(hasAllValidKeys, extractUniqueID);\n expect(function() {\n OrderedMap.fromArray({uniqueID: 'asdf'}, extractUniqueID);\n }).toThrow();\n expect(function() {\n OrderedMap.fromArray(validOM, extractUniqueID);\n }).toThrow();\n });\n\n it('should throw when fromArray is passed crazy things', function() {\n expect(function() {\n OrderedMap.fromArray(null, extractUniqueID);\n }).toThrow();\n expect(function() {\n OrderedMap.fromArray('stringgg', extractUniqueID);\n }).toThrow();\n expect(function() {\n OrderedMap.fromArray(undefined, extractUniqueID);\n }).toThrow();\n expect(function() {\n OrderedMap.fromArray(new Date(), extractUniqueID);\n }).toThrow();\n expect(function() {\n OrderedMap.fromArray({}, extractUniqueID);\n }).toThrow();\n\n // Test failure without extractor\n expect(function() {\n OrderedMap.fromArray(idEntities);\n }).toThrow();\n expect(function() {\n OrderedMap.fromArray(idEntities, extractUniqueID);\n }).not.toThrow();\n });\n\n // Testing methods that accept other `OrderedMap`s.\n it('should throw when from/merge is passed an non-OrderedMap.', function() {\n // Test passing an array to construction.\n expect(function() {\n OrderedMap.from(idEntities, extractUniqueID);\n }).toThrow();\n\n // Test passing an array to merge.\n expect(function() {\n OrderedMap.fromArray(idEntities, extractUniqueID)\n .merge(idEntities, extractUniqueID);\n }).toThrow();\n\n\n // Test passing a plain object to merge.\n expect(function() {\n OrderedMap.fromArray(\n idEntities,\n extractUniqueID\n ).merge({blah: 'willFail'});\n }).toThrow();\n });\n\n it('should throw when accessing key before/after of non-key', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'first'},\n {uniqueID: 'two'}], extractUniqueID\n );\n expect(function() {\n om.keyBefore('dog');\n }).toThrow();\n expect(function() {\n om.keyAfter('cat');\n }).toThrow();\n expect(function() {\n om.keyAfter(null);\n }).toThrow();\n expect(function() {\n om.keyAfter(undefined);\n }).toThrow();\n });\n\n it('should throw passing invalid/not-present-keys to before/after',\n function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'one', val: 'first'},\n {uniqueID: 'two', val: 'second'},\n {uniqueID: 'three', val: 'third'},\n {uniqueID: 'four', val: 'fourth'}\n ], extractUniqueID);\n\n expect(function() {\n om.keyBefore('');\n }).toThrow();\n expect(function() {\n om.keyBefore(null);\n }).toThrow();\n expect(function() {\n om.keyBefore(undefined);\n }).toThrow();\n expect(function() {\n om.keyBefore('notInTheOrderedMap!');\n }).toThrow();\n\n expect(function() {\n om.keyAfter('');\n }).toThrow();\n expect(function() {\n om.keyAfter(null);\n }).toThrow();\n expect(function() {\n om.keyAfter(undefined);\n }).toThrow();\n expect(function() {\n om.keyAfter('notInTheOrderedMap!');\n }).toThrow();\n\n expect(function() {\n om.nthKeyAfter('', 1);\n }).toThrow();\n expect(function() {\n om.nthKeyAfter(null, 1);\n }).toThrow();\n expect(function() {\n om.nthKeyAfter(undefined, 1);\n }).toThrow();\n expect(function() {\n om.nthKeyAfter('notInTheOrderedMap!', 1);\n }).toThrow();\n\n expect(function() {\n om.nthKeyBefore('', 1);\n }).toThrow();\n expect(function() {\n om.nthKeyBefore(null, 1);\n }).toThrow();\n expect(function() {\n om.nthKeyBefore(undefined, 1);\n }).toThrow();\n expect(function() {\n om.nthKeyBefore('notInTheOrderedMap!', 1);\n }).toThrow();\n });\n\n it('should correctly determine the nth key after before', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'one', val: 'first'},\n {uniqueID: 'two', val: 'second'},\n {uniqueID: 'three', val: 'third'},\n {uniqueID: 'four', val: 'fourth'}\n ], extractUniqueID);\n expect(om.keyBefore('one')).toBe(undefined); // first key\n expect(om.keyBefore('two')).toBe('one');\n expect(om.keyBefore('three')).toBe('two');\n expect(om.keyBefore('four')).toBe('three');\n\n expect(om.keyAfter('one')).toBe('two'); // first key\n expect(om.keyAfter('two')).toBe('three');\n expect(om.keyAfter('three')).toBe('four');\n expect(om.keyAfter('four')).toBe(undefined);\n\n expect(om.nthKeyBefore('one', 0)).toBe('one'); // first key\n expect(om.nthKeyBefore('one', 1)).toBe(undefined);\n expect(om.nthKeyBefore('one', 2)).toBe(undefined);\n expect(om.nthKeyBefore('two', 0)).toBe('two');\n expect(om.nthKeyBefore('two', 1)).toBe('one');\n expect(om.nthKeyBefore('four', 0)).toBe('four');\n expect(om.nthKeyBefore('four', 1)).toBe('three');\n\n expect(om.nthKeyAfter('one', 0)).toBe('one');\n expect(om.nthKeyAfter('one', 1)).toBe('two');\n expect(om.nthKeyAfter('one', 2)).toBe('three');\n expect(om.nthKeyAfter('two', 0)).toBe('two');\n expect(om.nthKeyAfter('two', 1)).toBe('three');\n expect(om.nthKeyAfter('four', 0)).toBe('four');\n expect(om.nthKeyAfter('four', 1)).toBe(undefined);\n });\n\n it('should compute key indices correctly', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'one', val: 'first'},\n {uniqueID: 'two', val: 'second'}\n ], extractUniqueID);\n expect(om.keyAtIndex(0)).toBe('one');\n expect(om.keyAtIndex(1)).toBe('two');\n expect(om.keyAtIndex(2)).toBe(undefined);\n expect(om.indexOfKey('one')).toBe(0);\n expect(om.indexOfKey('two')).toBe(1);\n expect(om.indexOfKey('nope')).toBe(undefined);\n expect(function() {\n om.indexOfKey(null);\n }).toThrow();\n expect(function() {\n om.indexOfKey(undefined);\n }).toThrow();\n expect(function() {\n om.indexOfKey(''); // Empty key is not allowed\n }).toThrow();\n });\n\n it('should compute indices on array that extracted numeric ids', function() {\n var om = OrderedMap.fromArray(hasZeroStringKey, extractUniqueID);\n expect(om.keyAtIndex(0)).toBe('greg');\n expect(om.keyAtIndex(1)).toBe('0');\n expect(om.keyAtIndex(2)).toBe('tom');\n expect(om.indexOfKey('greg')).toBe(0);\n expect(om.indexOfKey('0')).toBe(1);\n expect(om.indexOfKey('tom')).toBe(2);\n\n\n var verifyNumericKeys = function(om) {\n expect(om.keyAtIndex(0)).toBe('0');\n expect(om.keyAtIndex(1)).toBe('2');\n expect(om.keyAtIndex(2)).toBe('1');\n expect(om.indexOfKey('0')).toBe(0);\n expect(om.indexOfKey('2')).toBe(1); // Proove these are not ordered by\n expect(om.indexOfKey('1')).toBe(2); // their keys\n };\n var omStringNumberKeys =\n OrderedMap.fromArray(hasAllNumericStringKeys, extractUniqueID);\n verifyNumericKeys(omStringNumberKeys);\n var omNumericKeys =\n OrderedMap.fromArray(hasAllNumericKeys, extractUniqueID);\n verifyNumericKeys(omNumericKeys);\n });\n\n it('should compute indices on mutually exclusive merge', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'one', val: 'first'},\n {uniqueID: 'two', val: 'second'}\n ], extractUniqueID);\n var om2 = OrderedMap.fromArray([\n {uniqueID: 'three', val: 'third'}\n ], extractUniqueID);\n var res = om.merge(om2);\n\n expect(res.length).toBe(3);\n\n expect(res.keyAtIndex(0)).toBe('one');\n expect(res.keyAtIndex(1)).toBe('two');\n expect(res.keyAtIndex(2)).toBe('three');\n expect(res.keyAtIndex(3)).toBe(undefined);\n\n expect(res.indexOfKey('one')).toBe(0);\n expect(res.indexOfKey('two')).toBe(1);\n expect(res.indexOfKey('three')).toBe(2);\n expect(res.indexOfKey('dog')).toBe(undefined);\n\n expect(res.has('one')).toBe(true);\n expect(res.has('two')).toBe(true);\n expect(res.has('three')).toBe(true);\n expect(res.has('dog')).toBe(false);\n\n expect(res.get('one').val).toBe('first');\n expect(res.get('two').val).toBe('second');\n expect(res.get('three').val).toBe('third');\n expect(res.get('dog')).toBe(undefined);\n });\n\n it('should compute indices on intersected merge', function() {\n var oneTwo = OrderedMap.fromArray([\n {uniqueID: 'one', val: 'first'},\n {uniqueID: 'two', val: 'secondOM1'}\n ], extractUniqueID);\n\n var testOneTwoMergedWithTwoThree = function(res) {\n expect(res.length).toBe(3);\n expect(res.keyAtIndex(0)).toBe('one');\n expect(res.keyAtIndex(1)).toBe('two');\n expect(res.keyAtIndex(2)).toBe('three');\n expect(res.keyAtIndex(3)).toBe(undefined);\n expect(res.indexOfKey('one')).toBe(0);\n expect(res.indexOfKey('two')).toBe(1);\n expect(res.indexOfKey('three')).toBe(2);\n expect(res.indexOfKey('dog')).toBe(undefined);\n expect(res.has('one')).toBe(true);\n expect(res.has('two')).toBe(true);\n expect(res.has('three')).toBe(true);\n expect(res.has('dog')).toBe(false);\n expect(res.get('one').val).toBe('first');\n expect(res.get('two').val).toBe('secondOM2');\n expect(res.get('three').val).toBe('third');\n expect(res.get('dog')).toBe(undefined);\n };\n\n var result =\n oneTwo.merge(OrderedMap.fromArray([\n {uniqueID: 'two', val: 'secondOM2'},\n {uniqueID: 'three', val: 'third'}\n ], extractUniqueID));\n testOneTwoMergedWithTwoThree(result);\n\n // Everything should be exactly as before, since the ordering of `two` was\n // already determined by `om`.\n result = oneTwo.merge(\n OrderedMap.fromArray([\n {uniqueID: 'three', val: 'third'},\n {uniqueID: 'two', val:'secondOM2'}\n ], extractUniqueID)\n );\n testOneTwoMergedWithTwoThree(result);\n\n\n var testTwoThreeMergedWithOneTwo = function(res) {\n expect(res.length).toBe(3);\n expect(res.keyAtIndex(0)).toBe('two');\n expect(res.keyAtIndex(1)).toBe('three');\n expect(res.keyAtIndex(2)).toBe('one');\n expect(res.keyAtIndex(3)).toBe(undefined);\n expect(res.indexOfKey('two')).toBe(0);\n expect(res.indexOfKey('three')).toBe(1);\n expect(res.indexOfKey('one')).toBe(2);\n expect(res.indexOfKey('cat')).toBe(undefined);\n expect(res.has('two')).toBe(true);\n expect(res.has('three')).toBe(true);\n expect(res.has('one')).toBe(true);\n expect(res.has('dog')).toBe(false);\n expect(res.get('one').val).toBe('first');\n expect(res.get('two').val).toBe('secondOM1');\n expect(res.get('three').val).toBe('third');\n expect(res.get('dog')).toBe(undefined);\n };\n result = OrderedMap.fromArray([\n {uniqueID: 'two', val: 'secondOM2'},\n {uniqueID: 'three', val: 'third'}\n ], extractUniqueID).merge(oneTwo);\n testTwoThreeMergedWithOneTwo(result);\n\n });\n\n it('should merge mutually exclusive keys to the end.', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'one', val: 'first'},\n {uniqueID: 'two', val: 'second'}\n ], extractUniqueID);\n var om2 = OrderedMap.fromArray([\n {uniqueID: 'three', val: 'first'},\n {uniqueID: 'four', val: 'second'}\n ], extractUniqueID);\n var res = om.merge(om2);\n expect(res.length).toBe(4);\n\n });\n\n it('should map correctly', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'x', val: 'xx'},\n {uniqueID: 'y', val: 'yy'},\n {uniqueID: 'z', val: 'zz'}\n ], extractUniqueID);\n var scope = {justToTestScope: 'justTestingScope'};\n var verifyResult = function(omResult) {\n expect(omResult.length).toBe(3);\n expect(omResult.keyAtIndex(0)).toBe('x');\n expect(omResult.keyAtIndex(1)).toBe('y');\n expect(omResult.keyAtIndex(2)).toBe('z');\n expect(omResult.get('x').val).toBe('xxx0justTestingScope');\n expect(omResult.get('y').val).toBe('yyy1justTestingScope');\n expect(omResult.get('z').val).toBe('zzz2justTestingScope');\n };\n var resultOM = om.map(function(itm, key, count) {\n return {\n uniqueID: itm.uniqueID,\n val: itm.val + key + count + this.justToTestScope\n };\n }, scope);\n verifyResult(resultOM);\n\n var resArray = [];\n om.forEach(function(itm, key, count) {\n resArray.push({\n uniqueID: itm.uniqueID,\n val: itm.val + key + count + this.justToTestScope\n });\n }, scope);\n resultOM = OrderedMap.fromArray(resArray, extractUniqueID);\n verifyResult(resultOM);\n });\n\n it('should filter correctly', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'x', val: 'xx'},\n {uniqueID: 'y', val: 'yy'},\n {uniqueID: 'z', val: 'zz'}\n ], extractUniqueID);\n var scope = {justToTestScope: 'justTestingScope'};\n\n var filteringCallback = function(item, key, indexInOriginal) {\n expect(this).toBe(scope);\n expect(key === 'x' || key === 'y' || key === 'z').toBe(true);\n if (key === 'x') {\n expect(item.val).toBe('xx');\n expect(indexInOriginal).toBe(0);\n return false;\n } else if (key === 'y') {\n expect(item.val).toBe('yy');\n expect(indexInOriginal).toBe(1);\n return true;\n } else {\n expect(item.val).toBe('zz');\n expect(indexInOriginal).toBe(2);\n return true;\n }\n };\n\n var verifyResult = function(omResult) {\n expect(omResult.length).toBe(2);\n expect(omResult.keyAtIndex(0)).toBe('y');\n expect(omResult.keyAtIndex(1)).toBe('z');\n expect(omResult.has('x')).toBe(false);\n expect(omResult.has('z')).toBe(true);\n expect(omResult.get('z').val).toBe('zz');\n expect(omResult.has('y')).toBe(true);\n expect(omResult.get('y').val).toBe('yy');\n };\n\n var resultOM = om.filter(filteringCallback, scope);\n verifyResult(resultOM);\n });\n\n it('should throw when providing invalid ranges to ranging', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'x', val: 'xx'},\n {uniqueID: 'y', val: 'yy'},\n {uniqueID: 'z', val: 'zz'}\n ], extractUniqueID);\n var scope = {justToTestScope: 'justTestingScope'};\n\n expect(function() {\n om.mapRange(duplicate, 0, 3, scope);\n }).not.toThrow();\n expect(function() {\n om.filterRange(duplicate, 0, 3, scope);\n }).not.toThrow();\n expect(function() {\n om.forEachRange(duplicate, 0, 3, scope);\n }).not.toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, 'x' , 3, scope);\n }).toThrow(\n 'Invariant Violation: mapKeyRange must be given keys ' +\n 'that are present.'\n );\n expect(function() {\n om.forEachKeyRange(duplicate, 'x', 3, scope);\n }).toThrow(\n 'Invariant Violation: forEachKeyRange must be given keys ' +\n 'that are present.'\n );\n\n expect(function() {\n om.mapRange(duplicate, 0, 4, scope);\n }).toThrow();\n expect(function() {\n om.filterRange(duplicate, 0, 4, scope);\n }).toThrow();\n expect(function() {\n om.forEachRange(duplicate, 0, 4, scope);\n }).toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, 'x', null, scope);\n }).toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, 'x', null, scope);\n }).toThrow();\n\n expect(function() {\n om.mapRange(duplicate, -1, 1, scope);\n }).toThrow();\n expect(function() {\n om.filterRange(duplicate, -1, 1, scope);\n }).toThrow();\n expect(function() {\n om.forEachRange(duplicate, -1, 1, scope);\n }).toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, null, 'y', scope);\n }).toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, null, 'y', scope);\n }).toThrow();\n\n expect(function() {\n om.mapRange(duplicate, 0, 0, scope);\n }).not.toThrow();\n expect(function() {\n om.filterRange(duplicate, 0, 0, scope);\n }).not.toThrow();\n expect(function() {\n om.forEachRange(duplicate, 0, 0, scope);\n }).not.toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, 'x', 'x', scope);\n }).not.toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, 'x', 'x', scope);\n }).not.toThrow();\n\n expect(function() {\n om.mapRange(duplicate, 0, -1, scope);\n }).toThrow();\n expect(function() {\n om.filterRange(duplicate, 0, -1, scope);\n }).toThrow();\n expect(function() {\n om.forEachRange(duplicate, 0, -1, scope);\n }).toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, 'x', null, scope);\n }).toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, 'x', null, scope);\n }).toThrow();\n\n expect(function() {\n om.mapRange(duplicate, 2, 1, scope);\n }).not.toThrow();\n expect(function() {\n om.filterRange(duplicate, 2, 1, scope);\n }).not.toThrow();\n expect(function() {\n om.forEachRange(duplicate, 2, 1, scope);\n }).not.toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, 'z', 'z', scope);\n }).not.toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, 'z', 'z', scope);\n }).not.toThrow();\n\n expect(function() {\n om.mapRange(duplicate, 2, 2, scope);\n }).toThrow();\n expect(function() {\n om.filterRange(duplicate, 2, 2, scope);\n }).toThrow();\n expect(function() {\n om.forEachRange(duplicate, 2, 2, scope);\n }).toThrow();\n expect(function() {\n om.mapKeyRange(duplicate, 'z', null, scope);\n }).toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, 'z', null, scope);\n }).toThrow();\n\n // Provide keys in reverse order - should throw.\n expect(function() {\n om.mapKeyRange(duplicate, 'y', 'x', scope);\n }).toThrow();\n expect(function() {\n om.forEachKeyRange(duplicate, 'y', 'x', scope);\n }).toThrow();\n });\n\n // TEST length zero map, or keyrange start===end\n\n it('should map range correctly', function() {\n var om = OrderedMap.fromArray([\n {uniqueID: 'x', val: 'xx'},\n {uniqueID: 'y', val: 'yy'},\n {uniqueID: 'z', val: 'zz'}\n ], extractUniqueID);\n var scope = {justToTestScope: 'justTestingScope'};\n var verifyThreeItems = function(omResult) {\n expect(omResult.length).toBe(3);\n expect(omResult.keyAtIndex(0)).toBe('x');\n expect(omResult.keyAtIndex(1)).toBe('y');\n expect(omResult.keyAtIndex(2)).toBe('z');\n expect(omResult.get('x').val).toBe('xxx0justTestingScope');\n expect(omResult.get('y').val).toBe('yyy1justTestingScope');\n expect(omResult.get('z').val).toBe('zzz2justTestingScope');\n };\n var verifyFirstTwoItems = function(omResult) {\n expect(omResult.length).toBe(2);\n expect(omResult.keyAtIndex(0)).toBe('x');\n expect(omResult.keyAtIndex(1)).toBe('y');\n expect(omResult.get('x').val).toBe('xxx0justTestingScope');\n expect(omResult.get('y').val).toBe('yyy1justTestingScope');\n };\n\n var verifyLastTwoItems = function(omResult) {\n expect(omResult.length).toBe(2);\n expect(omResult.keyAtIndex(0)).toBe('y');\n expect(omResult.keyAtIndex(1)).toBe('z');\n expect(omResult.get('y').val).toBe('yyy1justTestingScope');\n expect(omResult.get('z').val).toBe('zzz2justTestingScope');\n };\n\n var verifyMiddleItem = function(omResult) {\n expect(omResult.length).toBe(1);\n expect(omResult.keyAtIndex(0)).toBe('y');\n expect(omResult.get('y').val).toBe('yyy1justTestingScope');\n };\n\n var verifyEmpty = function(omResult) {\n expect(omResult.length).toBe(0);\n };\n\n var omResultThree = om.mapRange(duplicate, 0, 3, scope);\n verifyThreeItems(omResultThree);\n var resArray = [];\n var pushToResArray = function(itm, key, count) {\n resArray.push({\n uniqueID: itm.uniqueID,\n val: itm.val + key + count + this.justToTestScope\n });\n };\n\n om.forEachRange(pushToResArray, 0, 3, scope);\n omResultThree = OrderedMap.fromArray(resArray, extractUniqueID);\n verifyThreeItems(omResultThree);\n\n var omResultFirstTwo = om.mapRange(duplicate, 0, 2, scope);\n verifyFirstTwoItems(omResultFirstTwo);\n resArray = [];\n om.forEachRange(pushToResArray, 0, 2, scope);\n omResultFirstTwo = OrderedMap.fromArray(resArray, extractUniqueID);\n verifyFirstTwoItems(omResultFirstTwo);\n\n var omResultLastTwo = om.mapRange(duplicate, 1, 2, scope);\n verifyLastTwoItems(omResultLastTwo);\n resArray = [];\n om.forEachRange(pushToResArray, 1, 2, scope);\n omResultLastTwo = OrderedMap.fromArray(resArray, extractUniqueID);\n verifyLastTwoItems(omResultLastTwo);\n\n var omResultMiddle = om.mapRange(duplicate, 1, 1, scope);\n verifyMiddleItem(omResultMiddle);\n resArray = [];\n om.forEachRange(pushToResArray, 1, 1, scope);\n omResultMiddle = OrderedMap.fromArray(resArray, extractUniqueID);\n verifyMiddleItem(omResultMiddle);\n\n var omResultNone = om.mapRange(duplicate, 1, 0, scope);\n verifyEmpty(omResultNone);\n });\n\n it('should extract the original array correctly', function() {\n var sourceArray = [\n {uniqueID: 'x', val: 'xx'},\n {uniqueID: 'y', val: 'yy'},\n {uniqueID: 'z', val: 'zz'}\n ];\n var om = OrderedMap.fromArray(sourceArray, extractUniqueID);\n expect(om.toArray()).toEqual(sourceArray);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/OrderedMap-test\", module);\n",
"utils/__tests__/ReactChildren-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n * @jsx React.DOM\n */\n\n\"use strict\";\n\ndescribe('ReactChildren', function() {\n var ReactChildren;\n var React;\n\n beforeEach(function() {\n ReactChildren = require(\"../../ReactChildren\");\n React = require(\"../../React\");\n });\n\n\n it('should support identity for simple', function() {\n var callback = jasmine.createSpy().andCallFake(function (kid, index) {\n return kid;\n });\n\n var simpleKid = React.DOM.span( {key:\"simple\"} );\n\n // First pass children into a component to fully simulate what happens when\n // using structures that arrive from transforms.\n\n var instance = React.DOM.div(null, simpleKid);\n ReactChildren.forEach(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(simpleKid, 0);\n callback.reset();\n var mappedChildren = ReactChildren.map(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(simpleKid, 0);\n expect(mappedChildren[Object.keys(mappedChildren)[0]]).toBe(simpleKid);\n });\n\n it('should treat single arrayless child as being in array', function() {\n var callback = jasmine.createSpy().andCallFake(function (kid, index) {\n return kid;\n });\n\n var simpleKid = React.DOM.span(null );\n var instance = React.DOM.div(null, simpleKid);\n ReactChildren.forEach(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(simpleKid, 0);\n callback.reset();\n var mappedChildren = ReactChildren.map(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(simpleKid, 0);\n expect(mappedChildren[Object.keys(mappedChildren)[0]]).toBe(simpleKid);\n });\n\n it('should treat single child in array as expected', function() {\n var callback = jasmine.createSpy().andCallFake(function (kid, index) {\n return kid;\n });\n\n var simpleKid = React.DOM.span(null );\n var instance = React.DOM.div(null, [simpleKid]);\n ReactChildren.forEach(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(simpleKid, 0);\n callback.reset();\n var mappedChildren = ReactChildren.map(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(simpleKid, 0);\n expect(mappedChildren[Object.keys(mappedChildren)[0]]).toBe(simpleKid);\n });\n\n it('should pass key to returned component', function() {\n var mapFn = function (kid, index) {\n return React.DOM.div(null, kid);\n };\n\n var simpleKid = React.DOM.span( {key:\"simple\"} );\n\n var instance = React.DOM.div(null, simpleKid);\n var mappedChildren = ReactChildren.map(instance.props.children, mapFn);\n\n var mappedKeys = Object.keys(mappedChildren);\n expect(mappedKeys.length).toBe(1);\n expect(mappedChildren[mappedKeys[0]]).not.toBe(simpleKid);\n expect(mappedChildren[mappedKeys[0]].props.children).toBe(simpleKid);\n expect(mappedKeys[0]).toBe('{simple}');\n });\n\n it('should invoke callback with the right context', function() {\n var lastContext;\n var callback = function (kid, index) {\n lastContext = this;\n return this;\n };\n\n var scopeTester = {};\n\n var simpleKid = React.DOM.span( {key:\"simple\"} );\n var instance = React.DOM.div(null, simpleKid);\n ReactChildren.forEach(instance.props.children, callback, scopeTester);\n expect(lastContext).toBe(scopeTester);\n\n var mappedChildren =\n ReactChildren.map(instance.props.children, callback, scopeTester);\n\n var mappedKeys = Object.keys(mappedChildren);\n expect(mappedKeys.length).toBe(1);\n expect(mappedChildren[mappedKeys[0]]).toBe(scopeTester);\n });\n\n it('should be called for each child', function() {\n var zero = React.DOM.div( {key:\"keyZero\"} );\n var one = null;\n var two = React.DOM.div( {key:\"keyTwo\"} );\n var three = null;\n var four = React.DOM.div( {key:\"keyFour\"} );\n\n var zeroMapped = React.DOM.div( {key:\"giraffe\"} ); // Key should be overridden\n var oneMapped = null; // Key should be added even if we don't supply it!\n var twoMapped = React.DOM.div(null ); // Key should be added even if not supplied!\n var threeMapped = React.DOM.span(null ); // Map from null to something.\n var fourMapped = React.DOM.div( {key:\"keyFour\"} );\n\n var callback = jasmine.createSpy().andCallFake(function (kid, index) {\n return index === 0 ? zeroMapped :\n index === 1 ? oneMapped :\n index === 2 ? twoMapped :\n index === 3 ? threeMapped : fourMapped;\n });\n\n var instance = (\n React.DOM.div(null, \n zero,\n one,\n two,\n three,\n four\n )\n );\n\n ReactChildren.forEach(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(zero, 0);\n expect(callback).toHaveBeenCalledWith(one, 1);\n expect(callback).toHaveBeenCalledWith(two, 2);\n expect(callback).toHaveBeenCalledWith(three, 3);\n expect(callback).toHaveBeenCalledWith(four, 4);\n callback.reset();\n\n var mappedChildren =\n ReactChildren.map(instance.props.children, callback);\n var mappedKeys = Object.keys(mappedChildren);\n expect(callback.calls.length).toBe(5);\n expect(mappedKeys.length).toBe(5);\n // Keys default to indices.\n expect(mappedKeys).toEqual(\n ['{keyZero}', '[1]', '{keyTwo}', '[3]', '{keyFour}']\n );\n\n expect(callback).toHaveBeenCalledWith(zero, 0);\n expect(mappedChildren[mappedKeys[0]]).toBe(zeroMapped);\n\n expect(callback).toHaveBeenCalledWith(one, 1);\n expect(mappedChildren[mappedKeys[1]]).toBe(oneMapped);\n\n expect(callback).toHaveBeenCalledWith(two, 2);\n expect(mappedChildren[mappedKeys[2]]).toBe(twoMapped);\n\n expect(callback).toHaveBeenCalledWith(three, 3);\n expect(mappedChildren[mappedKeys[3]]).toBe(threeMapped);\n\n expect(callback).toHaveBeenCalledWith(four, 4);\n expect(mappedChildren[mappedKeys[4]]).toBe(fourMapped);\n });\n\n\n it('should be called for each child in nested structure', function() {\n var zero = React.DOM.div( {key:\"keyZero\"} );\n var one = null;\n var two = React.DOM.div( {key:\"keyTwo\"} );\n var three = null;\n var four = React.DOM.div( {key:\"keyFour\"} );\n var five = React.DOM.div( {key:\"keyFiveCompletelyIgnored\"} );\n // five is placed into a JS object with a key that takes precedence over the\n // component key attribute.\n // Precedence is as follows:\n // 1. JavaScript Object key if in a JavaScript object:\n // 2. If grouped in an Array, the `key` attribute.\n // 3. The array index if in a JavaScript Array.\n\n var zeroMapped = React.DOM.div( {key:\"giraffe\"} ); // Key should be overridden\n var oneMapped = null; // Key should be added even if we don't supply it!\n var twoMapped = React.DOM.div(null ); // Key should be added even if not supplied!\n var threeMapped = React.DOM.span(null ); // Map from null to something.\n var fourMapped = React.DOM.div( {key:\"keyFour\"} );\n var fiveMapped = React.DOM.div(null );\n\n var callback = jasmine.createSpy().andCallFake(function (kid, index) {\n return index === 0 ? zeroMapped :\n index === 1 ? oneMapped :\n index === 2 ? twoMapped :\n index === 3 ? threeMapped :\n index === 4 ? fourMapped : fiveMapped;\n });\n\n var instance = (\n React.DOM.div(null, \n [{\n firstHalfKey: [zero, one, two],\n secondHalfKey: [three, four],\n keyFive: five\n }]\n )\n );\n\n ReactChildren.forEach(instance.props.children, callback);\n expect(callback).toHaveBeenCalledWith(zero, 0);\n expect(callback).toHaveBeenCalledWith(one, 1);\n expect(callback).toHaveBeenCalledWith(two, 2);\n expect(callback).toHaveBeenCalledWith(three, 3);\n expect(callback).toHaveBeenCalledWith(four, 4);\n expect(callback).toHaveBeenCalledWith(five, 5);\n callback.reset();\n\n var mappedChildren = ReactChildren.map(instance.props.children, callback);\n var mappedKeys = Object.keys(mappedChildren);\n expect(callback.calls.length).toBe(6);\n expect(mappedKeys.length).toBe(6);\n // Keys default to indices.\n expect(mappedKeys).toEqual([\n '[0]{firstHalfKey}{keyZero}',\n '[0]{firstHalfKey}[1]',\n '[0]{firstHalfKey}{keyTwo}',\n '[0]{secondHalfKey}[0]',\n '[0]{secondHalfKey}{keyFour}',\n '[0]{keyFive}'\n ]);\n\n expect(callback).toHaveBeenCalledWith(zero, 0);\n expect(mappedChildren[mappedKeys[0]]).toBe(zeroMapped);\n\n expect(callback).toHaveBeenCalledWith(one, 1);\n expect(mappedChildren[mappedKeys[1]]).toBe(oneMapped);\n\n expect(callback).toHaveBeenCalledWith(two, 2);\n expect(mappedChildren[mappedKeys[2]]).toBe(twoMapped);\n\n expect(callback).toHaveBeenCalledWith(three, 3);\n expect(mappedChildren[mappedKeys[3]]).toBe(threeMapped);\n\n expect(callback).toHaveBeenCalledWith(four, 4);\n expect(mappedChildren[mappedKeys[4]]).toBe(fourMapped);\n\n expect(callback).toHaveBeenCalledWith(five, 5);\n expect(mappedChildren[mappedKeys[5]]).toBe(fiveMapped);\n });\n\n it('should retain key across two mappings', function() {\n var zeroForceKey = React.DOM.div( {key:\"keyZero\"} );\n var oneForceKey = React.DOM.div( {key:\"keyOne\"} );\n\n // Key should be overridden\n var zeroForceKeyMapped = React.DOM.div( {key:\"giraffe\"} );\n // Key should be added even if we don't supply it!\n var oneForceKeyMapped = React.DOM.div(null );\n\n var mapFn = function(kid, index) {\n return index === 0 ? zeroForceKeyMapped : oneForceKeyMapped;\n };\n\n var forcedKeys = (\n React.DOM.div(null, \n zeroForceKey,\n oneForceKey\n )\n );\n\n var expectedForcedKeys = ['{keyZero}', '{keyOne}'];\n var mappedChildrenForcedKeys =\n ReactChildren.map(forcedKeys.props.children, mapFn);\n var mappedForcedKeys = Object.keys(mappedChildrenForcedKeys);\n expect(mappedForcedKeys).toEqual(expectedForcedKeys);\n\n var expectedRemappedForcedKeys = ['{{keyZero}}', '{{keyOne}}'];\n var remappedChildrenForcedKeys =\n ReactChildren.map(mappedChildrenForcedKeys, mapFn);\n expect(\n Object.keys(remappedChildrenForcedKeys)\n ).toEqual(expectedRemappedForcedKeys);\n\n });\n\n it('should not throw if key provided is a dupe with array key', function() {\n var zero = React.DOM.div(null );\n var one = React.DOM.div( {key:\"0\"} );\n\n var mapFn = function() {\n return null;\n };\n\n var instance = (\n React.DOM.div(null, \n zero,\n one\n )\n );\n\n expect(function() {\n ReactChildren.map(instance.props.children, mapFn);\n }).not.toThrow();\n });\n\n it('should throw if key provided is a dupe with explicit key', function() {\n var zero = React.DOM.div( {key:\"something\"});\n var one = React.DOM.div( {key:\"something\"} );\n\n var mapFn = function() {return null;};\n var instance = (\n React.DOM.div(null, zero,one)\n );\n\n expect(function() {\n ReactChildren.map(instance.props.children, mapFn);\n }).toThrow();\n });\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/ReactChildren-test\", module);\n",
"utils/__tests__/Transaction-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nvar Transaction;\nvar mixInto;\n\nvar INIT_ERRORED = 'initErrored'; // Just a dummy value to check for.\ndescribe('Transaction', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n Transaction = require(\"../../Transaction\");\n mixInto = require(\"../../mixInto\");\n });\n\n /**\n * We should not invoke closers for inits that failed. We should pass init\n * return values to closers when those inits are successful. We should not\n * invoke the actual method when any of the initializers fail.\n */\n it('should invoke closers with/only-with init returns', function() {\n var throwInInit = function() {\n throw new Error('close[0] should receive Transaction.OBSERVED_ERROR');\n };\n\n var performSideEffect;\n var dontPerformThis = function() {\n performSideEffect = 'This should never be set to this';\n };\n\n /**\n * New test Transaction subclass.\n */\n var TestTransaction = function() {\n this.reinitializeTransaction();\n this.firstCloseParam = INIT_ERRORED; // WON'T be set to something else\n this.secondCloseParam = INIT_ERRORED; // WILL be set to something else\n this.lastCloseParam = INIT_ERRORED; // WON'T be set to something else\n };\n mixInto(TestTransaction, Transaction.Mixin);\n TestTransaction.prototype.getTransactionWrappers = function() {\n return [\n {\n initialize: throwInInit,\n close: function(initResult) {\n this.firstCloseParam = initResult;\n }\n },\n {\n initialize: function() { return 'asdf'; },\n close: function(initResult) {\n this.secondCloseParam = initResult;\n }\n },\n {\n initialize: throwInInit,\n close: function(initResult) {\n this.lastCloseParam = initResult;\n }\n }\n ];\n };\n\n var transaction = new TestTransaction();\n\n expect(function() {\n transaction.perform(dontPerformThis);\n }).toThrow();\n\n expect(performSideEffect).toBe(undefined);\n expect(transaction.firstCloseParam).toBe(INIT_ERRORED);\n expect(transaction.secondCloseParam).toBe('asdf');\n expect(transaction.lastCloseParam).toBe(INIT_ERRORED);\n expect(transaction.isInTransaction()).toBe(false);\n });\n\n it('should invoke closers and wrapped method when inits success', function() {\n\n var performSideEffect;\n /**\n * New test Transaction subclass.\n */\n var TestTransaction = function() {\n this.reinitializeTransaction();\n this.firstCloseParam = INIT_ERRORED; // WON'T be set to something else\n this.secondCloseParam = INIT_ERRORED; // WILL be set to something else\n this.lastCloseParam = INIT_ERRORED; // WON'T be set to something else\n };\n mixInto(TestTransaction, Transaction.Mixin);\n TestTransaction.prototype.getTransactionWrappers = function() {\n return [\n {\n initialize: function() {\n return 'firstResult';\n },\n close: function(initResult) {\n this.firstCloseParam = initResult;\n }\n },\n {\n initialize: function() {\n return 'secondResult';\n },\n close: function(initResult) {\n this.secondCloseParam = initResult;\n }\n },\n {\n initialize: function() {\n return 'thirdResult';\n },\n close: function(initResult) {\n this.lastCloseParam = initResult;\n }\n }\n ];\n };\n\n var transaction = new TestTransaction();\n\n transaction.perform(function() {\n performSideEffect = 'SIDE_EFFECT';\n });\n\n expect(performSideEffect).toBe('SIDE_EFFECT');\n expect(transaction.firstCloseParam).toBe('firstResult');\n expect(transaction.secondCloseParam).toBe('secondResult');\n expect(transaction.lastCloseParam).toBe('thirdResult');\n expect(transaction.isInTransaction()).toBe(false);\n });\n\n /**\n * When the operation throws, the transaction should throw, but all of the\n * error-free closers should execute gracefully without issue. If a closer\n * throws an error, the transaction should prefer to throw the error\n * encountered earlier in the operation.\n */\n it('should throw when wrapped operation throws', function() {\n\n var performSideEffect;\n /**\n * New test Transaction subclass.\n */\n var TestTransaction = function() {\n this.reinitializeTransaction();\n this.firstCloseParam = INIT_ERRORED; // WON'T be set to something else\n this.secondCloseParam = INIT_ERRORED; // WILL be set to something else\n this.lastCloseParam = INIT_ERRORED; // WON'T be set to something else\n };\n mixInto(TestTransaction, Transaction.Mixin);\n // Now, none of the close/inits throw, but the operation we wrap will throw.\n TestTransaction.prototype.getTransactionWrappers = function() {\n return [\n {\n initialize: function() {\n return 'firstResult';\n },\n close: function(initResult) {\n this.firstCloseParam = initResult;\n }\n },\n {\n initialize: function() {\n return 'secondResult';\n },\n close: function(initResult) {\n this.secondCloseParam = initResult;\n }\n },\n {\n initialize: function() {\n return 'thirdResult';\n },\n close: function(initResult) {\n this.lastCloseParam = initResult;\n }\n },\n {\n initialize: function() {\n return 'fourthResult';\n },\n close: function(initResult) {\n throw new Error('The transaction should throw a TypeError.');\n }\n }\n ];\n };\n\n var transaction = new TestTransaction();\n\n expect(function() {\n var isTypeError = false;\n try {\n transaction.perform(function() {\n throw new TypeError(\"Thrown in main wrapped operation\");\n });\n } catch (err) {\n isTypeError = (err instanceof TypeError);\n }\n return isTypeError;\n }()).toBe(true);\n\n expect(performSideEffect).toBe(undefined);\n expect(transaction.firstCloseParam).toBe('firstResult');\n expect(transaction.secondCloseParam).toBe('secondResult');\n expect(transaction.lastCloseParam).toBe('thirdResult');\n expect(transaction.isInTransaction()).toBe(false);\n });\n\n it('should throw errors in transaction close', function() {\n var TestTransaction = function() {\n this.reinitializeTransaction();\n };\n mixInto(TestTransaction, Transaction.Mixin);\n var exceptionMsg = 'This exception should throw.';\n TestTransaction.prototype.getTransactionWrappers = function() {\n return [\n {\n close: function(initResult) {\n throw new Error(exceptionMsg);\n }\n }\n ];\n };\n\n var transaction = new TestTransaction();\n expect(function() {\n transaction.perform(function() {});\n }).toThrow(exceptionMsg);\n });\n\n it('should allow nesting of transactions', function() {\n var performSideEffect;\n var nestedPerformSideEffect;\n /**\n * New test Transaction subclass.\n */\n var TestTransaction = function() {\n this.reinitializeTransaction();\n this.firstCloseParam = INIT_ERRORED; // WON'T be set to something else\n this.secondCloseParam = INIT_ERRORED; // WILL be set to something else\n this.lastCloseParam = INIT_ERRORED; // WON'T be set to something else\n };\n mixInto(TestTransaction, Transaction.Mixin);\n TestTransaction.prototype.getTransactionWrappers = function() {\n return [\n {\n initialize: function() {\n return 'firstResult';\n },\n close: function(initResult) {\n this.firstCloseParam = initResult;\n }\n },\n {\n initialize: function() {\n this.nestedTransaction = new NestedTransaction();\n },\n close: function() {\n // Test performing a transaction in another transaction's close()\n this.nestedTransaction.perform(function() {\n nestedPerformSideEffect = 'NESTED_SIDE_EFFECT';\n });\n }\n }\n ];\n };\n\n var NestedTransaction = function() {\n this.reinitializeTransaction();\n };\n mixInto(NestedTransaction, Transaction.Mixin);\n NestedTransaction.prototype.getTransactionWrappers = function() {\n return [{\n initialize: function() {\n this.hasInitializedNested = true;\n },\n close: function() {\n this.hasClosedNested = true;\n }\n }];\n };\n\n var transaction = new TestTransaction();\n\n transaction.perform(function() {\n performSideEffect = 'SIDE_EFFECT';\n });\n\n expect(performSideEffect).toBe('SIDE_EFFECT');\n expect(nestedPerformSideEffect).toBe('NESTED_SIDE_EFFECT');\n expect(transaction.firstCloseParam).toBe('firstResult');\n expect(transaction.isInTransaction()).toBe(false);\n expect(transaction.nestedTransaction.hasClosedNested).toBe(true);\n expect(transaction.nestedTransaction.hasInitializedNested).toBe(true);\n expect(transaction.nestedTransaction.isInTransaction()).toBe(false);\n });\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/Transaction-test\", module);\n",
"utils/__tests__/escapeTextForBrowser-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\ndescribe('escapeTextForBrowser', function() {\n\n var escapeTextForBrowser = require(\"../../escapeTextForBrowser\");\n\n it('should escape boolean to string', function() {\n expect(escapeTextForBrowser(true)).toBe('true');\n expect(escapeTextForBrowser(false)).toBe('false');\n });\n\n it('should escape object to string', function() {\n var escaped = escapeTextForBrowser({\n toString: function() {\n return 'ponys';\n }\n });\n\n expect(escaped).toBe('ponys');\n });\n\n it('should escape number to string', function() {\n expect(escapeTextForBrowser(42)).toBe('42');\n });\n\n it('should escape string', function() {\n var escaped = escapeTextForBrowser('<script type=\\'\\' src=\"\"></script>');\n expect(escaped).not.toContain('<');\n expect(escaped).not.toContain('>');\n expect(escaped).not.toContain('\\'');\n expect(escaped).not.toContain('/');\n expect(escaped).not.toContain('\\\"');\n\n escaped = escapeTextForBrowser('&');\n expect(escaped).toBe('&amp;');\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/escapeTextForBrowser-test\", module);\n",
"utils/__tests__/joinClasses-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\").dontMock('joinClasses');\n\nvar joinClasses = require(\"../../joinClasses\");\n\ndescribe('joinClasses', function() {\n\n it('should return a single className', function() {\n expect(joinClasses('aaa')).toEqual('aaa');\n });\n\n it('should join two classes together', function() {\n var aaa = 'aaa';\n var bbb = 'bbb';\n expect(joinClasses(aaa, bbb)).toEqual('aaa bbb');\n });\n\n it('should join many classes together', function() {\n var aaa = 'aaa';\n var bbb = 'bbb';\n var ccc = 'ccc';\n var ddd = 'ddd';\n var eee = 'eee';\n expect(joinClasses(aaa, bbb, ccc, ddd, eee)).toEqual('aaa bbb ccc ddd eee');\n });\n\n it('should omit undefined and empty classes', function() {\n var aaa = 'aaa';\n var bbb;\n var ccc = null;\n var ddd = '';\n var eee = 'eee';\n expect(joinClasses(bbb)).toEqual('');\n expect(joinClasses(bbb, bbb, bbb)).toEqual('');\n expect(joinClasses(aaa, bbb, ccc, ddd, eee)).toEqual('aaa eee');\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/joinClasses-test\", module);\n",
"utils/__tests__/keyMirror-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\").dontMock('keyMirror');\n\nvar keyMirror = require(\"../../keyMirror\");\n\ndescribe('keyMirror', function() {\n it('should create an object with values matching keys provided', function() {\n var mirror = keyMirror({\n foo: null,\n bar: true,\n \"baz\": { some: \"object\" },\n qux: undefined\n });\n expect('foo' in mirror).toBe(true);\n expect(mirror.foo).toBe('foo');\n expect('bar' in mirror).toBe(true);\n expect(mirror.bar).toBe('bar');\n expect('baz' in mirror).toBe(true);\n expect(mirror.baz).toBe('baz');\n expect('qux' in mirror).toBe(true);\n expect(mirror.qux).toBe('qux');\n });\n\n it('should not use properties from prototypes', function() {\n function Klass() {\n this.useMeToo = true;\n }\n Klass.prototype.doNotUse = true;\n var instance = new Klass();\n instance.useMe = true;\n\n var mirror = keyMirror(instance);\n\n expect('doNotUse' in mirror).toBe(false);\n expect('useMe' in mirror).toBe(true);\n expect('useMeToo' in mirror).toBe(true);\n });\n\n it('should throw when a non-object argument is used', function() {\n [null, undefined, 0, 7, ['uno'], true, \"string\"].forEach(function(testVal) {\n expect(keyMirror.bind(null, testVal)).toThrow();\n });\n });\n\n it('should work when \"constructor\" is a key', function() {\n var obj = { constructor: true };\n expect(keyMirror.bind(null, obj)).not.toThrow();\n var mirror = keyMirror(obj);\n expect('constructor' in mirror).toBe(true);\n });\n});\n\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/keyMirror-test\", module);\n",
"utils/__tests__/memoizeStringOnly-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\ndescribe('memoizeStringOnly', function() {\n var memoizeStringOnly;\n\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n memoizeStringOnly = require(\"../../memoizeStringOnly\");\n });\n\n it('should be transparent to callers', function() {\n var callback = function(string) {\n return string;\n };\n var memoized = memoizeStringOnly(callback);\n\n expect(memoized('foo'), callback('foo'));\n });\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/memoizeStringOnly-test\", module);\n",
"utils/__tests__/onlyChild-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n * @jsx React.DOM\n */\n\n\"use strict\";\n\ndescribe('onlyChild', function() {\n\n var React;\n var onlyChild;\n var WrapComponent;\n\n beforeEach(function() {\n React = require(\"../../React\");\n onlyChild = require(\"../../onlyChild\");\n WrapComponent = React.createClass({\n render: function() {\n return (\n React.DOM.div(null, \n onlyChild(this.props.children, this.props.mapFn, this)\n )\n );\n }\n });\n });\n\n it('should fail when passed two children', function() {\n expect(function() {\n var instance =\n WrapComponent(null, \n React.DOM.div(null ),\n React.DOM.span(null )\n );\n onlyChild(instance.props.children);\n }).toThrow();\n });\n\n it('should fail when passed nully values', function() {\n expect(function() {\n var instance =\n WrapComponent(null, \n null\n );\n onlyChild(instance.props.children);\n }).toThrow();\n\n expect(function() {\n var instance =\n WrapComponent(null, \n undefined\n );\n onlyChild(instance.props.children);\n }).toThrow();\n });\n\n it('should fail when key/value objects', function() {\n expect(function() {\n var instance =\n WrapComponent(null, \n {oneThing: React.DOM.span(null )}\n );\n onlyChild(instance.props.children);\n }).toThrow();\n });\n\n\n it('should not fail when passed interpolated single child', function() {\n expect(function() {\n var instance =\n WrapComponent(null, \n React.DOM.span(null )\n );\n onlyChild(instance.props.children);\n }).not.toThrow();\n });\n\n\n it('should return the only child', function() {\n expect(function() {\n var instance =\n WrapComponent(null, \n React.DOM.span(null )\n );\n onlyChild(instance.props.children);\n }).not.toThrow();\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/onlyChild-test\", module);\n",
"utils/__tests__/mergeFuncs-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n */\n\n\"use strict\";\n\nrequire(\"../../mock-modules\")\n .dontMock('mergeHelpers')\n .dontMock('merge')\n .dontMock('mergeDeep')\n .dontMock('mergeInto')\n .dontMock('mergeDeepInto');\n\nvar mergeHelpers;\nvar merge;\nvar mergeInto;\nvar mergeDeep;\nvar mergeDeepInto;\n\nvar isTerminal;\nvar MAX_MERGE_DEPTH;\n\n/**\n * Simple helper to traverse an object, calling the callback (cb) on every\n * nonTerminal node it finds. It stops once it reaches the maximum depth,\n * because we know that the merge functions shouldn't merge past that depth\n * anyways. If you don't \"stop\" once reaching the MAX_MERGE_DEPTH, there won't\n * be a practical way to traverse circular structures.\n */\nvar traverseUntilLeaves = function(obj, cb, depth) {\n if ((depth || 0) >= MAX_MERGE_DEPTH) {\n return;\n }\n var key;\n if (!isTerminal(obj) && !Array.isArray(obj)) {\n cb(obj);\n for (key in obj) {\n if (!obj.hasOwnProperty(key)) {\n continue;\n }\n traverseUntilLeaves(obj[key], cb, (depth || 0) + 1);\n }\n }\n};\n\n/*\n * Checks that the structure of two merged objects are identical. Checks\n * MAX_LEVEL because we don't want to block other unit tests if I have an\n * infinite loop.\n */\nvar MAX_LEVEL = 50;\nvar structureEquals = function(one, two, levelParam) {\n var level = levelParam || 0;\n var oneKey;\n var twoKey;\n if (level > MAX_LEVEL) {\n throw new Error('structure equals computation explored too many levels');\n }\n if (isTerminal(one) && isTerminal(two)) {\n return one === two;\n } else if (!isTerminal(one) && !isTerminal(two)) {\n var allInOneAreInTwo = true;\n for (oneKey in one) {\n if (!one.hasOwnProperty(oneKey)) {\n continue;\n }\n if (!structureEquals(one[oneKey], two[oneKey], level + 1)) {\n allInOneAreInTwo = false;\n }\n }\n var allInTwoAreInOne = true;\n for (twoKey in two) {\n if (!two.hasOwnProperty(twoKey)) {\n continue;\n }\n if (!structureEquals(two[twoKey], one[twoKey], level + 1)) {\n allInTwoAreInOne = false;\n }\n }\n // Sure, the computations overlap a bit.\n return allInOneAreInTwo && allInTwoAreInOne;\n } else {\n return false;\n }\n};\n\n\nvar makeCircular = function() {\n var obj = {};\n obj.self = obj;\n return obj;\n};\n\n\n\n/**\n * Not a symmetric function. Checks if there are any node references\n * (nonTerminal [non-string, non-null, etc]) that exist in inThis. See\n * sharesOnlyTerminalMemory.\n */\nvar hasNoNodeReferencesIn = function(obj, inThis) {\n traverseUntilLeaves(obj, function(nonTerm) {\n traverseUntilLeaves(inThis, function(inThisNonTerm) {\n if (inThisNonTerm === nonTerm) {\n return false;\n }\n });\n });\n return true;\n};\n\n/**\n * Checks that two objects share no memory references with each other (except\n * possibly at the terminal nodes (such as strings etc)). This is used to test\n * isolation of memory. When certain merge operations occur we need to ensure\n * that we did not leak references across objects.\n */\nvar sharesOnlyTerminalMemory = function(a, b) {\n return hasNoNodeReferencesIn(a, b) && hasNoNodeReferencesIn(b, a);\n};\n\n/**\n * Tests all of the merging functions. You provide it data that describes what\n * a deep merge looks like and what a shallow merge looks like. It will make\n * sure that various input/output contracts are adhered to, in addition to\n * ensuring that various guarantees about side-effects are upheld.\n * The test data must provide functions createOne/createTwo as a means to\n * create test data for objects one/two respsectively - each time these\n * functions must return pristine copies so that we can test for side effects\n * correctly.\n */\nvar testAllMerges = function(testData) {\n var createOne = testData.createOne;\n var createTwo = testData.createTwo;\n var one;\n var two;\n\n /*\n * Test merge()\n */\n one = createOne();\n two = createTwo();\n if (testData.mergeShouldThrow) {\n expect(function() {\n merge(one, two);\n }).toThrow();\n } else {\n var mergeRes = merge(one, two);\n if (testData.shallowResultShouldBe) {\n expect(structureEquals(\n mergeRes,\n testData.shallowResultShouldBe)\n ).toBe(true);\n }\n // Ensure the result is not the exact same object memory reference.\n expect(mergeRes === one).toBe(false);\n }\n\n /*\n * Test mergeInto()\n */\n one = createOne();\n two = createTwo();\n if (testData.mergeIntoShouldThrow) {\n expect(function() {\n mergeInto(one, two);\n }).toThrow();\n } else {\n var mergeIntoRes = mergeInto(one, two);\n if (testData.shallowResultShouldBe) {\n expect(structureEquals(\n one,\n testData.shallowResultShouldBe)\n ).toBe(true);\n }\n /*\n * Ensure it's the exact same object reference\n * TODO: We should ensure that for every object path p in one points to\n * the original object reference in one before the mutation.\n */\n expect(mergeIntoRes === undefined).toBe(true);\n }\n\n /*\n * Test mergeDeep()\n */\n one = createOne();\n two = createTwo();\n if (testData.mergeDeepShouldThrow) {\n expect(function() {\n mergeDeep(one, two, testData.arrayStrategy);\n }).toThrow();\n } else {\n var mergeDeepRes = mergeDeep(one, two, testData.arrayStrategy);\n if (testData.deepResultShouldBe) {\n expect(structureEquals(\n mergeDeepRes,\n testData.deepResultShouldBe)\n ).toBe(true);\n }\n expect(sharesOnlyTerminalMemory(mergeDeepRes, one)).toBe(true);\n expect(sharesOnlyTerminalMemory(mergeDeepRes, two)).toBe(true);\n }\n\n /*\n * Test mergeDeepInto()\n */\n one = createOne();\n two = createTwo();\n if (testData.mergeDeepIntoShouldThrow) {\n expect(function() {\n mergeDeepInto(one, two, testData.arrayStrategy);\n }).toThrow();\n } else {\n var mergeDeepIntoRes = mergeDeepInto(one, two, testData.arrayStrategy);\n expect(mergeDeepIntoRes).toBe(undefined);\n if (testData.deepResultShouldBe) {\n expect(structureEquals(\n one,\n testData.deepResultShouldBe)\n ).toBe(true);\n }\n expect(mergeDeepIntoRes === undefined).toBe(true);\n expect(sharesOnlyTerminalMemory(one, two)).toBe(true);\n }\n\n};\n\n/**\n * ReactTextWithEntities is not a React component, but rather a helper function\n * that returns an array. You can use that array as a helper function when\n * constructing a structure.\n */\ndescribe('mergeFuncs', function() {\n beforeEach(function() {\n require(\"../../mock-modules\").dumpCache();\n mergeHelpers = require(\"../../mergeHelpers\");\n merge = require(\"../../merge\");\n mergeInto = require(\"../../mergeInto\");\n mergeDeep = require(\"../../mergeDeep\");\n mergeDeepInto = require(\"../../mergeDeepInto\");\n isTerminal = mergeHelpers.isTerminal;\n MAX_MERGE_DEPTH = mergeHelpers.MAX_MERGE_DEPTH;\n });\n\n var twoLevelsDeep = function() {\n return {\n shallowObject: {\n deepObject: {\n a: 'a',\n b: 'b'\n },\n deepObject2: {\n one: 'one',\n two: 'two'\n }\n }\n };\n };\n\n it('should not throw if first argument is circular', function() {\n testAllMerges({\n createOne: makeCircular,\n createTwo: function() { return {thisOneIsNotCircular: true}; },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: false\n });\n });\n\n it('should throw if second argument is circular', function() {\n testAllMerges({\n createOne: function() { return {thisOneIsNotCircular: true}; },\n createTwo: makeCircular,\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n });\n\n it('should throw if something deep is circular in second param', function() {\n testAllMerges({\n createOne: function() { return {thisOneIsNotCircular: true}; },\n createTwo: function() {\n return {\n deeper: {\n deeper: makeCircular()\n }\n };\n },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n });\n\n it('should throw if something deep is circular in first param', function() {\n testAllMerges({\n createOne: function() {\n return {\n deeper: {\n deeper: makeCircular()\n }\n };\n },\n createTwo: function() { return {thisOneIsNotCircular: true}; },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: false\n });\n });\n\n\n it('should throw exceptions on invalid data/params', function() {\n testAllMerges({\n createOne: function() { return []; },\n createTwo: function() { return {}; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n testAllMerges({\n createOne: function() { return {}; },\n createTwo: function() { return []; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n testAllMerges({\n createOne: function() { return []; },\n createTwo: function() { return {hasDeepStructure: 'yes'}; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n testAllMerges({\n createOne: function() { return {hasDeepStructure: 'yes'}; },\n createTwo: function() { return []; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n testAllMerges({\n createOne: function() { return {hasDeepStructure: 'yes'}; },\n createTwo: function() { return []; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n /*\n * mergeInto functions do not accept an empty first parameter. There would\n * be nothing to mutate!\n */\n testAllMerges({\n createOne: function() { return null; },\n createTwo: function() { return {field: 'yes'}; },\n mergeIntoShouldThrow: true,\n mergeDeepIntoShouldThrow: true,\n shallowResultShouldBe: {field: 'yes'},\n deepResultShouldBe: {field: 'yes'}\n });\n testAllMerges({\n createOne: function() { return undefined; },\n createTwo: function() { return {field: 'yes'}; },\n mergeIntoShouldThrow: true,\n mergeDeepIntoShouldThrow: true,\n shallowResultShouldBe: {field: 'yes'},\n deepResultShouldBe: {field: 'yes'}\n });\n // Every merge function accepts an empty second parameter.\n testAllMerges({\n createOne: function() { return {field: 'yes'}; },\n createTwo: function() { return null; },\n shallowResultShouldBe: {field: 'yes'},\n deepResultShouldBe: {field: 'yes'}\n });\n testAllMerges({\n createOne: function() { return null; },\n createTwo: function() { return null; },\n deepResultShouldBe: {},\n shallowResultShouldBe: {},\n mergeIntoShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n testAllMerges({\n createOne: function() { return {field: 'yes'}; },\n createTwo: function() { return undefined; },\n shallowResultShouldBe: {field: 'yes'},\n deepResultShouldBe: {field: 'yes'}\n });\n testAllMerges({\n createOne: function() { return 0; },\n createTwo: function() { return {field: 'yes'}; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n /*\n * The fact that the second param is empty shouldn't change that we still\n * error on arrays.\n */\n testAllMerges({\n createOne: function() { return []; },\n createTwo: function() { return undefined; },\n mergeShouldThrow: true,\n mergeIntoShouldThrow: true,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n testAllMerges({\n createOne: function() { return {field: 'yes'}; },\n createTwo: function() { return null; },\n shallowResultShouldBe: {field: 'yes'},\n deepResultShouldBe: {field: 'yes'}\n });\n });\n\n\n it('should merge very deep objects correctly.',\n function() {\n testAllMerges({\n createOne: function() {\n return {\n shouldBeClobberedByNull: {\n color: 'blue'\n },\n shouldGetTwoFieldsWhenDeepMerge: {\n firstField: { color: 'red' }\n },\n shouldRemainUndefined: undefined,\n shouldRemainFour: 4,\n shouldRemainZero: 0,\n shouldBeClobberedByObj: 0\n };\n },\n createTwo: function() {\n return {\n shouldBeClobberedByNull: null,\n shouldGetTwoFieldsWhenDeepMerge: {\n secondField: { color: 'black' }\n },\n shouldBeClobberedByObj: { thisObj: true }\n };\n },\n shallowResultShouldBe: {\n shouldBeClobberedByNull: null,\n // only gets one field when merged shallowly\n shouldGetTwoFieldsWhenDeepMerge: {\n secondField: { color: 'black' }\n },\n shouldRemainUndefined: undefined,\n shouldRemainFour: 4,\n shouldRemainZero: 0,\n shouldBeClobberedByObj: { thisObj: true }\n },\n deepResultShouldBe: {\n shouldRemainUndefined: undefined,\n shouldRemainFour: 4,\n shouldRemainZero: 0,\n shouldBeClobberedByNull: null,\n shouldGetTwoFieldsWhenDeepMerge: {\n firstField: { color: 'red' },\n secondField: { color: 'black' }\n },\n shouldBeClobberedByObj: { thisObj: true }\n }\n });\n }\n );\n\n it(\n 'should not throw with one non-colliding arrays with no arrayStrategy',\n function() {\n testAllMerges({\n createOne: function() { return { hasDeepStructure: 'yes' }; },\n createTwo: function() { return { hasArrayDeeper: [] }; },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false,\n shallowResultShouldBe: {\n hasDeepStructure: 'yes',\n hasArrayDeeper: []\n },\n deepResultShouldBe: {\n hasDeepStructure: 'yes',\n hasArrayDeeper: []\n }\n });\n }\n );\n\n it(\n 'should not throw with two non-colliding arrays with no arrayStrategy',\n function() {\n testAllMerges({\n createOne: function() {\n return {\n arrayOne: [1]\n };\n },\n createTwo: function() {\n return {\n arrayTwo: [2]\n };\n },\n arrayStrategy: mergeHelpers.ArrayStrategies.Clobber,\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false\n });\n }\n ),\n\n it('should throw if no arrayStrategy supplied on Array merges', function() {\n testAllMerges({\n createOne: function() {\n return {\n arrayOne: [1]\n };\n },\n createTwo: function() {\n return {\n arrayOne: [9]\n };\n },\n shallowResultShouldBe: {\n arrayOne: [9]\n },\n // Doesn't throw on the shallow versions.\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: true,\n mergeDeepIntoShouldThrow: true\n });\n }),\n\n it('should not throw if never forced to merge two Arrays', function() {\n testAllMerges({\n createOne: function() {\n return {\n arrayOne: [1]\n };\n },\n createTwo: function() {\n return {\n arrayTwo: [9] // <-- See, never forced to merge with arrayOne\n };\n },\n shallowResultShouldBe: {\n arrayOne: [1],\n arrayTwo: [9]\n },\n // Doesn't throw on the shallow versions.\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false\n });\n }),\n\n it(\n 'should correctly deep merge Arrays with arrayStrategy clobber',\n function() {\n testAllMerges({\n createOne: function() {\n return {\n deep: {\n array: [1],\n nonArray: {\n hi: 'hi'\n }\n }\n };\n },\n createTwo: function() {\n return {\n deep: {\n array: [10,11, {deepFieldInArray: 'yes'}],\n nonArray: {\n bye: 'bye'\n }\n }\n };\n },\n shallowResultShouldBe: {\n deep: {\n array: [10,11, {deepFieldInArray: 'yes'}],\n nonArray: {\n bye: 'bye'\n }\n }\n },\n deepResultShouldBe: {\n deep: {\n array: [10,11, {deepFieldInArray: 'yes'}],\n nonArray: {\n hi: 'hi',\n bye: 'bye'\n }\n }\n },\n arrayStrategy: mergeHelpers.ArrayStrategies.Clobber,\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false\n });\n }\n ),\n\n\n it(\n 'should correctly deep merge Arrays with arrayStrategy indexByIndex',\n function() {\n testAllMerges({\n createOne: function() {\n return {\n deep: {\n array: [{\n atIndexZero: {\n indexZeroGreeting: 'You Are At Index Zero',\n indexZeroStatus: false\n }\n }]\n }\n };\n },\n createTwo: function() {\n return {\n deep: {\n array: [{\n atIndexZero: {\n indexZeroStatus: true,\n newFieldAtIndexZero: 'newField'\n }\n },\n {\n atIndexOne: {\n nothingOriginallyAtThisIndex: true\n }\n }]\n }\n };\n },\n shallowResultShouldBe: {\n deep: {\n array: [{\n atIndexZero: {\n indexZeroStatus: true,\n newFieldAtIndexZero: 'newField'\n }\n },\n {\n atIndexOne: {\n nothingOriginallyAtThisIndex: true\n }\n }]\n }\n },\n deepResultShouldBe: {\n deep: {\n array: [{\n atIndexZero: {\n indexZeroGreeting: 'You Are At Index Zero', // <-- See!?\n indexZeroStatus: true,\n newFieldAtIndexZero: 'newField'\n }\n },\n {\n atIndexOne: {\n nothingOriginallyAtThisIndex: true\n }\n }]\n }\n },\n arrayStrategy: mergeHelpers.ArrayStrategies.IndexByIndex,\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false\n }\n );\n }),\n\n it('should merge deep data correctly', function() {\n var mergeData = {\n shallowObject: {\n deepObject: {\n c: 'c',\n d: 'd'\n },\n deepObject2: {\n three: 'three',\n four: 'four'\n }\n }\n };\n var deepResult = {\n shallowObject: {\n deepObject: {\n a: 'a',\n b: 'b',\n c: 'c',\n d: 'd'\n },\n deepObject2: {\n one: 'one',\n two: 'two',\n three: 'three',\n four: 'four'\n }\n }\n };\n var shallowResult = mergeData; // The same\n\n testAllMerges({\n createOne: function() { return twoLevelsDeep(); },\n createTwo: function() { return mergeData; },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false,\n deepResultShouldBe: deepResult,\n shallowResultShouldBe: shallowResult\n });\n });\n\n it('should fill in complementing regions of data trees', function() {\n var mergeData = {\n shallowObject: {\n newDepth: {\n hello: 'goodbye'\n }\n }\n };\n var deepResult = {\n shallowObject: {\n deepObject: {\n a: 'a',\n b: 'b'\n },\n deepObject2: {\n one: 'one',\n two: 'two'\n },\n // This is added!\n newDepth: {\n hello: 'goodbye'\n }\n }\n };\n var shallowResult = mergeData; // The same\n\n testAllMerges({\n createOne: function() { return twoLevelsDeep(); },\n createTwo: function() { return mergeData; },\n // The deep merge of the two\n deepResultShouldBe: deepResult,\n shallowResultShouldBe: shallowResult\n });\n });\n\n /**\n * Arrays and Objects wipe out terminals (and vice versa).\n */\n it('should clobber terminals with objects/arrays vice versa', function() {\n var makeOne = function() {\n return {\n thisFieldDoesNothing: {},\n deep: {\n // Objects\n thisShouldSwitchFromObjectToTerminal: {hello: 'goodbye'},\n thisShouldSwitchFromTerminalToObject: 'yes',\n\n // Arrays\n thisShouldSwitchFromArrayToTerminal: ['goodbye'],\n thisShouldSwitchFromTerminalToArray: 'yes'\n }\n };\n };\n var makeTwo = function() {\n return {\n deep: {\n // Objects\n thisShouldSwitchFromObjectToTerminal: 'terminal',\n thisShouldSwitchFromTerminalToObject: {nowItsAnObject: 'yay'},\n\n // Arrays\n thisShouldSwitchFromArrayToTerminal: 'terminal',\n thisShouldSwitchFromTerminalToArray: ['yay']\n }\n };\n };\n var deepResult = {\n thisFieldDoesNothing: {\n\n },\n deep: {\n // Objects\n thisShouldSwitchFromObjectToTerminal: 'terminal',\n thisShouldSwitchFromTerminalToObject: {nowItsAnObject: 'yay'},\n\n // Arrays\n thisShouldSwitchFromArrayToTerminal: 'terminal',\n thisShouldSwitchFromTerminalToArray: ['yay']\n }\n };\n\n testAllMerges({\n createOne: makeOne,\n createTwo: makeTwo,\n deepResultShouldBe: deepResult, // The deep merge of the two\n shallowResultShouldBe: deepResult // The same this time.\n });\n });\n\n /**\n * Arrays wipe out Objects and Objects wipe out Arrays.\n */\n it('should clobber terminals with objects/arrays vice versa', function() {\n var makeOne = function() {\n return {\n thisFieldDoesNothing: {},\n deep: {\n thisShouldSwitchFromObjectToArray: {hello: 'goodbye'},\n thisShouldSwitchFromArrayToObject: [1,2,3]\n }\n };\n };\n var makeTwo = function() {\n return {\n deep: {\n thisShouldSwitchFromObjectToArray: [7,8,9],\n thisShouldSwitchFromArrayToObject: {iUsedToBeAnArray:true}\n }\n };\n };\n var deepResult = {\n thisFieldDoesNothing: {},\n deep: {\n thisShouldSwitchFromObjectToArray: [7,8,9],\n thisShouldSwitchFromArrayToObject: {iUsedToBeAnArray:true}\n }\n };\n\n testAllMerges({\n createOne: makeOne,\n createTwo: makeTwo,\n deepResultShouldBe: deepResult, // The deep merge of the two\n shallowResultShouldBe: deepResult // The same this time.\n });\n });\n\n it(\n 'should not clobber terminals/objects/arrays that are not over-written',\n function() {\n testAllMerges({\n createOne: function() {\n return {\n deep: {\n terminal: 'I am a terminal',\n object: {iAmAnObject: true},\n array: [1,2,3]\n }\n };\n },\n createTwo: function() {\n return {\n deep: {\n completelyDifferentField: 'no collision here!'\n }\n };\n },\n shallowResultShouldBe: {\n deep: {\n completelyDifferentField: 'no collision here!'\n }\n },\n deepResultShouldBe: {\n deep: {\n completelyDifferentField: 'no collision here!',\n terminal: 'I am a terminal',\n object: {iAmAnObject: true},\n array: [1,2,3]\n }\n },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false\n }\n );\n }),\n\n it('should correctly clobber terminals with cloned arrays', function() {\n testAllMerges({\n createOne: function() {\n return {\n deep: {\n changesFromTermToArray: 'I am a terminal'\n }\n };\n },\n createTwo: function() {\n return {\n deep: {\n changesFromTermToArray: ['I', 'am', 'an', 'array']\n }\n };\n },\n shallowResultShouldBe: {\n deep: {\n changesFromTermToArray: ['I', 'am', 'an', 'array']\n }\n },\n deepResultShouldBe: {\n deep: {\n changesFromTermToArray: ['I', 'am', 'an', 'array']\n }\n },\n mergeShouldThrow: false,\n mergeIntoShouldThrow: false,\n mergeDeepShouldThrow: false,\n mergeDeepIntoShouldThrow: false\n });\n }),\n\n it('should detect terminals correctly in merge* functions', function() {\n var boolResFalse = isTerminal(false);\n expect(boolResFalse).toBe(true);\n\n var boolResTrue = isTerminal(true);\n expect(boolResTrue).toBe(true);\n\n var numRes = isTerminal(123);\n expect(numRes).toBe(true);\n\n var zeroRes = isTerminal(0);\n expect(zeroRes).toBe(true);\n\n var stringRes = isTerminal('i am a string');\n expect(stringRes).toBe(true);\n\n var objLiteralRes = isTerminal({somethingHere: true});\n expect(objLiteralRes).toBe(false);\n\n var undefRes = isTerminal(undefined);\n expect(undefRes).toBe(true);\n\n var nullRes = isTerminal(null);\n expect(nullRes).toBe(true);\n\n var arrRes = isTerminal([]);\n expect(arrRes).toBe(false);\n });\n});\n\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/mergeFuncs-test\", module);\n",
"utils/__tests__/sliceChildren-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n * @jsx React.DOM\n */\n\n\"use strict\";\n\ndescribe('sliceChildren', function() {\n\n var React;\n var ReactTestUtils;\n\n var sliceChildren;\n var reactComponentExpect;\n\n var Partial;\n\n beforeEach(function() {\n React = require(\"../../React\");\n ReactTestUtils = require(\"../../ReactTestUtils\");\n\n sliceChildren = require(\"../../sliceChildren\");\n reactComponentExpect = require(\"../../reactComponentExpect\");\n\n Partial = React.createClass({\n render: function() {\n return (\n React.DOM.div(null, \n sliceChildren(\n this.props.children,\n this.props.start,\n this.props.end\n )\n )\n );\n }\n });\n });\n\n function renderAndSlice(set, start, end) {\n var instance = Partial( {start:start, end:end}, set);\n ReactTestUtils.renderIntoDocument(instance);\n var rendered = reactComponentExpect(instance)\n .expectRenderedChild()\n .instance();\n return rendered.props.children;\n }\n\n it('should render the whole set if start zero is supplied', function() {\n var fullSet = [\n React.DOM.div( {key:\"A\"} ),\n React.DOM.div( {key:\"B\"} ),\n React.DOM.div( {key:\"C\"} )\n ];\n var children = renderAndSlice(fullSet, 0);\n expect(children).toEqual({\n '{A}': fullSet[0],\n '{B}': fullSet[1],\n '{C}': fullSet[2]\n });\n });\n\n it('should render the remaining set if no end index is supplied', function() {\n var fullSet = [\n React.DOM.div( {key:\"A\"} ),\n React.DOM.div( {key:\"B\"} ),\n React.DOM.div( {key:\"C\"} )\n ];\n var children = renderAndSlice(fullSet, 1);\n expect(children).toEqual({\n '{B}': fullSet[1],\n '{C}': fullSet[2]\n });\n });\n\n it('should exclude everything at or after the end index', function() {\n var fullSet = [\n React.DOM.div( {key:\"A\"} ),\n React.DOM.div( {key:\"B\"} ),\n React.DOM.div( {key:\"C\"} ),\n React.DOM.div( {key:\"D\"} )\n ];\n var children = renderAndSlice(fullSet, 1, 2);\n expect(children).toEqual({\n '{B}': fullSet[1]\n });\n });\n\n it('should allow static children to be sliced', function() {\n var a = React.DOM.div(null );\n var b = React.DOM.div(null );\n var c = React.DOM.div(null );\n\n var instance = Partial( {start:1, end:2}, a,b,c);\n ReactTestUtils.renderIntoDocument(instance);\n var rendered = reactComponentExpect(instance)\n .expectRenderedChild()\n .instance();\n\n expect(rendered.props.children).toEqual({\n '[1]': b\n });\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/sliceChildren-test\", module);\n",
"utils/__tests__/traverseAllChildren-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @emails react-core\n * @jsx React.DOM\n */\n\n\"use strict\";\n\ndescribe('traverseAllChildren', function() {\n var traverseAllChildren;\n var React;\n beforeEach(function() {\n traverseAllChildren = require(\"../../traverseAllChildren\");\n React = require(\"../../React\");\n });\n\n\n it('should support identity for simple', function() {\n var traverseContext = [];\n var traverseFn =\n jasmine.createSpy().andCallFake(function (context, kid, key, index) {\n context.push(true);\n });\n\n var simpleKid = React.DOM.span( {key:\"simple\"} );\n\n // Jasmine doesn't provide a way to test that the fn was invoked with scope.\n var instance = React.DOM.div(null, simpleKid);\n traverseAllChildren(instance.props.children, traverseFn, traverseContext);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n simpleKid,\n '{simple}',\n 0\n );\n expect(traverseContext.length).toEqual(1);\n });\n\n it('should treat single arrayless child as being in array', function() {\n var traverseContext = [];\n var traverseFn =\n jasmine.createSpy().andCallFake(function (context, kid, key, index) {\n context.push(true);\n });\n\n var simpleKid = React.DOM.span(null );\n var instance = React.DOM.div(null, simpleKid);\n traverseAllChildren(instance.props.children, traverseFn, traverseContext);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n simpleKid,\n '[0]',\n 0\n );\n expect(traverseContext.length).toEqual(1);\n });\n\n it('should treat single child in array as expected', function() {\n var traverseContext = [];\n var traverseFn =\n jasmine.createSpy().andCallFake(function (context, kid, key, index) {\n context.push(true);\n });\n\n var simpleKid = React.DOM.span(null );\n var instance = React.DOM.div(null, [simpleKid]);\n traverseAllChildren(instance.props.children, traverseFn, traverseContext);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n simpleKid,\n '[0]',\n 0\n );\n expect(traverseContext.length).toEqual(1);\n });\n\n it('should be called for each child', function() {\n var zero = React.DOM.div( {key:\"keyZero\"} );\n var one = null;\n var two = React.DOM.div( {key:\"keyTwo\"} );\n var three = null;\n var four = React.DOM.div( {key:\"keyFour\"} );\n\n var traverseContext = [];\n var traverseFn =\n jasmine.createSpy().andCallFake(function (context, kid, key, index) {\n context.push(true);\n });\n\n var instance = (\n React.DOM.div(null, \n zero,\n one,\n two,\n three,\n four\n )\n );\n\n traverseAllChildren(instance.props.children, traverseFn, traverseContext);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n zero,\n '{keyZero}',\n 0\n );\n expect(traverseFn).toHaveBeenCalledWith(traverseContext, one, '[1]', 1);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n two,\n '{keyTwo}',\n 2\n );\n expect(traverseFn).toHaveBeenCalledWith(traverseContext, three, '[3]', 3);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n four,\n '{keyFour}',\n 4\n );\n });\n\n // Todo: test that nums/strings are converted to ReactComponents.\n\n it('should be called for each child in nested structure', function() {\n var zero = React.DOM.div( {key:\"keyZero\"} );\n var one = null;\n var two = React.DOM.div( {key:\"keyTwo\"} );\n var three = null;\n var four = React.DOM.div( {key:\"keyFour\"} );\n var five = React.DOM.div( {key:\"keyFiveCompletelyIgnored\"} );\n // Name precedence is as follows:\n // 1. JavaScript Object key if in a JavaScript object:\n // 2. If grouped in an Array, the `key` attribute.\n // 3. The array index if in a JavaScript Array.\n\n\n var traverseContext = [];\n var traverseFn =\n jasmine.createSpy().andCallFake(function (context, kid, key, index) {\n context.push(true);\n });\n\n var instance = (\n React.DOM.div(null, \n [{\n firstHalfKey: [zero, one, two],\n secondHalfKey: [three, four],\n keyFive: five\n }]\n )\n );\n\n traverseAllChildren(instance.props.children, traverseFn, traverseContext);\n expect(traverseFn.calls.length).toBe(6);\n expect(traverseContext.length).toEqual(6);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n zero,\n '[0]{firstHalfKey}{keyZero}',\n 0\n );\n\n expect(traverseFn)\n .toHaveBeenCalledWith(traverseContext, one, '[0]{firstHalfKey}[1]', 1);\n\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n two,\n '[0]{firstHalfKey}{keyTwo}',\n 2\n );\n\n expect(traverseFn)\n .toHaveBeenCalledWith(traverseContext, three, '[0]{secondHalfKey}[0]', 3);\n\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n four,\n '[0]{secondHalfKey}{keyFour}',\n 4\n );\n\n expect(traverseFn)\n .toHaveBeenCalledWith(traverseContext, five, '[0]{keyFive}', 5);\n });\n\n it('should retain key across two mappings', function() {\n var zeroForceKey = React.DOM.div( {key:\"keyZero\"} );\n var oneForceKey = React.DOM.div( {key:\"keyOne\"} );\n var traverseContext = [];\n var traverseFn =\n jasmine.createSpy().andCallFake(function (context, kid, key, index) {\n context.push(true);\n });\n\n var forcedKeys = (\n React.DOM.div(null, \n zeroForceKey,\n oneForceKey\n )\n );\n\n traverseAllChildren(forcedKeys.props.children, traverseFn, traverseContext);\n expect(traverseContext.length).toEqual(2);\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n zeroForceKey,\n '{keyZero}',\n 0\n );\n expect(traverseFn).toHaveBeenCalledWith(\n traverseContext,\n oneForceKey,\n '{keyOne}',\n 1\n );\n });\n\n});\n\nrequire(\"../../mock-modules\").register(\"utils/__tests__/traverseAllChildren-test\", module);\n",
"vendor/error/__tests__/erx-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Copyright 2004-present Facebook. All Rights Reserved.\n *\n * @emails catchen@fb.com\n * @emails javascript@lists.facebook.com\n */\n\nrequire(\"../../../mock-modules\")\n .dontMock('erx')\n .dontMock('ex');\n\ndescribe('erx', function() {\n var erx = require(\"../../../erx\");\n var ex = require(\"../../../ex\");\n\n it('should always reverse ex if placeholder and argument match', function() {\n expect(erx(ex('zero argument'))).toEqual(['zero argument']);\n expect(erx(ex('one argument: %s', 'one')))\n .toEqual(['one argument: %s', 'one']);\n expect(erx(ex('two arguments: %s, %s', 'one', 2)))\n .toEqual(['two arguments: %s, %s', 'one', '2']);\n expect(erx(ex('three arguments: %s, %s, %s', 'one', 2, { value: 3 })))\n .toEqual(['three arguments: %s, %s, %s', 'one', '2', '[object Object]']);\n });\n\n it('should be idempotent', function() {\n var messageWithParams = erx(ex('one argument: %s', 'one'));\n expect(messageWithParams).toEqual(erx(messageWithParams));\n });\n\n it('should treat plain text as it was ex-ed with no argument', function() {\n expect(erx('plain text')).toEqual(['plain text']);\n });\n\n it('should work when text was appended/prepended to ex-ed text', function() {\n expect(erx('prepended text|' + ex('zero argument') + '|appended text'))\n .toEqual(['prepended text|zero argument|appended text']);\n expect(erx(\n 'prepended text|' +\n ex('one argument: %s', 'one') +\n '|appended text'\n )).toEqual(['prepended text|one argument: %s|appended text', 'one']);\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"vendor/error/__tests__/erx-test\", module);\n",
"vendor/error/__tests__/ex-test":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Copyright 2004-present Facebook. All Rights Reserved.\n *\n * @emails catchen@fb.com\n * @emails javascript@lists.facebook.com\n */\n\nrequire(\"../../../mock-modules\")\n .dontMock('ex');\n\ndescribe('ex', function() {\n var ex = require(\"../../../ex\");\n\n it('should convert whatever arguments into one string', function() {\n expect(typeof ex('zero argument')).toEqual('string');\n expect(typeof ex('one argument: %s', 'one')).toEqual('string');\n expect(typeof ex('two arguments: %s, %s', 'one', 2))\n .toEqual('string');\n expect(typeof ex('three arguments: %s, %s, %s', 'one', 2, { value: 3 }))\n .toEqual('string');\n });\n\n it('should handle placeholder and argument number mismatch', function() {\n expect(typeof ex('zero placeholder and one argument', 'one'))\n .toEqual('string');\n expect(typeof ex('one placeholder and zero argument: %s'))\n .toEqual('string');\n });\n});\n\nrequire(\"../../../mock-modules\").register(\"vendor/error/__tests__/ex-test\", module);\n",
"test/phantomjs-shims":"(function() {\n\nvar Ap = Array.prototype;\nvar slice = Ap.slice;\nvar Fp = Function.prototype;\n\nif (!Fp.bind) {\n // PhantomJS doesn't support Function.prototype.bind natively, so\n // polyfill it whenever this module is required.\n Fp.bind = function(context) {\n var func = this;\n var args = slice.call(arguments, 1);\n\n function bound() {\n var invokedAsConstructor = func.prototype && (this instanceof func);\n return func.apply(\n // Ignore the context parameter when invoking the bound function\n // as a constructor. Note that this includes not only constructor\n // invocations using the new keyword but also calls to base class\n // constructors such as BaseClass.call(this, ...) or super(...).\n !invokedAsConstructor && context || this,\n args.concat(slice.call(arguments))\n );\n }\n\n // The bound function must share the .prototype of the unbound\n // function so that any object created by one constructor will count\n // as an instance of both constructors.\n bound.prototype = func.prototype;\n\n return bound;\n };\n}\n\n})();\n\nrequire(\"../mock-modules\").register(\"test/phantomjs-shims\", module);\n",
"ReactTestUtils":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactTestUtils\n */\n\nvar EventConstants = require(\"./EventConstants\");\nvar React = require(\"./React\");\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar ReactTextComponent = require(\"./ReactTextComponent\");\nvar ReactMount = require(\"./ReactMount\");\n\nvar mergeInto = require(\"./mergeInto\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nfunction Event(suffix) {}\n\n/**\n * @class ReactTestUtils\n */\n\n/**\n * Todo: Support the entire DOM.scry query syntax. For now, these simple\n * utilities will suffice for testing purposes.\n * @lends ReactTestUtils\n */\nvar ReactTestUtils = {\n renderIntoDocument: function(instance) {\n var div = document.createElement('div');\n document.documentElement.appendChild(div);\n return React.renderComponent(instance, div);\n },\n\n isComponentOfType: function(inst, type) {\n return !!(\n inst &&\n ReactComponent.isValidComponent(inst) &&\n inst.constructor === type.componentConstructor\n );\n },\n\n isDOMComponent: function(inst) {\n return !!(inst &&\n ReactComponent.isValidComponent(inst) &&\n !!inst.tagName);\n },\n\n isCompositeComponent: function(inst) {\n return !!(\n inst &&\n ReactComponent.isValidComponent(inst) &&\n typeof inst.render === 'function' &&\n typeof inst.setState === 'function' &&\n typeof inst.updateComponent === 'function'\n );\n },\n\n isCompositeComponentWithType: function(inst, type) {\n return !!(ReactTestUtils.isCompositeComponent(inst) &&\n (inst.constructor === type.componentConstructor ||\n inst.constructor === type));\n },\n\n isTextComponent: function(inst) {\n return inst instanceof ReactTextComponent;\n },\n\n findAllInRenderedTree: function(inst, test) {\n if (!inst) {\n return [];\n }\n var ret = test(inst) ? [inst] : [];\n if (ReactTestUtils.isDOMComponent(inst)) {\n var renderedChildren = inst._renderedChildren;\n var key;\n for (key in renderedChildren) {\n if (!renderedChildren.hasOwnProperty(key)) {\n continue;\n }\n ret = ret.concat(\n ReactTestUtils.findAllInRenderedTree(renderedChildren[key], test)\n );\n }\n } else if (ReactTestUtils.isCompositeComponent(inst)) {\n ret = ret.concat(\n ReactTestUtils.findAllInRenderedTree(inst._renderedComponent, test)\n );\n }\n return ret;\n },\n\n /**\n * Finds all instance of components in the rendered tree that are DOM\n * components with the class name matching `className`.\n * @return an array of all the matches.\n */\n scryRenderedDOMComponentsWithClass: function(root, className) {\n return ReactTestUtils.findAllInRenderedTree(root, function(inst) {\n var instClassName = inst.props.className;\n return ReactTestUtils.isDOMComponent(inst) && (\n instClassName &&\n (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1\n );\n });\n },\n\n /**\n * Like scryRenderedDOMComponentsWithClass but expects there to be one result,\n * and returns that one result, or throws exception if there is any other\n * number of matches besides one.\n * @return {!ReactDOMComponent} The one match.\n */\n findRenderedDOMComponentWithClass: function(root, className) {\n var all =\n ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);\n if (all.length !== 1) {\n throw new Error('Did not find exactly one match for class:' + className);\n }\n return all[0];\n },\n\n\n /**\n * Finds all instance of components in the rendered tree that are DOM\n * components with the tag name matching `tagName`.\n * @return an array of all the matches.\n */\n scryRenderedDOMComponentsWithTag: function(root, tagName) {\n return ReactTestUtils.findAllInRenderedTree(root, function(inst) {\n return ReactTestUtils.isDOMComponent(inst) &&\n inst.tagName === tagName.toUpperCase();\n });\n },\n\n /**\n * Like scryRenderedDOMComponentsWithTag but expects there to be one result,\n * and returns that one result, or throws exception if there is any other\n * number of matches besides one.\n * @return {!ReactDOMComponent} The one match.\n */\n findRenderedDOMComponentWithTag: function(root, tagName) {\n var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);\n if (all.length !== 1) {\n throw new Error('Did not find exactly one match for tag:' + tagName);\n }\n return all[0];\n },\n\n\n /**\n * Finds all instances of components with type equal to `componentType`.\n * @return an array of all the matches.\n */\n scryRenderedComponentsWithType: function(root, componentType) {\n return ReactTestUtils.findAllInRenderedTree(root, function(inst) {\n return ReactTestUtils.isCompositeComponentWithType(inst, componentType);\n });\n },\n\n /**\n * Same as `scryRenderedComponentsWithType` but expects there to be one result\n * and returns that one result, or throws exception if there is any other\n * number of matches besides one.\n * @return {!ReactComponent} The one match.\n */\n findRenderedComponentWithType: function(root, componentType) {\n var all = ReactTestUtils.scryRenderedComponentsWithType(\n root,\n componentType\n );\n if (all.length !== 1) {\n throw new Error(\n 'Did not find exactly one match for componentType:' + componentType\n );\n }\n return all[0];\n },\n\n /**\n * Simulates a top level event being dispatched from a raw event that occured\n * on and `Element` node.\n * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`\n * @param {!Element} node The dom to simulate an event occurring on.\n * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.\n */\n simulateEventOnNode: function(topLevelType, node, fakeNativeEvent) {\n var virtualHandler =\n ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback(\n topLevelType\n );\n fakeNativeEvent.target = node;\n virtualHandler(fakeNativeEvent);\n },\n\n /**\n * Simulates a top level event being dispatched from a raw event that occured\n * on the `ReactDOMComponent` `comp`.\n * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.\n * @param comp {!ReactDOMComponent}\n * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.\n */\n simulateEventOnDOMComponent: function(topLevelType, comp, fakeNativeEvent) {\n var reactRootID = comp._rootNodeID || comp._rootDomId;\n if (!reactRootID) {\n throw new Error('Simulating event on non-rendered component');\n }\n var virtualHandler =\n ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback(\n topLevelType\n );\n var node = ReactMount.getNode(reactRootID);\n fakeNativeEvent.target = node;\n /* jsdom is returning nodes without id's - fixing that issue here. */\n ReactMount.setID(node, reactRootID);\n virtualHandler(fakeNativeEvent);\n },\n\n nativeTouchData: function(x, y) {\n return {\n touches: [\n {pageX: x, pageY: y}\n ]\n };\n },\n\n Simulate: null // Will populate\n};\n\n/**\n * Exports:\n *\n * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`\n * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`\n * - `ReactTestUtils.Simulate.mouseIn/ReactDOMComponent)`\n * - `ReactTestUtils.Simulate.mouseOut(Element/ReactDOMComponent)`\n * - ... (All keys from `EventConstants.topLevelTypes`)\n *\n * Note: Top level event types are a subset of the entire set of handler types\n * (which include a broader set of \"synthetic\" events). For example, onDragDone\n * is a synthetic event. You certainly may write test cases for these event\n * types, but it doesn't make sense to simulate them at this low of a level. In\n * this case, the way you test an `onDragDone` event is by simulating a series\n * of `mouseMove`/ `mouseDown`/`mouseUp` events - Then, a synthetic event of\n * type `onDragDone` will be constructed and dispached through your system\n * automatically.\n */\n\nfunction makeSimulator(eventType) {\n return function(domComponentOrNode, nativeEventData) {\n var fakeNativeEvent = new Event(eventType);\n mergeInto(fakeNativeEvent, nativeEventData);\n if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {\n ReactTestUtils.simulateEventOnDOMComponent(\n eventType,\n domComponentOrNode,\n fakeNativeEvent\n );\n } else if (!!domComponentOrNode.tagName) {\n // Will allow on actual dom nodes.\n ReactTestUtils.simulateEventOnNode(\n eventType,\n domComponentOrNode,\n fakeNativeEvent\n );\n }\n };\n}\n\nReactTestUtils.Simulate = {};\nvar eventType;\nfor (eventType in topLevelTypes) {\n // Event type is stored as 'topClick' - we transform that to 'click'\n var convenienceName = eventType.indexOf('top') === 0 ?\n eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;\n /**\n * @param {!Element || ReactDOMComponent} domComponentOrNode\n * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.\n */\n ReactTestUtils.Simulate[convenienceName] = makeSimulator(eventType);\n}\n\nmodule.exports = ReactTestUtils;\n\nrequire(\"./mock-modules\").register(\"ReactTestUtils\", module);\n",
"reactComponentExpect":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule reactComponentExpect\n * @nolint\n */\n\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactTestUtils = require(\"./ReactTestUtils\");\n\nvar mergeInto = require(\"./mergeInto\");\n\nfunction reactComponentExpect(instance) {\n if (instance instanceof reactComponentExpect) {\n return instance;\n }\n\n if (!(this instanceof reactComponentExpect)) {\n return new reactComponentExpect(instance);\n }\n\n this._instance = instance;\n this.toBeValidReactComponent();\n}\n\nmergeInto(reactComponentExpect.prototype, {\n // Getters -------------------------------------------------------------------\n\n /**\n * @instance: Retrieves the backing instance.\n */\n instance: function() {\n return this._instance;\n },\n\n /**\n * There are two types of components in the world.\n * - A component created via React.createClass() - Has a single child\n * subComponent - the return value from the .render() function. This\n * function @subComponent expects that this._instance is component created\n * with React.createClass().\n * - A primitive DOM component - which has many renderedChildren, each of\n * which may have a name that is unique with respect to its siblings. This\n * method will fail if this._instance is a primitive component.\n *\n * TL;DR: An instance may have a subComponent (this._renderedComponent) or\n * renderedChildren, but never both. Neither will actually show up until you\n * render the component (simply instantiating is not enough).\n */\n expectRenderedChild: function() {\n this.toBeCompositeComponent();\n return new reactComponentExpect(this.instance()._renderedComponent);\n },\n\n /**\n * The nth child of a DOMish component instance that is not falsy.\n */\n expectRenderedChildAt: function(childIndex) {\n // Currently only dom components have arrays of children, but that will\n // change soon.\n this.toBeDOMComponent();\n var renderedChildren = this.instance()._renderedChildren || {};\n var nonEmptyCount = 0;\n var name;\n for (name in renderedChildren) {\n if (!renderedChildren.hasOwnProperty(name)) {\n continue;\n }\n if (renderedChildren[name]) {\n if (nonEmptyCount === childIndex) {\n return new reactComponentExpect(renderedChildren[name]);\n }\n nonEmptyCount++;\n }\n }\n throw new Error('Child:' + childIndex + ' is not found');\n },\n\n toBeDOMComponentWithChildCount: function(n) {\n this.toBeDOMComponent();\n expect(this.instance()._renderedChildren).toBeTruthy();\n var len = Object.keys(this.instance()._renderedChildren).length;\n expect(len).toBe(n);\n return this;\n },\n\n toBeDOMComponentWithNoChildren: function() {\n this.toBeDOMComponent();\n expect(this.instance()._renderedChildren).toBeFalsy();\n return this;\n },\n\n // Matchers ------------------------------------------------------------------\n\n toBeComponentOfType: function(convenienceConstructor) {\n expect(ReactTestUtils.isComponentOfType(\n this.instance(),\n convenienceConstructor\n )).toBe(true);\n return this;\n },\n\n /**\n * A component that is created with React.createClass. Just duck typing\n * here.\n */\n toBeCompositeComponent: function() {\n this.toBeValidReactComponent();\n expect(ReactTestUtils.isCompositeComponent(this.instance())).toBe(true);\n return this;\n },\n\n toBeCompositeComponentWithType: function(convenienceConstructor) {\n expect(ReactTestUtils.isCompositeComponentWithType(\n this.instance(),\n convenienceConstructor\n )).toBe(true);\n return this;\n },\n\n toBeTextComponent: function() {\n expect(ReactTestUtils.isTextComponent(this.instance())).toBe(true);\n return this;\n },\n\n /**\n * Falsy values are valid components - the vanished component that is.\n */\n toBeValidReactComponent: function() {\n expect(ReactComponent.isValidComponent(this.instance())).toBe(true);\n return this;\n },\n\n toBePresent: function() {\n expect(this.instance()).toBeTruthy();\n return this;\n },\n\n /**\n * A terminal type of component representing some virtual dom node. Just duck\n * typing here.\n */\n toBeDOMComponent: function() {\n expect(ReactTestUtils.isDOMComponent(this.instance())).toBe(true);\n return this;\n },\n\n /**\n * @deprecated\n * @see toBeComponentOfType\n */\n toBeDOMComponentWithTag: function(tag) {\n this.toBeDOMComponent();\n expect(this.instance().tagName).toBe(tag.toUpperCase());\n return this;\n },\n\n /**\n * Check that internal state values are equal to a state of expected values.\n */\n scalarStateEqual: function(stateNameToExpectedValue) {\n expect(this.instance()).toBeTruthy();\n for (var stateName in stateNameToExpectedValue) {\n if (!stateNameToExpectedValue.hasOwnProperty(stateName)) {\n continue;\n }\n expect(this.instance().state[stateName])\n .toEqual(stateNameToExpectedValue[stateName]);\n }\n return this;\n },\n\n /**\n * Check a set of props are equal to a set of expected values - only works\n * with scalars.\n */\n scalarPropsEqual: function(propNameToExpectedValue) {\n expect(this.instance()).toBeTruthy();\n for (var propName in propNameToExpectedValue) {\n if (!propNameToExpectedValue.hasOwnProperty(propName)) {\n continue;\n }\n expect(this.instance().props[propName])\n .toEqual(propNameToExpectedValue[propName]);\n }\n return this;\n }\n});\n\nmodule.exports = reactComponentExpect;\n\nrequire(\"./mock-modules\").register(\"reactComponentExpect\", module);\n",
"mocks":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mocks\n */\n\nfunction isA(typeName, value) {\n return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';\n}\n\nfunction getType(ref) {\n if (isA('RegExp', ref)) {\n return 'regexp';\n }\n\n if (isA('Array', ref)) {\n return 'array';\n }\n\n if (isA('Function', ref)) {\n return 'function';\n }\n\n if (isA('Object', ref)) {\n return 'object';\n }\n\n // consider number and string fields to be constants that we want to\n // pick up as they are\n if (isA('Number', ref) || isA('String', ref)) {\n return 'constant';\n }\n\n return null;\n}\n\nfunction makeComponent(metadata) {\n switch (metadata.type) {\n case 'object':\n return {};\n\n case 'array':\n return [];\n\n case 'regexp':\n return new RegExp();\n\n case 'constant':\n return metadata.value;\n\n case 'function':\n var defaultReturnValue;\n var specificReturnValues = [];\n var mockImpl;\n var isReturnValueLastSet = false;\n var calls = [];\n var instances = [];\n var prototype =\n (metadata.members && metadata.members.prototype &&\n metadata.members.prototype.members) || {};\n\n var f = function() {\n global.dirtyMocks.push(f);\n\n instances.push(this);\n calls.push(Array.prototype.slice.call(arguments));\n if (this instanceof arguments.callee) {\n // This is probably being called as a constructor\n for (var slot in prototype) {\n // Copy prototype methods to the instance to make\n // it easier to interact with mock instance call and\n // return values\n if (prototype[slot].type == 'function') {\n var protoImpl = this[slot];\n this[slot] = generateFromMetadata(prototype[slot]);\n this[slot]._protoImpl = protoImpl;\n }\n }\n\n // Run the mock constructor implementation\n mockImpl && mockImpl.apply(this, arguments);\n return;\n }\n\n var returnValue;\n // If return value is last set, either specific or default, i.e.\n // mockReturnValue()/mockDefaultReturnValue() is called and no\n // mockImplementation() is called after that.\n // use the set return value.\n if (isReturnValueLastSet) {\n returnValue = specificReturnValues.shift();\n if (returnValue === undefined) {\n returnValue = defaultReturnValue;\n }\n }\n\n // If mockImplementation() is last set, or specific return values\n // are used up, use the mock implementation.\n if (mockImpl && returnValue === undefined) {\n return mockImpl.apply(this, arguments);\n }\n\n // Otherwise use prototype implementation\n if (returnValue === undefined && arguments.callee._protoImpl) {\n return arguments.callee._protoImpl.apply(this, arguments);\n }\n\n return returnValue;\n };\n\n f._isMockFunction = true;\n\n f.mock = {\n calls : calls,\n instances : instances\n };\n\n f.mockClear = function() {\n calls.length = 0;\n instances.length = 0;\n };\n\n f.mockReturnValue = function(value) {\n // next function call will return this value or default return value\n isReturnValueLastSet = true;\n specificReturnValues.push(value);\n return f;\n };\n\n f.mockDefaultReturnValue = function(value) {\n // next function call will return specified return value or this one\n isReturnValueLastSet = true;\n defaultReturnValue = value;\n return f;\n };\n\n f.mockImplementation = function(fn) {\n // next function call will use mock implementation return value\n isReturnValueLastSet = false;\n mockImpl = fn;\n return f;\n };\n\n f.mockReturnThis = function() {\n return f.mockImplementation(function() {\n return this;\n });\n };\n\n f._getMockImplementation = function() {\n return mockImpl;\n };\n\n if (metadata.mockImpl) {\n f.mockImplementation(metadata.mockImpl);\n }\n\n return f;\n }\n\n throw new Error('Unrecognized type ' + metadata.type);\n}\n\nfunction generateFromMetadata(_metadata) {\n var callbacks = [];\n var refs = {};\n\n function generateMock(metadata) {\n var mock = makeComponent(metadata);\n if (metadata.ref_id != null) {\n refs[metadata.ref_id] = mock;\n }\n\n function getRefCallback(slot, ref) {\n return function() {\n mock[slot] = refs[ref];\n };\n }\n\n for (var slot in metadata.members) {\n var slotMetadata = metadata.members[slot];\n if (slotMetadata.ref != null) {\n callbacks.push(getRefCallback(slot, slotMetadata.ref));\n } else {\n mock[slot] = generateMock(slotMetadata);\n }\n }\n\n return mock;\n }\n\n var mock = generateMock(_metadata);\n callbacks.forEach(function(setter) {\n setter();\n });\n\n return mock;\n}\n\n\nfunction _getMetadata(component, _refs) {\n var refs = _refs || [];\n\n // This is a potential performance drain, since the whole list is scanned\n // for every component\n var ref = refs.indexOf(component);\n if (ref > -1) {\n return {ref: ref};\n }\n\n var type = getType(component);\n if (!type) {\n return null;\n }\n\n var metadata = {type : type};\n if (type == 'constant') {\n metadata.value = component;\n return metadata;\n } else if (type == 'function') {\n if (component._isMockFunction) {\n metadata.mockImpl = component._getMockImplementation();\n }\n }\n\n metadata.ref_id = refs.length;\n refs.push(component);\n\n var members = null;\n\n function addMember(slot, data) {\n if (!data) {\n return;\n }\n if (!members) {\n members = {};\n }\n members[slot] = data;\n }\n\n // Leave arrays alone\n if (type != 'array') {\n for (var slot in component) {\n if (slot.charAt(0) == '_' ||\n (type == 'function' && component._isMockFunction &&\n slot.match(/^mock/))) {\n continue;\n }\n\n if (component.hasOwnProperty(slot) ||\n (type == 'object' && component[slot] != Object.prototype[slot])) {\n addMember(slot, _getMetadata(component[slot], refs));\n }\n }\n\n // If component is native code function, prototype might be undefined\n if (type == 'function' && component.prototype) {\n var prototype = _getMetadata(component.prototype, refs);\n if (prototype && prototype.members) {\n addMember('prototype', prototype);\n }\n }\n }\n\n if (members) {\n metadata.members = members;\n }\n\n return metadata;\n}\n\nfunction removeUnusedRefs(metadata) {\n function visit(md, f) {\n f(md);\n if (md.members) {\n for (var slot in md.members) {\n visit(md.members[slot], f);\n }\n }\n }\n\n var usedRefs = {};\n visit(metadata, function(md) {\n if (md.ref != null) {\n usedRefs[md.ref] = true;\n }\n });\n\n visit(metadata, function(md) {\n if (!usedRefs[md.ref_id]) {\n delete md.ref_id;\n }\n });\n}\n\nvar global = Function(\"return this\")();\nglobal.dirtyMocks = global.dirtyMocks || [];\n\nmodule.exports = {\n /**\n * Invokes the .mockClear method of all function mocks that have been\n * called since the last time clear was called.\n */\n clear: function() {\n var old = global.dirtyMocks;\n global.dirtyMocks = [];\n old.forEach(function(mock) {\n mock.mockClear();\n });\n },\n\n /**\n * Generates a mock based on the given metadata. Mocks treat functions\n * specially, and all mock functions have additional members, described in the\n * documentation for getMockFunction in this module.\n *\n * One important note: function prototoypes are handled specially by this\n * mocking framework. For functions with prototypes, when called as a\n * constructor, the mock will install mocked function members on the instance.\n * This allows different instances of the same constructor to have different\n * values for its mocks member and its return values.\n *\n * @param metadata Metadata for the mock in the schema returned by the\n * getMetadata method of this module.\n *\n */\n generateFromMetadata: generateFromMetadata,\n\n /**\n * Inspects the argument and returns its schema in the following recursive\n * format:\n * {\n * type: ...\n * members : {}\n * }\n *\n * Where type is one of 'array', 'object', 'function', or 'ref', and members\n * is an optional dictionary where the keys are member names and the values\n * are metadata objects. Function prototypes are defined simply by defining\n * metadata for the member.prototype of the function. The type of a function\n * prototype should always be \"object\". For instance, a simple class might be\n * defined like this:\n *\n * {\n * type: 'function',\n * members: {\n * staticMethod: {type: 'function'},\n * prototype: {\n * type: 'object',\n * members: {\n * instanceMethod: {type: 'function'}\n * }\n * }\n * }\n * }\n *\n * Metadata may also contain references to other objects defined within the\n * same metadata object. The metadata for the referent must be marked with\n * 'ref_id' key and an arbitrary value. The referer must be marked with a\n * 'ref' key that has the same value as object with ref_id that it refers to.\n * For instance, this metadata blob:\n * {\n * type: 'object',\n * ref_id: 1,\n * members: {\n * self: {ref: 1}\n * }\n * }\n *\n * defines an object with a slot named 'self' that refers back to the object.\n *\n * @param component The component for which to retrieve metadata.\n */\n getMetadata: function(component) {\n var metadata = _getMetadata(component);\n // to make it easier to work with mock metadata, only preserve references\n // that are actually used\n removeUnusedRefs(metadata);\n return metadata;\n },\n\n /**\n * Generates a stand-alone function with members that help drive unit tests or\n * confirm expectations. Specifically, functions returned by this method have\n * the following members:\n *\n * .mock:\n * An object with two members, \"calls\", and \"instances\", which are both\n * lists. The items in the \"calls\" list are the arguments with which the\n * function was called. The \"instances\" list stores the value of 'this' for\n * each call to the function. This is useful for retrieving instances from a\n * constructor.\n *\n * .mockReturnValue(value)\n * Pushes the given value onto a FIFO queue of return values for the\n * function.\n *\n * .mockDefaultReturnValue(value)\n * Sets the default return value for the function.\n *\n * .mockImplementation(function)\n * Sets a mock implementation for the function.\n *\n * .mockReturnThis()\n * Syntactic sugar for .mockImplementation(function() {return this;})\n *\n * In case both mockImplementation() and\n * mockReturnValue()/mockDefaultReturnValue() are called. The priority of\n * which to use is based on what is the last call:\n * - if the last call is mockRetrunValue() or mockDefaultReturnValue(),\n * use the specific return specific return value or default return value.\n * If specific return values are used up or no default return value is set,\n * fall back to try mockImplementation();\n * - if the last call is mockImplementation(), run the given implementation\n * and return the result.\n */\n getMockFunction: function() {\n return makeComponent({type: 'function'});\n }\n};\n",
"mock-modules":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mock-modules\n */\n\nvar mocks = require(\"./mocks\");\nvar exportsRegistry = {};\nvar hasOwn = exportsRegistry.hasOwnProperty;\nvar explicitMockMap = {};\n\nfunction getMock(exports) {\n try {\n return mocks.generateFromMetadata(mocks.getMetadata(exports));\n } catch (err) {\n console.warn(err);\n return exports;\n }\n}\n\n// This function should be called at the bottom of any module that might\n// need to be mocked, after the final value of module.exports is known.\nexports.register = function(id, module) {\n exportsRegistry[id] = {\n module: module,\n actual: module.exports,\n mocked: null // Filled in lazily later.\n };\n\n // If doMock or doNotMock was called earlier, before the module was\n // registered, then the choice should have been recorded in\n // explicitMockMap. Now that the module is registered, we can finally\n // fulfill the request.\n if (hasOwn.call(explicitMockMap, id)) {\n if (explicitMockMap[id]) {\n doMock(id);\n } else {\n doNotMock(id);\n }\n }\n\n return exports;\n};\n\nfunction resetEntry(id) {\n if (hasOwn.call(exportsRegistry, id)) {\n delete exportsRegistry[id].module.exports;\n delete exportsRegistry[id];\n }\n}\n\nexports.dumpCache = function() {\n require(\"./mocks\").clear();\n\n // Deleting module.exports will cause the module to be lazily\n // reevaluated the next time it is required.\n for (var id in exportsRegistry) {\n resetEntry(id);\n }\n\n return exports;\n};\n\n// Call this function to ensure that require(id) returns the actual\n// exports object created by the module.\nfunction doNotMock(id) {\n explicitMockMap[id] = false;\n\n var entry = exportsRegistry[id];\n if (entry && entry.module && entry.actual) {\n entry.module.exports = entry.actual;\n }\n\n return exports;\n}\n\n// Call this function to ensure that require(id) returns a mock exports\n// object based on the actual exports object created by the module.\nfunction doMock(id) {\n explicitMockMap[id] = true;\n\n var entry = exportsRegistry[id];\n if (entry && entry.module && entry.actual) {\n // Because mocking can be expensive, create the mock exports object on\n // demand, the first time doMock is called.\n entry.mocked || (entry.mocked = getMock(entry.actual));\n entry.module.exports = entry.mocked;\n }\n\n return exports;\n}\n\nvar global = Function(\"return this\")();\nrequire(\"./test/mock-timers\").installMockTimers(global);\n\n// Exported names are different for backwards compatibility.\nexports.dontMock = doNotMock;\nexports.mock = doMock;\n",
"test/mock-timers":"var mocks = require(\"../mocks\");\n\nvar timers = {};\n// Keep a fake timestamp\n// move on the time when runTimersToTime() is called\nvar now = 0;\n\n// add a timer of type either 'timeout' or 'interval'\nfunction _setTimer(type, callback, delay) {\n var token = null;\n do {\n token = Math.floor(Math.random() * 4294967296) + 1;\n } while (timers[token]);\n timers[token] = {\n type: type,\n callback: callback,\n // Add some random msecs to the delay to mimic code execution time.\n time: now + delay + Math.floor(Math.random() * 5),\n interval: (type == 'interval' ? delay : 0)\n };\n return token;\n}\n\n// clear a timer of type either 'timeout' or 'interval'\nfunction _clearTimer(type, token) {\n if (timers[token] && timers[token].type == type) {\n delete timers[token];\n }\n}\n\nfunction _setTimeout(callback, delay) {\n return _setTimer('timeout', callback, delay);\n}\n\nfunction _setInterval(callback, delay) {\n return _setTimer('interval', callback, delay);\n}\n\nfunction _clearTimeout(token) {\n _clearTimer('timeout', token);\n}\n\nfunction _clearInterval(token) {\n _clearTimer('interval', token);\n}\n\n// Run timer of given token\nfunction _runTimer(token) {\n // Skip non-existing token\n if (timers[token]) {\n if (timers[token].type == 'timeout') {\n // for 'timeout', run callback and delete the timer\n var callback = timers[token].callback;\n delete timers[token];\n callback();\n } else if (timers[token].type == 'interval') {\n // for 'interval', run callback and set the next invoke time\n // Add some random msecs to the delay to mimic code execution time.\n timers[token].time =\n now + timers[token].interval + Math.floor(Math.random() * 5);\n timers[token].callback();\n }\n }\n}\n\nfunction _runTimersOnce() {\n // Invoke all timers once regardsless of the delay\n for (var token in timers) {\n _runTimer(token);\n }\n}\n\nfunction _runTimersToTime(delay) {\n var toRunToken = _getNextTimerToken();\n if (!toRunToken) {\n return;\n }\n\n var minTime = timers[toRunToken].time;\n if (now + delay < minTime) {\n // Termination when there's no more timers to invoke\n now += delay;\n } else {\n // Recursively invoke the next to-run timer\n delay -= (minTime - now);\n now = minTime;\n _runTimer(toRunToken);\n _runTimersToTime(delay);\n }\n}\n\nfunction _runTimersRepeatedly() {\n // Only run a generous 1000 timers and then bail, since we may have entered\n // a loop if we have more than that.\n var max_timers = 1000;\n\n var token;\n for (var ii = 0; ii < max_timers; ii++) {\n token = _getNextTimerToken();\n\n if (!token) {\n break;\n }\n\n _runTimer(token);\n }\n\n if (ii === max_timers) {\n throw new Error(\"More timers still exist after \" + max_timers + \" timers!\");\n }\n}\n\nfunction _clearTimers() {\n for (var token in timers) {\n delete timers[token];\n }\n}\n\nfunction _getNextTimerToken() {\n var nextTimerToken = null;\n var minTime = 31536000000; // One year\n // Find the next to invoke timer\n for (var token in timers) {\n if (timers[token].time < minTime) {\n nextTimerToken = token;\n minTime = timers[token].time;\n }\n }\n return nextTimerToken;\n}\n\nvar mockTimers = {\n setTimeout: _setTimeout,\n clearTimeout: _clearTimeout,\n setInterval: _setInterval,\n clearInterval: _clearInterval,\n\n /**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Iteratively run callbacks in time order during the time from now to\n * now + delay.\n * If one callback register another timer which should be run during now to\n * now + delay, the new timer will also be run in the right order.\n *\n * @param delay\n */\n runTimersToTime: _runTimersToTime,\n\n /**\n * Run all registered timer once. Newly registered timers will not be run.\n */\n runTimersOnce: _runTimersOnce,\n\n /**\n * Iteratively run callbacks until there are no timers left to call. Will\n * stop after a maximum number of iterations to avoid infinite loop.\n *\n * @param maximum iterations (optional)\n */\n runTimersRepeatedly: _runTimersRepeatedly,\n\n /**\n * Clear all timers\n */\n clearTimers: _clearTimers,\n\n /**\n * Get the number of remaining timers\n */\n getTimersCount: function() {\n return Object.keys(timers).length;\n }\n};\n\nmodule.exports.installMockTimers = function(window) {\n window._originalTimeouts = {\n setTimeout: window.setTimeout,\n clearTimeout: window.clearTimeout,\n setInterval: window.setInterval,\n clearInterval: window.clearInterval\n };\n window.setTimeout =\n mocks.getMockFunction().mockImplementation(mockTimers.setTimeout);\n window.clearTimeout =\n mocks.getMockFunction().mockImplementation(mockTimers.clearTimeout);\n window.setInterval =\n mocks.getMockFunction().mockImplementation(mockTimers.setInterval);\n window.clearInterval =\n mocks.getMockFunction().mockImplementation(mockTimers.clearInterval);\n window.mockRunTimersOnce =\n mocks.getMockFunction().mockImplementation(mockTimers.runTimersOnce);\n window.mockRunTimersToTime =\n mocks.getMockFunction().mockImplementation(mockTimers.runTimersToTime);\n window.mockRunTimersRepeatedly =\n mocks.getMockFunction().mockImplementation(mockTimers.runTimersRepeatedly);\n window.mockClearTimers =\n mocks.getMockFunction().mockImplementation(mockTimers.clearTimers);\n window.mockGetTimersCount =\n mocks.getMockFunction().mockImplementation(mockTimers.getTimersCount);\n};\n\nmodule.exports.uninstallMockTimers = function(window) {\n window.setTimeout = window._originalTimeouts.setTimeout;\n window.clearTimeout = window._originalTimeouts.clearTimeout;\n window.setInterval = window._originalTimeouts.setInterval;\n window.clearInterval = window._originalTimeouts.clearInterval;\n window._originalTimeouts = undefined;\n window.mockRunTimersOnce = undefined;\n window.mockRunTimersToTime = undefined;\n window.mockRunTimersRepeatedly = undefined;\n window.mockClearTimers = undefined;\n window.mockGetTimersCount = undefined;\n};\n\nrequire(\"../mock-modules\").register(\"test/mock-timers\", module);\n",
"LinkedStateMixin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule LinkedStateMixin\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ReactLink = require(\"./ReactLink\");\nvar ReactStateSetters = require(\"./ReactStateSetters\");\n\n/**\n * A simple mixin around ReactLink.forState().\n */\nvar LinkedStateMixin = {\n /**\n * Create a ReactLink that's linked to part of this component's state. The\n * ReactLink will have the current value of this.state[key] and will call\n * setState() when a change is requested.\n *\n * @param {string} key state key to update. Note: you may want to use keyOf()\n * if you're using Google Closure Compiler advanced mode.\n * @return {ReactLink} ReactLink instance linking to the state.\n */\n linkState: function(key) {\n return new ReactLink(\n this.state[key],\n ReactStateSetters.createStateKeySetter(this, key)\n );\n }\n};\n\nmodule.exports = LinkedStateMixin;\n\nrequire(\"./mock-modules\").register(\"LinkedStateMixin\", module);\n",
"React":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule React\n */\n\n\"use strict\";\n\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactCurrentOwner = require(\"./ReactCurrentOwner\");\nvar ReactDOM = require(\"./ReactDOM\");\nvar ReactDOMComponent = require(\"./ReactDOMComponent\");\nvar ReactDefaultInjection = require(\"./ReactDefaultInjection\");\nvar ReactInstanceHandles = require(\"./ReactInstanceHandles\");\nvar ReactMount = require(\"./ReactMount\");\nvar ReactMultiChild = require(\"./ReactMultiChild\");\nvar ReactPerf = require(\"./ReactPerf\");\nvar ReactPropTypes = require(\"./ReactPropTypes\");\nvar ReactServerRendering = require(\"./ReactServerRendering\");\nvar ReactTextComponent = require(\"./ReactTextComponent\");\n\nReactDefaultInjection.inject();\n\nvar React = {\n DOM: ReactDOM,\n PropTypes: ReactPropTypes,\n initializeTouchEvents: function(shouldUseTouch) {\n ReactMount.useTouchEvents = shouldUseTouch;\n },\n createClass: ReactCompositeComponent.createClass,\n constructAndRenderComponent: ReactMount.constructAndRenderComponent,\n constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,\n renderComponent: ReactPerf.measure(\n 'React',\n 'renderComponent',\n ReactMount.renderComponent\n ),\n renderComponentToString: ReactServerRendering.renderComponentToString,\n unmountComponentAtNode: ReactMount.unmountComponentAtNode,\n unmountAndReleaseReactRootNode: ReactMount.unmountAndReleaseReactRootNode,\n isValidClass: ReactCompositeComponent.isValidClass,\n isValidComponent: ReactComponent.isValidComponent,\n __internals: {\n Component: ReactComponent,\n CurrentOwner: ReactCurrentOwner,\n DOMComponent: ReactDOMComponent,\n InstanceHandles: ReactInstanceHandles,\n Mount: ReactMount,\n MultiChild: ReactMultiChild,\n TextComponent: ReactTextComponent\n }\n};\n\n// Version exists only in the open-source version of React, not in Facebook's\n// internal version.\nReact.version = '0.6.0-alpha';\n\nmodule.exports = React;\n\nrequire(\"./mock-modules\").register(\"React\", module);\n",
"ReactLink":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactLink\n * @typechecks static-only\n */\n\n\"use strict\";\n\n/**\n * ReactLink encapsulates a common pattern in which a component wants to modify\n * a prop received from its parent. ReactLink allows the parent to pass down a\n * value coupled with a callback that, when invoked, expresses an intent to\n * modify that value. For example:\n *\n * React.createClass({\n * getInitialState: function() {\n * return {value: ''};\n * },\n * render: function() {\n * var valueLink = new ReactLink(this.state.value, this._handleValueChange);\n * return <input valueLink={valueLink} />;\n * },\n * this._handleValueChange: function(newValue) {\n * this.setState({value: newValue});\n * }\n * });\n *\n * We have provided some sugary mixins to make the creation and\n * consumption of ReactLink easier; see LinkedValueMixin and LinkedStateMixin.\n */\n\n/**\n * @param {*} value current value of the link\n * @param {function} requestChange callback to request a change\n */\nfunction ReactLink(value, requestChange) {\n this.value = value;\n this.requestChange = requestChange;\n}\n\nmodule.exports = ReactLink;\n\nrequire(\"./mock-modules\").register(\"ReactLink\", module);\n",
"ReactTransitionGroup":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactTransitionGroup\n */\n\n\"use strict\";\n\nvar React = require(\"./React\");\nvar ReactTransitionableChild = require(\"./ReactTransitionableChild\");\nvar ReactTransitionKeySet = require(\"./ReactTransitionKeySet\");\n\nvar invariant = require(\"./invariant\");\n\nvar ReactTransitionGroupMixin = {\n componentWillMount: function() {\n // _transitionGroupCurrentKeys stores the union of previous *and* next keys.\n // If this were a component we'd store it as state, however, since this must\n // be a mixin, we need to keep the result of the union of keys in each\n // call to animateChildren() which happens in render(), so we can't\n // call setState() in there.\n this._transitionGroupCurrentKeys = {};\n },\n\n /**\n * Render some children in a transitionable way.\n */\n renderTransitionableChildren: function(sourceChildren) {\n invariant(\n this.getTransitionConfig,\n 'renderTransitionableChildren(): You must provide a ' +\n 'getTransitionConfig() method.'\n );\n\n var children = {};\n var childMapping = ReactTransitionKeySet.getChildMapping(sourceChildren);\n var transitionConfig = this.getTransitionConfig();\n var currentKeys = ReactTransitionKeySet.mergeKeySets(\n this._transitionGroupCurrentKeys,\n ReactTransitionKeySet.getKeySet(sourceChildren)\n );\n\n for (var key in currentKeys) {\n // Here is how we keep the nodes in the DOM. ReactTransitionableChild\n // knows how to hold onto its child if it changes to undefined. Here, we\n // may look up an old key in the new children, and it may switch to\n // undefined. React's reconciler will keep the ReactTransitionableChild\n // instance alive such that we can animate it.\n if (childMapping[key] || transitionConfig.leave) {\n children[key] = ReactTransitionableChild({\n name: transitionConfig.name,\n enter: transitionConfig.enter,\n onDoneLeaving: this._handleDoneLeaving.bind(this, key)\n }, childMapping[key]);\n }\n }\n\n this._transitionGroupCurrentKeys = currentKeys;\n\n return children;\n },\n\n _handleDoneLeaving: function(key) {\n // When the leave animation finishes, we should blow away the actual DOM\n // node.\n delete this._transitionGroupCurrentKeys[key];\n this.forceUpdate();\n }\n};\n\nvar ReactTransitionGroup = React.createClass({\n mixins: [ReactTransitionGroupMixin],\n\n getDefaultProps: function() {\n return {\n transitionEnter: true,\n transitionLeave: true,\n component: React.DOM.span\n };\n },\n\n getTransitionConfig: function() {\n return {\n name: this.props.transitionName,\n enter: this.props.transitionEnter,\n leave: this.props.transitionLeave\n };\n },\n\n render: function() {\n return this.transferPropsTo(\n this.props.component(\n {\n transitionName: null,\n transitionEnter: null,\n transitionLeave: null,\n component: null\n },\n this.renderTransitionableChildren(this.props.children)\n )\n );\n }\n});\n\nmodule.exports = ReactTransitionGroup;\n\nrequire(\"./mock-modules\").register(\"ReactTransitionGroup\", module);\n",
"ReactTransitionKeySet":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @typechecks static-only\n * @providesModule ReactTransitionKeySet\n */\n\n\"use strict\";\n\nvar ReactChildren = require(\"./ReactChildren\");\n\nvar MERGE_KEY_SETS_TAIL_SENTINEL = {};\n\nvar ReactTransitionKeySet = {\n /**\n * Given `this.props.children`, return an object mapping key to child. Just\n * simple syntactic sugar around ReactChildren.map().\n *\n * @param {*} children `this.props.children`\n * @return {object} Mapping of key to child\n */\n getChildMapping: function(children) {\n return ReactChildren.map(children, function(child) {\n return child;\n });\n },\n\n /**\n * Simple syntactic sugar to get an object with keys of all of `children`.\n * Does not have references to the children themselves.\n *\n * @param {*} children `this.props.children`\n * @return {object} Mapping of key to the value \"true\"\n */\n getKeySet: function(children) {\n return ReactChildren.map(children, function() {\n return true;\n });\n },\n\n /**\n * When you're adding or removing children some may be added or removed in the\n * same render pass. We want ot show *both* since we want to simultaneously\n * animate elements in and out. This function takes a previous set of keys\n * and a new set of keys and merges them with its best guess of the correct\n * ordering. In the future we may expose some of the utilities in\n * ReactMultiChild to make this easy, but for now React itself does not\n * directly have this concept of the union of prevChildren and nextChildren\n * so we implement it here.\n *\n * @param {object} prev prev child keys as returned from\n * `ReactTransitionKeySet.getKeySet()`.\n * @param {object} next next child keys as returned from\n * `ReactTransitionKeySet.getKeySet()`.\n * @return {object} a key set that contains all keys in `prev` and all keys\n * in `next` in a reasonable order.\n */\n mergeKeySets: function(prev, next) {\n var keySet = {};\n var prevKeys = Object.keys(prev).concat([MERGE_KEY_SETS_TAIL_SENTINEL]);\n var nextKeys = Object.keys(next).concat([MERGE_KEY_SETS_TAIL_SENTINEL]);\n var i;\n for (i = 0; i < prevKeys.length - 1; i++) {\n var prevKey = prevKeys[i];\n if (next[prevKey]) {\n continue;\n }\n\n // This key is not in the new set. Place it in our\n // best guess where it should go. We do this by searching\n // for a key after the current one in prevKeys that is\n // still in nextKeys, and inserting right before it.\n // I know this is O(n^2), but this is not a particularly\n // hot code path.\n var insertPos = -1;\n\n for (var j = i + 1; j < prevKeys.length; j++) {\n insertPos = nextKeys.indexOf(prevKeys[j]);\n if (insertPos >= 0) {\n break;\n }\n }\n\n // Insert before insertPos\n nextKeys.splice(insertPos, 0, prevKey);\n }\n\n for (i = 0; i < nextKeys.length - 1; i++) {\n keySet[nextKeys[i]] = true;\n }\n\n return keySet;\n }\n};\n\nmodule.exports = ReactTransitionKeySet;\n\nrequire(\"./mock-modules\").register(\"ReactTransitionKeySet\", module);\n",
"ReactTransitionableChild":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactTransitionableChild\n */\n\n\"use strict\";\n\nvar React = require(\"./React\");\nvar CSSCore = require(\"./CSSCore\");\nvar ReactTransitionEvents = require(\"./ReactTransitionEvents\");\n\n// We don't remove the element from the DOM until we receive an animationend or\n// transitionend event. If the user screws up and forgets to add an animation\n// their node will be stuck in the DOM forever, so we detect if an animation\n// does not start and if it doesn't, we just call the end listener immediately.\nvar TICK = 17;\nvar NO_EVENT_TIMEOUT = 5000;\n\nvar noEventListener = null;\n\nif (true) {\n noEventListener = function() {\n console.warn(\n 'transition(): tried to perform an animation without ' +\n 'an animationend or transitionend event after timeout (' +\n NO_EVENT_TIMEOUT + 'ms). You should either disable this ' +\n 'transition in JS or add a CSS animation/transition.'\n );\n };\n}\n\n/**\n * This component is simply responsible for watching when its single child\n * changes to undefined and animating the old child out. It does this by\n * recording its old child in savedChildren when it detects this event is about\n * to occur.\n */\nvar ReactTransitionableChild = React.createClass({\n /**\n * Perform an actual DOM transition. This takes care of a few things:\n * - Adding the second CSS class to trigger the transition\n * - Listening for the finish event\n * - Cleaning up the css (unless noReset is true)\n */\n transition: function(animationType, noReset, finishCallback) {\n var node = this.getDOMNode();\n var className = this.props.name + '-' + animationType;\n var activeClassName = className + '-active';\n var noEventTimeout = null;\n\n var endListener = function() {\n if (true) {\n clearTimeout(noEventTimeout);\n }\n\n // If this gets invoked after the component is unmounted it's OK.\n if (!noReset) {\n // Usually this means you're about to remove the node if you want to\n // leave it in its animated state.\n CSSCore.removeClass(node, className);\n CSSCore.removeClass(node, activeClassName);\n }\n\n ReactTransitionEvents.removeEndEventListener(node, endListener);\n\n // Usually this optional callback is used for informing an owner of\n // a leave animation and telling it to remove the child.\n finishCallback && finishCallback();\n };\n\n ReactTransitionEvents.addEndEventListener(node, endListener);\n\n CSSCore.addClass(node, className);\n\n // Need to do this to actually trigger a transition.\n this.queueClass(activeClassName);\n\n if (true) {\n noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);\n }\n },\n\n queueClass: function(className) {\n this.classNameQueue.push(className);\n\n if (this.props.runNextTick) {\n this.props.runNextTick(this.flushClassNameQueue);\n return;\n }\n\n if (!this.timeout) {\n this.timeout = setTimeout(this.flushClassNameQueue, TICK);\n }\n },\n\n flushClassNameQueue: function() {\n if (this.isMounted()) {\n this.classNameQueue.forEach(\n CSSCore.addClass.bind(CSSCore, this.getDOMNode())\n );\n }\n this.classNameQueue.length = 0;\n this.timeout = null;\n },\n\n componentWillMount: function() {\n this.classNameQueue = [];\n },\n\n componentWillUnmount: function() {\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n },\n\n componentWillReceiveProps: function(nextProps) {\n if (!nextProps.children && this.props.children) {\n this.savedChildren = this.props.children;\n }\n },\n\n componentDidMount: function(node) {\n if (this.props.enter) {\n this.transition('enter');\n }\n },\n\n componentDidUpdate: function(prevProps, prevState, node) {\n if (prevProps.children && !this.props.children) {\n this.transition('leave', true, this.props.onDoneLeaving);\n }\n },\n\n render: function() {\n return this.props.children || this.savedChildren;\n }\n});\n\nmodule.exports = ReactTransitionableChild;\n\nrequire(\"./mock-modules\").register(\"ReactTransitionableChild\", module);\n",
"ReactDoNotBindDeprecated":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDoNotBindDeprecated\n */\n\n\"use strict\";\n\nvar ReactDoNotBindDeprecated = {\n /**\n * Marks the method for not being automatically bound on component mounting. A\n * couple of reasons you might want to use this:\n *\n * - Automatically supporting the previous behavior in components that were\n * built with previous versions of React.\n * - Tuning performance, by avoiding binding on initial render for methods\n * that are always invoked while being preceded by `this.`. Such binds are\n * unnecessary.\n *\n * React.createClass({\n * handleClick: ReactDoNotBindDeprecated.doNotBind(function() {\n * alert(this.setState); // undefined!\n * }),\n * render: function() {\n * return <a onClick={this.handleClick}>Jump</a>;\n * }\n * });\n *\n * @param {function} method Method to avoid automatically binding.\n * @public\n */\n doNotBind: function(method) {\n method.__reactDontBind = true; // Mutating\n return method;\n }\n};\n\nmodule.exports = ReactDoNotBindDeprecated;\n\nrequire(\"./mock-modules\").register(\"ReactDoNotBindDeprecated\", module);\n",
"ReactComponent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactComponent\n */\n\n\"use strict\";\n\nvar ReactComponentEnvironment = require(\"./ReactComponentEnvironment\");\nvar ReactCurrentOwner = require(\"./ReactCurrentOwner\");\nvar ReactOwner = require(\"./ReactOwner\");\nvar ReactUpdates = require(\"./ReactUpdates\");\n\nvar invariant = require(\"./invariant\");\nvar keyMirror = require(\"./keyMirror\");\nvar merge = require(\"./merge\");\n\n/**\n * Every React component is in one of these life cycles.\n */\nvar ComponentLifeCycle = keyMirror({\n /**\n * Mounted components have a DOM node representation and are capable of\n * receiving new props.\n */\n MOUNTED: null,\n /**\n * Unmounted components are inactive and cannot receive new props.\n */\n UNMOUNTED: null\n});\n\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children.\n * This allows us to keep track of children between updates.\n */\n\nvar ownerHasWarned = {};\n\n/**\n * Warn if the component doesn't have an explicit key assigned to it.\n * This component is in an array. The array could grow and shrink or be\n * reordered. All children, that hasn't already been validated, are required to\n * have a \"key\" property assigned to it.\n *\n * @internal\n * @param {ReactComponent} component Component that requires a key.\n */\nfunction validateExplicitKey(component) {\n if (component.__keyValidated__ || component.props.key != null) {\n return;\n }\n component.__keyValidated__ = true;\n\n // We can't provide friendly warnings for top level components.\n if (!ReactCurrentOwner.current) {\n return;\n }\n\n // Name of the component whose render method tried to pass children.\n var currentName = ReactCurrentOwner.current.constructor.displayName;\n if (ownerHasWarned.hasOwnProperty(currentName)) {\n return;\n }\n ownerHasWarned[currentName] = true;\n\n var message = 'Each child in an array should have a unique \"key\" prop. ' +\n 'Check the render method of ' + currentName + '.';\n if (!component.isOwnedBy(ReactCurrentOwner.current)) {\n // Name of the component that originally created this child.\n var childOwnerName =\n component.props.__owner__ &&\n component.props.__owner__.constructor.displayName;\n\n // Usually the current owner is the offender, but if it accepts\n // children as a property, it may be the creator of the child that's\n // responsible for assigning it a key.\n message += ' It was passed a child from ' + childOwnerName + '.';\n }\n\n console.warn(message);\n}\n\n/**\n * Ensure that every component either is passed in a static location or, if\n * if it's passed in an array, has an explicit key property defined.\n *\n * @internal\n * @param {*} component Statically passed child of any type.\n * @return {boolean}\n */\nfunction validateChildKeys(component) {\n if (Array.isArray(component)) {\n for (var i = 0; i < component.length; i++) {\n var child = component[i];\n if (ReactComponent.isValidComponent(child)) {\n validateExplicitKey(child);\n }\n }\n } else if (ReactComponent.isValidComponent(component)) {\n // This component was passed in a valid location.\n component.__keyValidated__ = true;\n }\n}\n\n/**\n * Components are the basic units of composition in React.\n *\n * Every component accepts a set of keyed input parameters known as \"props\" that\n * are initialized by the constructor. Once a component is mounted, the props\n * can be mutated using `setProps` or `replaceProps`.\n *\n * Every component is capable of the following operations:\n *\n * `mountComponent`\n * Initializes the component, renders markup, and registers event listeners.\n *\n * `receiveProps`\n * Updates the rendered DOM nodes given a new set of props.\n *\n * `unmountComponent`\n * Releases any resources allocated by this component.\n *\n * Components can also be \"owned\" by other components. Being owned by another\n * component means being constructed by that component. This is different from\n * being the child of a component, which means having a DOM representation that\n * is a child of the DOM representation of that component.\n *\n * @class ReactComponent\n */\nvar ReactComponent = {\n\n /**\n * @param {?object} object\n * @return {boolean} True if `object` is a valid component.\n * @final\n */\n isValidComponent: function(object) {\n return !!(\n object &&\n typeof object.mountComponentIntoNode === 'function' &&\n typeof object.receiveProps === 'function'\n );\n },\n\n /**\n * Generate a key string that identifies a component within a set.\n *\n * @param {*} component A component that could contain a manual key.\n * @param {number} index Index that is used if a manual key is not provided.\n * @return {string}\n * @internal\n */\n getKey: function(component, index) {\n if (component && component.props && component.props.key != null) {\n // Explicit key\n return '{' + component.props.key + '}';\n }\n // Implicit key determined by the index in the set\n return '[' + index + ']';\n },\n\n /**\n * @internal\n */\n LifeCycle: ComponentLifeCycle,\n\n /**\n * Injected module that provides ability to mutate individual properties.\n * Injected into the base class because many different subclasses need access\n * to this.\n *\n * @internal\n */\n DOMIDOperations: ReactComponentEnvironment.DOMIDOperations,\n\n /**\n * Optionally injectable environment dependent cleanup hook. (server vs.\n * browser etc). Example: A browser system caches DOM nodes based on component\n * ID and must remove that cache entry when this instance is unmounted.\n *\n * @private\n */\n unmountIDFromEnvironment: ReactComponentEnvironment.unmountIDFromEnvironment,\n\n /**\n * The \"image\" of a component tree, is the platform specific (typically\n * serialized) data that represents a tree of lower level UI building blocks.\n * On the web, this \"image\" is HTML markup which describes a construction of\n * low level `div` and `span` nodes. Other platforms may have different\n * encoding of this \"image\". This must be injected.\n *\n * @private\n */\n mountImageIntoNode: ReactComponentEnvironment.mountImageIntoNode,\n\n /**\n * React references `ReactReconcileTransaction` using this property in order\n * to allow dependency injection.\n *\n * @internal\n */\n ReactReconcileTransaction:\n ReactComponentEnvironment.ReactReconcileTransaction,\n\n /**\n * Base functionality for every ReactComponent constructor. Mixed into the\n * `ReactComponent` prototype, but exposed statically for easy access.\n *\n * @lends {ReactComponent.prototype}\n */\n Mixin: merge(ReactComponentEnvironment.Mixin, {\n\n /**\n * Checks whether or not this component is mounted.\n *\n * @return {boolean} True if mounted, false otherwise.\n * @final\n * @protected\n */\n isMounted: function() {\n return this._lifeCycleState === ComponentLifeCycle.MOUNTED;\n },\n\n /**\n * Sets a subset of the props.\n *\n * @param {object} partialProps Subset of the next props.\n * @param {?function} callback Called after props are updated.\n * @final\n * @public\n */\n setProps: function(partialProps, callback) {\n // Merge with `_pendingProps` if it exists, otherwise with existing props.\n this.replaceProps(\n merge(this._pendingProps || this.props, partialProps),\n callback\n );\n },\n\n /**\n * Replaces all of the props.\n *\n * @param {object} props New props.\n * @param {?function} callback Called after props are updated.\n * @final\n * @public\n */\n replaceProps: function(props, callback) {\n invariant(\n !this.props.__owner__,\n 'replaceProps(...): You called `setProps` or `replaceProps` on a ' +\n 'component with an owner. This is an anti-pattern since props will ' +\n 'get reactively updated when rendered. Instead, change the owner\\'s ' +\n '`render` method to pass the correct value as props to the component ' +\n 'where it is created.'\n );\n invariant(\n this.isMounted(),\n 'replaceProps(...): Can only update a mounted component.'\n );\n this._pendingProps = props;\n ReactUpdates.enqueueUpdate(this, callback);\n },\n\n /**\n * Base constructor for all React component.\n *\n * Subclasses that override this method should make sure to invoke\n * `ReactComponent.Mixin.construct.call(this, ...)`.\n *\n * @param {?object} initialProps\n * @param {*} children\n * @internal\n */\n construct: function(initialProps, children) {\n this.props = initialProps || {};\n // Record the component responsible for creating this component.\n this.props.__owner__ = ReactCurrentOwner.current;\n // All components start unmounted.\n this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;\n\n this._pendingProps = null;\n this._pendingCallbacks = null;\n\n // Children can be more than one argument\n var childrenLength = arguments.length - 1;\n if (childrenLength === 1) {\n if (true) {\n validateChildKeys(children);\n }\n this.props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n if (true) {\n validateChildKeys(arguments[i + 1]);\n }\n childArray[i] = arguments[i + 1];\n }\n this.props.children = childArray;\n }\n },\n\n /**\n * Initializes the component, renders markup, and registers event listeners.\n *\n * NOTE: This does not insert any nodes into the DOM.\n *\n * Subclasses that override this method should make sure to invoke\n * `ReactComponent.Mixin.mountComponent.call(this, ...)`.\n *\n * @param {string} rootID DOM ID of the root node.\n * @param {ReactReconcileTransaction} transaction\n * @param {number} mountDepth number of components in the owner hierarchy.\n * @return {?string} Rendered markup to be inserted into the DOM.\n * @internal\n */\n mountComponent: function(rootID, transaction, mountDepth) {\n invariant(\n !this.isMounted(),\n 'mountComponent(%s, ...): Can only mount an unmounted component.',\n rootID\n );\n var props = this.props;\n if (props.ref != null) {\n ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__);\n }\n this._rootNodeID = rootID;\n this._lifeCycleState = ComponentLifeCycle.MOUNTED;\n this._mountDepth = mountDepth;\n // Effectively: return '';\n },\n\n /**\n * Releases any resources allocated by `mountComponent`.\n *\n * NOTE: This does not remove any nodes from the DOM.\n *\n * Subclasses that override this method should make sure to invoke\n * `ReactComponent.Mixin.unmountComponent.call(this)`.\n *\n * @internal\n */\n unmountComponent: function() {\n invariant(\n this.isMounted(),\n 'unmountComponent(): Can only unmount a mounted component.'\n );\n var props = this.props;\n if (props.ref != null) {\n ReactOwner.removeComponentAsRefFrom(this, props.ref, props.__owner__);\n }\n ReactComponent.unmountIDFromEnvironment(this._rootNodeID);\n this._rootNodeID = null;\n this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;\n },\n\n /**\n * Updates the rendered DOM nodes given a new set of props.\n *\n * Subclasses that override this method should make sure to invoke\n * `ReactComponent.Mixin.receiveProps.call(this, ...)`.\n *\n * @param {object} nextProps Next set of properties.\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n receiveProps: function(nextProps, transaction) {\n invariant(\n this.isMounted(),\n 'receiveProps(...): Can only update a mounted component.'\n );\n this._pendingProps = nextProps;\n this._performUpdateIfNecessary(transaction);\n },\n\n /**\n * Call `_performUpdateIfNecessary` within a new transaction.\n *\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n performUpdateIfNecessary: function() {\n var transaction = ReactComponent.ReactReconcileTransaction.getPooled();\n transaction.perform(this._performUpdateIfNecessary, this, transaction);\n ReactComponent.ReactReconcileTransaction.release(transaction);\n },\n\n /**\n * If `_pendingProps` is set, update the component.\n *\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n _performUpdateIfNecessary: function(transaction) {\n if (this._pendingProps == null) {\n return;\n }\n var prevProps = this.props;\n this.props = this._pendingProps;\n this._pendingProps = null;\n this.updateComponent(transaction, prevProps);\n },\n\n /**\n * Updates the component's currently mounted representation.\n *\n * @param {ReactReconcileTransaction} transaction\n * @param {object} prevProps\n * @internal\n */\n updateComponent: function(transaction, prevProps) {\n var props = this.props;\n // If either the owner or a `ref` has changed, make sure the newest owner\n // has stored a reference to `this`, and the previous owner (if different)\n // has forgotten the reference to `this`.\n if (props.__owner__ !== prevProps.__owner__ ||\n props.ref !== prevProps.ref) {\n if (prevProps.ref != null) {\n ReactOwner.removeComponentAsRefFrom(\n this, prevProps.ref, prevProps.__owner__\n );\n }\n // Correct, even if the owner is the same, and only the ref has changed.\n if (props.ref != null) {\n ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__);\n }\n }\n },\n\n /**\n * Mounts this component and inserts it into the DOM.\n *\n * @param {string} rootID DOM ID of the root node.\n * @param {DOMElement} container DOM element to mount into.\n * @param {boolean} shouldReuseMarkup If true, do not insert markup\n * @final\n * @internal\n * @see {ReactMount.renderComponent}\n */\n mountComponentIntoNode: function(rootID, container, shouldReuseMarkup) {\n var transaction = ReactComponent.ReactReconcileTransaction.getPooled();\n transaction.perform(\n this._mountComponentIntoNode,\n this,\n rootID,\n container,\n transaction,\n shouldReuseMarkup\n );\n ReactComponent.ReactReconcileTransaction.release(transaction);\n },\n\n /**\n * @param {string} rootID DOM ID of the root node.\n * @param {DOMElement} container DOM element to mount into.\n * @param {ReactReconcileTransaction} transaction\n * @param {boolean} shouldReuseMarkup If true, do not insert markup\n * @final\n * @private\n */\n _mountComponentIntoNode: function(\n rootID,\n container,\n transaction,\n shouldReuseMarkup) {\n var markup = this.mountComponent(rootID, transaction, 0);\n ReactComponent.mountImageIntoNode(markup, container, shouldReuseMarkup);\n },\n\n /**\n * Checks if this component is owned by the supplied `owner` component.\n *\n * @param {ReactComponent} owner Component to check.\n * @return {boolean} True if `owners` owns this component.\n * @final\n * @internal\n */\n isOwnedBy: function(owner) {\n return this.props.__owner__ === owner;\n },\n\n /**\n * Gets another component, that shares the same owner as this one, by ref.\n *\n * @param {string} ref of a sibling Component.\n * @return {?ReactComponent} the actual sibling Component.\n * @final\n * @internal\n */\n getSiblingByRef: function(ref) {\n var owner = this.props.__owner__;\n if (!owner || !owner.refs) {\n return null;\n }\n return owner.refs[ref];\n }\n })\n};\n\nmodule.exports = ReactComponent;\n\nrequire(\"./mock-modules\").register(\"ReactComponent\", module);\n",
"ReactCompositeComponent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactCompositeComponent\n */\n\n\"use strict\";\n\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactCurrentOwner = require(\"./ReactCurrentOwner\");\nvar ReactOwner = require(\"./ReactOwner\");\nvar ReactPerf = require(\"./ReactPerf\");\nvar ReactPropTransferer = require(\"./ReactPropTransferer\");\nvar ReactUpdates = require(\"./ReactUpdates\");\n\nvar invariant = require(\"./invariant\");\nvar keyMirror = require(\"./keyMirror\");\nvar merge = require(\"./merge\");\nvar mixInto = require(\"./mixInto\");\nvar objMap = require(\"./objMap\");\n\n/**\n * Policies that describe methods in `ReactCompositeComponentInterface`.\n */\nvar SpecPolicy = keyMirror({\n /**\n * These methods may be defined only once by the class specification or mixin.\n */\n DEFINE_ONCE: null,\n /**\n * These methods may be defined by both the class specification and mixins.\n * Subsequent definitions will be chained. These methods must return void.\n */\n DEFINE_MANY: null,\n /**\n * These methods are overriding the base ReactCompositeComponent class.\n */\n OVERRIDE_BASE: null,\n /**\n * These methods are similar to DEFINE_MANY, except we assume they return\n * objects. We try to merge the keys of the return values of all the mixed in\n * functions. If there is a key conflict we throw.\n */\n DEFINE_MANY_MERGED: null\n});\n\n/**\n * Composite components are higher-level components that compose other composite\n * or native components.\n *\n * To create a new type of `ReactCompositeComponent`, pass a specification of\n * your new class to `React.createClass`. The only requirement of your class\n * specification is that you implement a `render` method.\n *\n * var MyComponent = React.createClass({\n * render: function() {\n * return <div>Hello World</div>;\n * }\n * });\n *\n * The class specification supports a specific protocol of methods that have\n * special meaning (e.g. `render`). See `ReactCompositeComponentInterface` for\n * more the comprehensive protocol. Any other properties and methods in the\n * class specification will available on the prototype.\n *\n * @interface ReactCompositeComponentInterface\n * @internal\n */\nvar ReactCompositeComponentInterface = {\n\n /**\n * An array of Mixin objects to include when defining your component.\n *\n * @type {array}\n * @optional\n */\n mixins: SpecPolicy.DEFINE_MANY,\n\n /**\n * Definition of prop types for this component.\n *\n * @type {object}\n * @optional\n */\n propTypes: SpecPolicy.DEFINE_ONCE,\n\n\n\n // ==== Definition methods ====\n\n /**\n * Invoked when the component is mounted. Values in the mapping will be set on\n * `this.props` if that prop is not specified (i.e. using an `in` check).\n *\n * This method is invoked before `getInitialState` and therefore cannot rely\n * on `this.state` or use `this.setState`.\n *\n * @return {object}\n * @optional\n */\n getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,\n\n /**\n * Invoked once before the component is mounted. The return value will be used\n * as the initial value of `this.state`.\n *\n * getInitialState: function() {\n * return {\n * isOn: false,\n * fooBaz: new BazFoo()\n * }\n * }\n *\n * @return {object}\n * @optional\n */\n getInitialState: SpecPolicy.DEFINE_MANY_MERGED,\n\n /**\n * Uses props from `this.props` and state from `this.state` to render the\n * structure of the component.\n *\n * No guarantees are made about when or how often this method is invoked, so\n * it must not have side effects.\n *\n * render: function() {\n * var name = this.props.name;\n * return <div>Hello, {name}!</div>;\n * }\n *\n * @return {ReactComponent}\n * @nosideeffects\n * @required\n */\n render: SpecPolicy.DEFINE_ONCE,\n\n\n\n // ==== Delegate methods ====\n\n /**\n * Invoked when the component is initially created and about to be mounted.\n * This may have side effects, but any external subscriptions or data created\n * by this method must be cleaned up in `componentWillUnmount`.\n *\n * @optional\n */\n componentWillMount: SpecPolicy.DEFINE_MANY,\n\n /**\n * Invoked when the component has been mounted and has a DOM representation.\n * However, there is no guarantee that the DOM node is in the document.\n *\n * Use this as an opportunity to operate on the DOM when the component has\n * been mounted (initialized and rendered) for the first time.\n *\n * @param {DOMElement} rootNode DOM element representing the component.\n * @optional\n */\n componentDidMount: SpecPolicy.DEFINE_MANY,\n\n /**\n * Invoked before the component receives new props.\n *\n * Use this as an opportunity to react to a prop transition by updating the\n * state using `this.setState`. Current props are accessed via `this.props`.\n *\n * componentWillReceiveProps: function(nextProps) {\n * this.setState({\n * likesIncreasing: nextProps.likeCount > this.props.likeCount\n * });\n * }\n *\n * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop\n * transition may cause a state change, but the opposite is not true. If you\n * need it, you are probably looking for `componentWillUpdate`.\n *\n * @param {object} nextProps\n * @optional\n */\n componentWillReceiveProps: SpecPolicy.DEFINE_MANY,\n\n /**\n * Invoked while deciding if the component should be updated as a result of\n * receiving new props and state.\n *\n * Use this as an opportunity to `return false` when you're certain that the\n * transition to the new props and state will not require a component update.\n *\n * shouldComponentUpdate: function(nextProps, nextState) {\n * return !equal(nextProps, this.props) || !equal(nextState, this.state);\n * }\n *\n * @param {object} nextProps\n * @param {?object} nextState\n * @return {boolean} True if the component should update.\n * @optional\n */\n shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,\n\n /**\n * Invoked when the component is about to update due to a transition from\n * `this.props` and `this.state` to `nextProps` and `nextState`.\n *\n * Use this as an opportunity to perform preparation before an update occurs.\n *\n * NOTE: You **cannot** use `this.setState()` in this method.\n *\n * @param {object} nextProps\n * @param {?object} nextState\n * @param {ReactReconcileTransaction} transaction\n * @optional\n */\n componentWillUpdate: SpecPolicy.DEFINE_MANY,\n\n /**\n * Invoked when the component's DOM representation has been updated.\n *\n * Use this as an opportunity to operate on the DOM when the component has\n * been updated.\n *\n * @param {object} prevProps\n * @param {?object} prevState\n * @param {DOMElement} rootNode DOM element representing the component.\n * @optional\n */\n componentDidUpdate: SpecPolicy.DEFINE_MANY,\n\n /**\n * Invoked when the component is about to be removed from its parent and have\n * its DOM representation destroyed.\n *\n * Use this as an opportunity to deallocate any external resources.\n *\n * NOTE: There is no `componentDidUnmount` since your component will have been\n * destroyed by that point.\n *\n * @optional\n */\n componentWillUnmount: SpecPolicy.DEFINE_MANY,\n\n\n\n // ==== Advanced methods ====\n\n /**\n * Updates the component's currently mounted DOM representation.\n *\n * By default, this implements React's rendering and reconciliation algorithm.\n * Sophisticated clients may wish to override this.\n *\n * @param {ReactReconcileTransaction} transaction\n * @internal\n * @overridable\n */\n updateComponent: SpecPolicy.OVERRIDE_BASE\n\n};\n\n/**\n * Mapping from class specification keys to special processing functions.\n *\n * Although these are declared in the specification when defining classes\n * using `React.createClass`, they will not be on the component's prototype.\n */\nvar RESERVED_SPEC_KEYS = {\n displayName: function(Constructor, displayName) {\n Constructor.displayName = displayName;\n },\n mixins: function(Constructor, mixins) {\n if (mixins) {\n for (var i = 0; i < mixins.length; i++) {\n mixSpecIntoComponent(Constructor, mixins[i]);\n }\n }\n },\n propTypes: function(Constructor, propTypes) {\n Constructor.propTypes = propTypes;\n }\n};\n\nfunction validateMethodOverride(proto, name) {\n var specPolicy = ReactCompositeComponentInterface[name];\n\n // Disallow overriding of base class methods unless explicitly allowed.\n if (ReactCompositeComponentMixin.hasOwnProperty(name)) {\n invariant(\n specPolicy === SpecPolicy.OVERRIDE_BASE,\n 'ReactCompositeComponentInterface: You are attempting to override ' +\n '`%s` from your class specification. Ensure that your method names ' +\n 'do not overlap with React methods.',\n name\n );\n }\n\n // Disallow defining methods more than once unless explicitly allowed.\n if (proto.hasOwnProperty(name)) {\n invariant(\n specPolicy === SpecPolicy.DEFINE_MANY ||\n specPolicy === SpecPolicy.DEFINE_MANY_MERGED,\n 'ReactCompositeComponentInterface: You are attempting to define ' +\n '`%s` on your component more than once. This conflict may be due ' +\n 'to a mixin.',\n name\n );\n }\n}\n\n\nfunction validateLifeCycleOnReplaceState(instance) {\n var compositeLifeCycleState = instance._compositeLifeCycleState;\n invariant(\n instance.isMounted() ||\n compositeLifeCycleState === CompositeLifeCycle.MOUNTING,\n 'replaceState(...): Can only update a mounted or mounting component.'\n );\n invariant(\n compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&\n compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,\n 'replaceState(...): Cannot update while unmounting component or during ' +\n 'an existing state transition (such as within `render`).'\n );\n}\n\n/**\n * Custom version of `mixInto` which handles policy validation and reserved\n * specification keys when building `ReactCompositeComponent` classses.\n */\nfunction mixSpecIntoComponent(Constructor, spec) {\n var proto = Constructor.prototype;\n for (var name in spec) {\n var property = spec[name];\n if (!spec.hasOwnProperty(name) || !property) {\n continue;\n }\n validateMethodOverride(proto, name);\n\n if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {\n RESERVED_SPEC_KEYS[name](Constructor, property);\n } else {\n // Setup methods on prototype:\n // The following member methods should not be automatically bound:\n // 1. Expected ReactCompositeComponent methods (in the \"interface\").\n // 2. Overridden methods (that were mixed in).\n var isCompositeComponentMethod = name in ReactCompositeComponentInterface;\n var isInherited = name in proto;\n var markedDontBind = property.__reactDontBind;\n var isFunction = typeof property === 'function';\n var shouldAutoBind =\n isFunction &&\n !isCompositeComponentMethod &&\n !isInherited &&\n !markedDontBind;\n\n if (shouldAutoBind) {\n if (!proto.__reactAutoBindMap) {\n proto.__reactAutoBindMap = {};\n }\n proto.__reactAutoBindMap[name] = property;\n proto[name] = property;\n } else {\n if (isInherited) {\n // For methods which are defined more than once, call the existing\n // methods before calling the new property.\n if (ReactCompositeComponentInterface[name] ===\n SpecPolicy.DEFINE_MANY_MERGED) {\n proto[name] = createMergedResultFunction(proto[name], property);\n } else {\n proto[name] = createChainedFunction(proto[name], property);\n }\n } else {\n proto[name] = property;\n }\n }\n }\n }\n}\n\n/**\n * Merge two objects, but throw if both contain the same key.\n *\n * @param {object} one The first object, which is mutated.\n * @param {object} two The second object\n * @return {object} one after it has been mutated to contain everything in two.\n */\nfunction mergeObjectsWithNoDuplicateKeys(one, two) {\n invariant(\n one && two && typeof one === 'object' && typeof two === 'object',\n 'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects'\n );\n\n objMap(two, function(value, key) {\n invariant(\n one[key] === undefined,\n 'mergeObjectsWithNoDuplicateKeys(): ' +\n 'Tried to merge two objects with the same key: %s',\n key\n );\n one[key] = value;\n });\n return one;\n}\n\n/**\n * Creates a function that invokes two functions and merges their return values.\n *\n * @param {function} one Function to invoke first.\n * @param {function} two Function to invoke second.\n * @return {function} Function that invokes the two argument functions.\n * @private\n */\nfunction createMergedResultFunction(one, two) {\n return function mergedResult() {\n return mergeObjectsWithNoDuplicateKeys(\n one.apply(this, arguments),\n two.apply(this, arguments)\n );\n };\n}\n\n/**\n * Creates a function that invokes two functions and ignores their return vales.\n *\n * @param {function} one Function to invoke first.\n * @param {function} two Function to invoke second.\n * @return {function} Function that invokes the two argument functions.\n * @private\n */\nfunction createChainedFunction(one, two) {\n return function chainedFunction() {\n one.apply(this, arguments);\n two.apply(this, arguments);\n };\n}\n\n/**\n * `ReactCompositeComponent` maintains an auxiliary life cycle state in\n * `this._compositeLifeCycleState` (which can be null).\n *\n * This is different from the life cycle state maintained by `ReactComponent` in\n * `this._lifeCycleState`. The following diagram shows how the states overlap in\n * time. There are times when the CompositeLifeCycle is null - at those times it\n * is only meaningful to look at ComponentLifeCycle alone.\n *\n * Top Row: ReactComponent.ComponentLifeCycle\n * Low Row: ReactComponent.CompositeLifeCycle\n *\n * +-------+------------------------------------------------------+--------+\n * | UN | MOUNTED | UN |\n * |MOUNTED| | MOUNTED|\n * +-------+------------------------------------------------------+--------+\n * | ^--------+ +------+ +------+ +------+ +--------^ |\n * | | | | | | | | | | | |\n * | 0--|MOUNTING|-0-|RECEIV|-0-|RECEIV|-0-|RECEIV|-0-| UN |--->0 |\n * | | | |PROPS | | PROPS| | STATE| |MOUNTING| |\n * | | | | | | | | | | | |\n * | | | | | | | | | | | |\n * | +--------+ +------+ +------+ +------+ +--------+ |\n * | | | |\n * +-------+------------------------------------------------------+--------+\n */\nvar CompositeLifeCycle = keyMirror({\n /**\n * Components in the process of being mounted respond to state changes\n * differently.\n */\n MOUNTING: null,\n /**\n * Components in the process of being unmounted are guarded against state\n * changes.\n */\n UNMOUNTING: null,\n /**\n * Components that are mounted and receiving new props respond to state\n * changes differently.\n */\n RECEIVING_PROPS: null,\n /**\n * Components that are mounted and receiving new state are guarded against\n * additional state changes.\n */\n RECEIVING_STATE: null\n});\n\n/**\n * @lends {ReactCompositeComponent.prototype}\n */\nvar ReactCompositeComponentMixin = {\n\n /**\n * Base constructor for all composite component.\n *\n * @param {?object} initialProps\n * @param {*} children\n * @final\n * @internal\n */\n construct: function(initialProps, children) {\n // Children can be either an array or more than one argument\n ReactComponent.Mixin.construct.apply(this, arguments);\n this.state = null;\n this._pendingState = null;\n this._compositeLifeCycleState = null;\n },\n\n /**\n * Checks whether or not this composite component is mounted.\n * @return {boolean} True if mounted, false otherwise.\n * @protected\n * @final\n */\n isMounted: function() {\n return ReactComponent.Mixin.isMounted.call(this) &&\n this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING;\n },\n\n /**\n * Initializes the component, renders markup, and registers event listeners.\n *\n * @param {string} rootID DOM ID of the root node.\n * @param {ReactReconcileTransaction} transaction\n * @param {number} mountDepth number of components in the owner hierarchy\n * @return {?string} Rendered markup to be inserted into the DOM.\n * @final\n * @internal\n */\n mountComponent: ReactPerf.measure(\n 'ReactCompositeComponent',\n 'mountComponent',\n function(rootID, transaction, mountDepth) {\n ReactComponent.Mixin.mountComponent.call(\n this,\n rootID,\n transaction,\n mountDepth\n );\n this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING;\n\n this._defaultProps = this.getDefaultProps ? this.getDefaultProps() : null;\n this._processProps(this.props);\n\n if (this.__reactAutoBindMap) {\n this._bindAutoBindMethods();\n }\n\n this.state = this.getInitialState ? this.getInitialState() : null;\n this._pendingState = null;\n this._pendingForceUpdate = false;\n\n if (this.componentWillMount) {\n this.componentWillMount();\n // When mounting, calls to `setState` by `componentWillMount` will set\n // `this._pendingState` without triggering a re-render.\n if (this._pendingState) {\n this.state = this._pendingState;\n this._pendingState = null;\n }\n }\n\n this._renderedComponent = this._renderValidatedComponent();\n\n // Done with mounting, `setState` will now trigger UI changes.\n this._compositeLifeCycleState = null;\n var markup = this._renderedComponent.mountComponent(\n rootID,\n transaction,\n mountDepth + 1\n );\n if (this.componentDidMount) {\n transaction.getReactMountReady().enqueue(this, this.componentDidMount);\n }\n return markup;\n }\n ),\n\n /**\n * Releases any resources allocated by `mountComponent`.\n *\n * @final\n * @internal\n */\n unmountComponent: function() {\n this._compositeLifeCycleState = CompositeLifeCycle.UNMOUNTING;\n if (this.componentWillUnmount) {\n this.componentWillUnmount();\n }\n this._compositeLifeCycleState = null;\n\n this._defaultProps = null;\n\n ReactComponent.Mixin.unmountComponent.call(this);\n this._renderedComponent.unmountComponent();\n this._renderedComponent = null;\n\n if (this.refs) {\n this.refs = null;\n }\n\n // Some existing components rely on this.props even after they've been\n // destroyed (in event handlers).\n // TODO: this.props = null;\n // TODO: this.state = null;\n },\n\n /**\n * Sets a subset of the state. Always use this or `replaceState` to mutate\n * state. You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * There is no guarantee that calls to `setState` will run synchronously,\n * as they may eventually be batched together. You can provide an optional\n * callback that will be executed when the call to setState is actually\n * completed.\n *\n * @param {object} partialState Next partial state to be merged with state.\n * @param {?function} callback Called after state is updated.\n * @final\n * @protected\n */\n setState: function(partialState, callback) {\n // Merge with `_pendingState` if it exists, otherwise with existing state.\n this.replaceState(\n merge(this._pendingState || this.state, partialState),\n callback\n );\n },\n\n /**\n * Replaces all of the state. Always use this or `setState` to mutate state.\n * You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * @param {object} completeState Next state.\n * @param {?function} callback Called after state is updated.\n * @final\n * @protected\n */\n replaceState: function(completeState, callback) {\n validateLifeCycleOnReplaceState(this);\n this._pendingState = completeState;\n ReactUpdates.enqueueUpdate(this, callback);\n },\n\n /**\n * Processes props by setting default values for unspecified props and\n * asserting that the props are valid.\n *\n * @param {object} props\n * @private\n */\n _processProps: function(props) {\n var propName;\n var defaultProps = this._defaultProps;\n for (propName in defaultProps) {\n if (typeof props[propName] === 'undefined') {\n props[propName] = defaultProps[propName];\n }\n }\n var propTypes = this.constructor.propTypes;\n if (propTypes) {\n var componentName = this.constructor.displayName;\n for (propName in propTypes) {\n var checkProp = propTypes[propName];\n if (checkProp) {\n checkProp(props, propName, componentName);\n }\n }\n }\n },\n\n performUpdateIfNecessary: function() {\n var compositeLifeCycleState = this._compositeLifeCycleState;\n // Do not trigger a state transition if we are in the middle of mounting or\n // receiving props because both of those will already be doing this.\n if (compositeLifeCycleState === CompositeLifeCycle.MOUNTING ||\n compositeLifeCycleState === CompositeLifeCycle.RECEIVING_PROPS) {\n return;\n }\n ReactComponent.Mixin.performUpdateIfNecessary.call(this);\n },\n\n /**\n * If any of `_pendingProps`, `_pendingState`, or `_pendingForceUpdate` is\n * set, update the component.\n *\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n _performUpdateIfNecessary: function(transaction) {\n if (this._pendingProps == null &&\n this._pendingState == null &&\n !this._pendingForceUpdate) {\n return;\n }\n\n var nextProps = this.props;\n if (this._pendingProps != null) {\n nextProps = this._pendingProps;\n this._processProps(nextProps);\n this._pendingProps = null;\n\n this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS;\n if (this.componentWillReceiveProps) {\n this.componentWillReceiveProps(nextProps, transaction);\n }\n }\n\n this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_STATE;\n\n var nextState = this._pendingState || this.state;\n this._pendingState = null;\n\n if (this._pendingForceUpdate ||\n !this.shouldComponentUpdate ||\n this.shouldComponentUpdate(nextProps, nextState)) {\n this._pendingForceUpdate = false;\n // Will set `this.props` and `this.state`.\n this._performComponentUpdate(nextProps, nextState, transaction);\n } else {\n // If it's determined that a component should not update, we still want\n // to set props and state.\n this.props = nextProps;\n this.state = nextState;\n }\n\n this._compositeLifeCycleState = null;\n },\n\n /**\n * Merges new props and state, notifies delegate methods of update and\n * performs update.\n *\n * @param {object} nextProps Next object to set as properties.\n * @param {?object} nextState Next object to set as state.\n * @param {ReactReconcileTransaction} transaction\n * @private\n */\n _performComponentUpdate: function(nextProps, nextState, transaction) {\n var prevProps = this.props;\n var prevState = this.state;\n\n if (this.componentWillUpdate) {\n this.componentWillUpdate(nextProps, nextState, transaction);\n }\n\n this.props = nextProps;\n this.state = nextState;\n\n this.updateComponent(transaction, prevProps, prevState);\n\n if (this.componentDidUpdate) {\n transaction.getReactMountReady().enqueue(\n this,\n this.componentDidUpdate.bind(this, prevProps, prevState)\n );\n }\n },\n\n /**\n * Updates the component's currently mounted DOM representation.\n *\n * By default, this implements React's rendering and reconciliation algorithm.\n * Sophisticated clients may wish to override this.\n *\n * @param {ReactReconcileTransaction} transaction\n * @param {object} prevProps\n * @param {?object} prevState\n * @internal\n * @overridable\n */\n updateComponent: ReactPerf.measure(\n 'ReactCompositeComponent',\n 'updateComponent',\n function(transaction, prevProps, prevState) {\n ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);\n var currentComponent = this._renderedComponent;\n var nextComponent = this._renderValidatedComponent();\n if (currentComponent.constructor === nextComponent.constructor) {\n currentComponent.receiveProps(nextComponent.props, transaction);\n } else {\n // These two IDs are actually the same! But nothing should rely on that.\n var thisID = this._rootNodeID;\n var currentComponentID = currentComponent._rootNodeID;\n currentComponent.unmountComponent();\n this._renderedComponent = nextComponent;\n var nextMarkup = nextComponent.mountComponent(\n thisID,\n transaction,\n this._mountDepth + 1\n );\n ReactComponent.DOMIDOperations.dangerouslyReplaceNodeWithMarkupByID(\n currentComponentID,\n nextMarkup\n );\n }\n }\n ),\n\n /**\n * Forces an update. This should only be invoked when it is known with\n * certainty that we are **not** in a DOM transaction.\n *\n * You may want to call this when you know that some deeper aspect of the\n * component's state has changed but `setState` was not called.\n *\n * This will not invoke `shouldUpdateComponent`, but it will invoke\n * `componentWillUpdate` and `componentDidUpdate`.\n *\n * @param {?function} callback Called after update is complete.\n * @final\n * @protected\n */\n forceUpdate: function(callback) {\n var compositeLifeCycleState = this._compositeLifeCycleState;\n invariant(\n this.isMounted() ||\n compositeLifeCycleState === CompositeLifeCycle.MOUNTING,\n 'forceUpdate(...): Can only force an update on mounted or mounting ' +\n 'components.'\n );\n invariant(\n compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&\n compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,\n 'forceUpdate(...): Cannot force an update while unmounting component ' +\n 'or during an existing state transition (such as within `render`).'\n );\n this._pendingForceUpdate = true;\n ReactUpdates.enqueueUpdate(this, callback);\n },\n\n /**\n * @private\n */\n _renderValidatedComponent: function() {\n var renderedComponent;\n ReactCurrentOwner.current = this;\n try {\n renderedComponent = this.render();\n } catch (error) {\n // IE8 requires `catch` in order to use `finally`.\n throw error;\n } finally {\n ReactCurrentOwner.current = null;\n }\n invariant(\n ReactComponent.isValidComponent(renderedComponent),\n '%s.render(): A valid ReactComponent must be returned.',\n this.constructor.displayName || 'ReactCompositeComponent'\n );\n return renderedComponent;\n },\n\n /**\n * @private\n */\n _bindAutoBindMethods: function() {\n for (var autoBindKey in this.__reactAutoBindMap) {\n if (!this.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {\n continue;\n }\n var method = this.__reactAutoBindMap[autoBindKey];\n this[autoBindKey] = this._bindAutoBindMethod(method);\n }\n },\n\n /**\n * Binds a method to the component.\n *\n * @param {function} method Method to be bound.\n * @private\n */\n _bindAutoBindMethod: function(method) {\n var component = this;\n var boundMethod = function() {\n return method.apply(component, arguments);\n };\n if (true) {\n boundMethod.__reactBoundContext = component;\n boundMethod.__reactBoundMethod = method;\n boundMethod.__reactBoundArguments = null;\n var componentName = component.constructor.displayName;\n var _bind = boundMethod.bind;\n boundMethod.bind = function(newThis) {\n // User is trying to bind() an autobound method; we effectively will\n // ignore the value of \"this\" that the user is trying to use, so\n // let's warn.\n if (newThis !== component && newThis !== null) {\n console.warn(\n 'bind(): React component methods may only be bound to the ' +\n 'component instance. See ' + componentName\n );\n } else if (arguments.length === 1) {\n console.warn(\n 'bind(): You are binding a component method to the component. ' +\n 'React does this for you automatically in a high-performance ' +\n 'way, so you can safely remove this call. See ' + componentName\n );\n return boundMethod;\n }\n var reboundMethod = _bind.apply(boundMethod, arguments);\n reboundMethod.__reactBoundContext = component;\n reboundMethod.__reactBoundMethod = method;\n reboundMethod.__reactBoundArguments =\n Array.prototype.slice.call(arguments, 1);\n return reboundMethod;\n };\n }\n return boundMethod;\n }\n};\n\nvar ReactCompositeComponentBase = function() {};\nmixInto(ReactCompositeComponentBase, ReactComponent.Mixin);\nmixInto(ReactCompositeComponentBase, ReactOwner.Mixin);\nmixInto(ReactCompositeComponentBase, ReactPropTransferer.Mixin);\nmixInto(ReactCompositeComponentBase, ReactCompositeComponentMixin);\n\n/**\n * Module for creating composite components.\n *\n * @class ReactCompositeComponent\n * @extends ReactComponent\n * @extends ReactOwner\n * @extends ReactPropTransferer\n */\nvar ReactCompositeComponent = {\n\n LifeCycle: CompositeLifeCycle,\n\n Base: ReactCompositeComponentBase,\n\n /**\n * Creates a composite component class given a class specification.\n *\n * @param {object} spec Class specification (which must define `render`).\n * @return {function} Component constructor function.\n * @public\n */\n createClass: function(spec) {\n var Constructor = function() {};\n Constructor.prototype = new ReactCompositeComponentBase();\n Constructor.prototype.constructor = Constructor;\n mixSpecIntoComponent(Constructor, spec);\n\n invariant(\n Constructor.prototype.render,\n 'createClass(...): Class specification must implement a `render` method.'\n );\n\n if (true) {\n if (Constructor.prototype.componentShouldUpdate) {\n console.warn(\n (spec.displayName || 'A component') + ' has a method called ' +\n 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +\n 'The name is phrased as a question because the function is ' +\n 'expected to return a value.'\n );\n }\n }\n\n // Reduce time spent doing lookups by setting these on the prototype.\n for (var methodName in ReactCompositeComponentInterface) {\n if (!Constructor.prototype[methodName]) {\n Constructor.prototype[methodName] = null;\n }\n }\n\n var ConvenienceConstructor = function(props, children) {\n var instance = new Constructor();\n instance.construct.apply(instance, arguments);\n return instance;\n };\n ConvenienceConstructor.componentConstructor = Constructor;\n ConvenienceConstructor.originalSpec = spec;\n return ConvenienceConstructor;\n },\n\n /**\n * Checks if a value is a valid component constructor.\n *\n * @param {*}\n * @return {boolean}\n * @public\n */\n isValidClass: function(componentClass) {\n return componentClass instanceof Function &&\n 'componentConstructor' in componentClass &&\n componentClass.componentConstructor instanceof Function;\n }\n};\n\nmodule.exports = ReactCompositeComponent;\n\nrequire(\"./mock-modules\").register(\"ReactCompositeComponent\", module);\n",
"ReactCurrentOwner":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactCurrentOwner\n */\n\n\"use strict\";\n\n/**\n * Keeps track of the current owner.\n *\n * The current owner is the component who should own any components that are\n * currently being constructed.\n *\n * The depth indicate how many composite components are above this render level.\n */\nvar ReactCurrentOwner = {\n\n /**\n * @internal\n * @type {ReactComponent}\n */\n current: null\n\n};\n\nmodule.exports = ReactCurrentOwner;\n\nrequire(\"./mock-modules\").register(\"ReactCurrentOwner\", module);\n",
"cx":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule cx\n */\n\n/**\n * This function is used to mark string literals representing CSS class names\n * so that they can be transformed statically. This allows for modularization\n * and minification of CSS class names.\n *\n * In static_upstream, this function is actually implemented, but it should\n * eventually be replaced with something more descriptive, and the transform\n * that is used in the main stack should be ported for use elsewhere.\n *\n * @param string|object className to modularize, or an object of key/values.\n * In the object case, the values are conditions that\n * determine if the className keys should be included.\n * @param [string ...] Variable list of classNames in the string case.\n * @return string Renderable space-separated CSS className.\n */\nfunction cx(classNames) {\n if (typeof classNames == 'object') {\n return Object.keys(classNames).map(function(className) {\n return classNames[className] ? className : '';\n }).join(' ');\n } else {\n return Array.prototype.join.call(arguments, ' ');\n }\n}\n\nmodule.exports = cx;\n\nrequire(\"./mock-modules\").register(\"cx\", module);\n",
"ReactPropTypes":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactPropTypes\n */\n\n\"use strict\";\n\nvar createObjectFrom = require(\"./createObjectFrom\");\nvar invariant = require(\"./invariant\");\n\n/**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var Props = require('ReactPropTypes');\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * invariant(\n * propValue == null ||\n * typeof propValue === 'string' ||\n * propValue instanceof URI,\n * 'Invalid `%s` supplied to `%s`, expected string or URI.',\n * propName,\n * componentName\n * );\n * }\n * },\n * render: function() { ... }\n * });\n *\n * @internal\n */\nvar Props = {\n\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n\n oneOf: createEnumTypeChecker,\n\n instanceOf: createInstanceTypeChecker\n\n};\n\nvar ANONYMOUS = '<<anonymous>>';\n\nfunction createPrimitiveTypeChecker(expectedType) {\n function validatePrimitiveType(propValue, propName, componentName) {\n var propType = typeof propValue;\n if (propType === 'object' && Array.isArray(propValue)) {\n propType = 'array';\n }\n invariant(\n propType === expectedType,\n 'Invalid prop `%s` of type `%s` supplied to `%s`, expected `%s`.',\n propName,\n propType,\n componentName,\n expectedType\n );\n }\n return createChainableTypeChecker(validatePrimitiveType);\n}\n\nfunction createEnumTypeChecker(expectedValues) {\n var expectedEnum = createObjectFrom(expectedValues);\n function validateEnumType(propValue, propName, componentName) {\n invariant(\n expectedEnum[propValue],\n 'Invalid prop `%s` supplied to `%s`, expected one of %s.',\n propName,\n componentName,\n JSON.stringify(Object.keys(expectedEnum))\n );\n }\n return createChainableTypeChecker(validateEnumType);\n}\n\nfunction createInstanceTypeChecker(expectedClass) {\n function validateInstanceType(propValue, propName, componentName) {\n invariant(\n propValue instanceof expectedClass,\n 'Invalid prop `%s` supplied to `%s`, expected instance of `%s`.',\n propName,\n componentName,\n expectedClass.name || ANONYMOUS\n );\n }\n return createChainableTypeChecker(validateInstanceType);\n}\n\nfunction createChainableTypeChecker(validate) {\n function createTypeChecker(isRequired) {\n function checkType(props, propName, componentName) {\n var propValue = props[propName];\n if (propValue != null) {\n // Only validate if there is a value to check.\n validate(propValue, propName, componentName || ANONYMOUS);\n } else {\n invariant(\n !isRequired,\n 'Required prop `%s` was not specified in `%s`.',\n propName,\n componentName || ANONYMOUS\n );\n }\n }\n if (!isRequired) {\n checkType.isRequired = createTypeChecker(true);\n }\n return checkType;\n }\n return createTypeChecker(false);\n}\n\nmodule.exports = Props;\n\nrequire(\"./mock-modules\").register(\"ReactPropTypes\", module);\n",
"ReactMount":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactMount\n */\n\n\"use strict\";\n\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar ReactInstanceHandles = require(\"./ReactInstanceHandles\");\n\nvar $ = require(\"./$\");\nvar getReactRootElementInContainer = require(\"./getReactRootElementInContainer\");\nvar invariant = require(\"./invariant\");\nvar nodeContains = require(\"./nodeContains\");\n\nvar SEPARATOR = ReactInstanceHandles.SEPARATOR;\n\nvar ATTR_NAME = 'data-reactid';\nvar nodeCache = {};\n\nvar ELEMENT_NODE_TYPE = 1;\nvar DOC_NODE_TYPE = 9;\n\n/** Mapping from reactRootID to React component instance. */\nvar instancesByReactRootID = {};\n\n/** Mapping from reactRootID to `container` nodes. */\nvar containersByReactRootID = {};\n\nif (true) {\n /** __DEV__-only mapping from reactRootID to root elements. */\n var rootElementsByReactRootID = {};\n}\n\n/**\n * @param {DOMElement} container DOM element that may contain a React component.\n * @return {?string} A \"reactRoot\" ID, if a React component is rendered.\n */\nfunction getReactRootID(container) {\n var rootElement = getReactRootElementInContainer(container);\n return rootElement && ReactMount.getID(rootElement);\n}\n\n/**\n * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form\n * element can return its control whose name or ID equals ATTR_NAME. All\n * DOM nodes support `getAttributeNode` but this can also get called on\n * other objects so just return '' if we're given something other than a\n * DOM node (such as window).\n *\n * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.\n * @return {string} ID of the supplied `domNode`.\n */\nfunction getID(node) {\n var id = internalGetID(node);\n if (id) {\n if (nodeCache.hasOwnProperty(id)) {\n var cached = nodeCache[id];\n if (cached !== node) {\n invariant(\n !isValid(cached, id),\n 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',\n ATTR_NAME, id\n );\n\n nodeCache[id] = node;\n }\n } else {\n nodeCache[id] = node;\n }\n }\n\n return id;\n}\n\nfunction internalGetID(node) {\n // If node is something like a window, document, or text node, none of\n // which support attributes or a .getAttribute method, gracefully return\n // the empty string, as if the attribute were missing.\n return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';\n}\n\n/**\n * Sets the React-specific ID of the given node.\n *\n * @param {DOMElement} node The DOM node whose ID will be set.\n * @param {string} id The value of the ID attribute.\n */\nfunction setID(node, id) {\n var oldID = internalGetID(node);\n if (oldID !== id) {\n delete nodeCache[oldID];\n }\n node.setAttribute(ATTR_NAME, id);\n nodeCache[id] = node;\n}\n\n/**\n * Finds the node with the supplied React-generated DOM ID.\n *\n * @param {string} id A React-generated DOM ID.\n * @return {DOMElement} DOM node with the suppled `id`.\n * @internal\n */\nfunction getNode(id) {\n if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {\n nodeCache[id] = ReactMount.findReactNodeByID(id);\n }\n return nodeCache[id];\n}\n\n/**\n * A node is \"valid\" if it is contained by a currently mounted container.\n *\n * This means that the node does not have to be contained by a document in\n * order to be considered valid.\n *\n * @param {?DOMElement} node The candidate DOM node.\n * @param {string} id The expected ID of the node.\n * @return {boolean} Whether the node is contained by a mounted container.\n */\nfunction isValid(node, id) {\n if (node) {\n invariant(\n internalGetID(node) === id,\n 'ReactMount: Unexpected modification of `%s`',\n ATTR_NAME\n );\n\n var container = ReactMount.findReactContainerForID(id);\n if (container && nodeContains(container, node)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Causes the cache to forget about one React-specific ID.\n *\n * @param {string} id The ID to forget.\n */\nfunction purgeID(id) {\n delete nodeCache[id];\n}\n\n/**\n * Mounting is the process of initializing a React component by creatings its\n * representative DOM elements and inserting them into a supplied `container`.\n * Any prior content inside `container` is destroyed in the process.\n *\n * ReactMount.renderComponent(component, $('container'));\n *\n * <div id=\"container\"> <-- Supplied `container`.\n * <div data-reactid=\".r[3]\"> <-- Rendered reactRoot of React\n * // ... component.\n * </div>\n * </div>\n *\n * Inside of `container`, the first element rendered is the \"reactRoot\".\n */\nvar ReactMount = {\n /**\n * Safety guard to prevent accidentally rendering over the entire HTML tree.\n */\n allowFullPageRender: false,\n\n /** Time spent generating markup. */\n totalInstantiationTime: 0,\n\n /** Time spent inserting markup into the DOM. */\n totalInjectionTime: 0,\n\n /** Whether support for touch events should be initialized. */\n useTouchEvents: false,\n\n /** Exposed for debugging purposes **/\n _instancesByReactRootID: instancesByReactRootID,\n\n /**\n * This is a hook provided to support rendering React components while\n * ensuring that the apparent scroll position of its `container` does not\n * change.\n *\n * @param {DOMElement} container The `container` being rendered into.\n * @param {function} renderCallback This must be called once to do the render.\n */\n scrollMonitor: function(container, renderCallback) {\n renderCallback();\n },\n\n /**\n * Ensures that the top-level event delegation listener is set up. This will\n * be invoked some time before the first time any React component is rendered.\n * @param {DOMElement} container container we're rendering into\n *\n * @private\n */\n prepareEnvironmentForDOM: function(container) {\n invariant(\n container && (\n container.nodeType === ELEMENT_NODE_TYPE ||\n container.nodeType === DOC_NODE_TYPE\n ),\n 'prepareEnvironmentForDOM(...): Target container is not a DOM element.'\n );\n var doc = container.nodeType === ELEMENT_NODE_TYPE ?\n container.ownerDocument :\n container;\n ReactEventEmitter.ensureListening(ReactMount.useTouchEvents, doc);\n },\n\n /**\n * Take a component that's already mounted into the DOM and replace its props\n * @param {ReactComponent} prevComponent component instance already in the DOM\n * @param {ReactComponent} nextComponent component instance to render\n * @param {DOMElement} container container to render into\n * @param {?function} callback function triggered on completion\n */\n _updateRootComponent: function(\n prevComponent,\n nextComponent,\n container,\n callback) {\n var nextProps = nextComponent.props;\n ReactMount.scrollMonitor(container, function() {\n prevComponent.replaceProps(nextProps, callback);\n });\n\n if (true) {\n // Record the root element in case it later gets transplanted.\n rootElementsByReactRootID[getReactRootID(container)] =\n getReactRootElementInContainer(container);\n }\n\n return prevComponent;\n },\n\n /**\n * Register a component into the instance map and start the events system.\n * @param {ReactComponent} nextComponent component instance to render\n * @param {DOMElement} container container to render into\n * @return {string} reactRoot ID prefix\n */\n _registerComponent: function(nextComponent, container) {\n ReactMount.prepareEnvironmentForDOM(container);\n\n var reactRootID = ReactMount.registerContainer(container);\n instancesByReactRootID[reactRootID] = nextComponent;\n return reactRootID;\n },\n\n /**\n * Render a new component into the DOM.\n * @param {ReactComponent} nextComponent component instance to render\n * @param {DOMElement} container container to render into\n * @param {boolean} shouldReuseMarkup if we should skip the markup insertion\n * @return {ReactComponent} nextComponent\n */\n _renderNewRootComponent: function(\n nextComponent,\n container,\n shouldReuseMarkup) {\n var reactRootID = ReactMount._registerComponent(nextComponent, container);\n nextComponent.mountComponentIntoNode(\n reactRootID,\n container,\n shouldReuseMarkup\n );\n\n if (true) {\n // Record the root element in case it later gets transplanted.\n rootElementsByReactRootID[reactRootID] =\n getReactRootElementInContainer(container);\n }\n\n return nextComponent;\n },\n\n /**\n * Renders a React component into the DOM in the supplied `container`.\n *\n * If the React component was previously rendered into `container`, this will\n * perform an update on it and only mutate the DOM as necessary to reflect the\n * latest React component.\n *\n * @param {ReactComponent} nextComponent Component instance to render.\n * @param {DOMElement} container DOM element to render into.\n * @param {?function} callback function triggered on completion\n * @return {ReactComponent} Component instance rendered in `container`.\n */\n renderComponent: function(nextComponent, container, callback) {\n var registeredComponent = instancesByReactRootID[getReactRootID(container)];\n\n if (registeredComponent) {\n if (registeredComponent.constructor === nextComponent.constructor) {\n return ReactMount._updateRootComponent(\n registeredComponent,\n nextComponent,\n container,\n callback\n );\n } else {\n ReactMount.unmountComponentAtNode(container);\n }\n }\n\n var reactRootElement = getReactRootElementInContainer(container);\n var containerHasReactMarkup =\n reactRootElement && ReactMount.isRenderedByReact(reactRootElement);\n\n var shouldReuseMarkup = containerHasReactMarkup && !registeredComponent;\n\n var component = ReactMount._renderNewRootComponent(\n nextComponent,\n container,\n shouldReuseMarkup\n );\n callback && callback();\n return component;\n },\n\n /**\n * Constructs a component instance of `constructor` with `initialProps` and\n * renders it into the supplied `container`.\n *\n * @param {function} constructor React component constructor.\n * @param {?object} props Initial props of the component instance.\n * @param {DOMElement} container DOM element to render into.\n * @return {ReactComponent} Component instance rendered in `container`.\n */\n constructAndRenderComponent: function(constructor, props, container) {\n return ReactMount.renderComponent(constructor(props), container);\n },\n\n /**\n * Constructs a component instance of `constructor` with `initialProps` and\n * renders it into a container node identified by supplied `id`.\n *\n * @param {function} componentConstructor React component constructor\n * @param {?object} props Initial props of the component instance.\n * @param {string} id ID of the DOM element to render into.\n * @return {ReactComponent} Component instance rendered in the container node.\n */\n constructAndRenderComponentByID: function(constructor, props, id) {\n return ReactMount.constructAndRenderComponent(constructor, props, $(id));\n },\n\n /**\n * Registers a container node into which React components will be rendered.\n * This also creates the \"reatRoot\" ID that will be assigned to the element\n * rendered within.\n *\n * @param {DOMElement} container DOM element to register as a container.\n * @return {string} The \"reactRoot\" ID of elements rendered within.\n */\n registerContainer: function(container) {\n var reactRootID = getReactRootID(container);\n if (reactRootID) {\n // If one exists, make sure it is a valid \"reactRoot\" ID.\n reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);\n }\n if (!reactRootID) {\n // No valid \"reactRoot\" ID found, create one.\n reactRootID = ReactInstanceHandles.createReactRootID();\n }\n containersByReactRootID[reactRootID] = container;\n return reactRootID;\n },\n\n /**\n * Unmounts and destroys the React component rendered in the `container`.\n *\n * @param {DOMElement} container DOM element containing a React component.\n * @return {boolean} True if a component was found in and unmounted from\n * `container`\n */\n unmountComponentAtNode: function(container) {\n var reactRootID = getReactRootID(container);\n var component = instancesByReactRootID[reactRootID];\n if (!component) {\n return false;\n }\n ReactMount.unmountComponentFromNode(component, container);\n delete instancesByReactRootID[reactRootID];\n delete containersByReactRootID[reactRootID];\n if (true) {\n delete rootElementsByReactRootID[reactRootID];\n }\n return true;\n },\n\n /**\n * @deprecated\n */\n unmountAndReleaseReactRootNode: function() {\n if (true) {\n console.warn(\n 'unmountAndReleaseReactRootNode() has been renamed to ' +\n 'unmountComponentAtNode() and will be removed in the next ' +\n 'version of React.'\n );\n }\n return ReactMount.unmountComponentAtNode.apply(this, arguments);\n },\n\n /**\n * Unmounts a component and removes it from the DOM.\n *\n * @param {ReactComponent} instance React component instance.\n * @param {DOMElement} container DOM element to unmount from.\n * @final\n * @internal\n * @see {ReactMount.unmountComponentAtNode}\n */\n unmountComponentFromNode: function(instance, container) {\n instance.unmountComponent();\n\n // http://jsperf.com/emptying-a-node\n while (container.lastChild) {\n container.removeChild(container.lastChild);\n }\n },\n\n /**\n * Finds the container DOM element that contains React component to which the\n * supplied DOM `id` belongs.\n *\n * @param {string} id The ID of an element rendered by a React component.\n * @return {?DOMElement} DOM element that contains the `id`.\n */\n findReactContainerForID: function(id) {\n var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);\n var container = containersByReactRootID[reactRootID];\n\n if (true) {\n var rootElement = rootElementsByReactRootID[reactRootID];\n if (rootElement && rootElement.parentNode !== container) {\n invariant(\n // Call internalGetID here because getID calls isValid which calls\n // findReactContainerForID (this function).\n internalGetID(rootElement) === reactRootID,\n 'ReactMount: Root element ID differed from reactRootID.'\n );\n\n var containerChild = container.firstChild;\n if (containerChild &&\n reactRootID === internalGetID(containerChild)) {\n // If the container has a new child with the same ID as the old\n // root element, then rootElementsByReactRootID[reactRootID] is\n // just stale and needs to be updated. The case that deserves a\n // warning is when the container is empty.\n rootElementsByReactRootID[reactRootID] = containerChild;\n } else {\n console.warn(\n 'ReactMount: Root element has been removed from its original ' +\n 'container. New container:', rootElement.parentNode\n );\n }\n }\n }\n\n return container;\n },\n\n /**\n * Finds an element rendered by React with the supplied ID.\n *\n * @param {string} id ID of a DOM node in the React component.\n * @return {DOMElement} Root DOM node of the React component.\n */\n findReactNodeByID: function(id) {\n var reactRoot = ReactMount.findReactContainerForID(id);\n return ReactMount.findComponentRoot(reactRoot, id);\n },\n\n /**\n * True if the supplied `node` is rendered by React.\n *\n * @param {*} node DOM Element to check.\n * @return {boolean} True if the DOM Element appears to be rendered by React.\n * @internal\n */\n isRenderedByReact: function(node) {\n if (node.nodeType !== 1) {\n // Not a DOMElement, therefore not a React component\n return false;\n }\n var id = ReactMount.getID(node);\n return id ? id.charAt(0) === SEPARATOR : false;\n },\n\n /**\n * Traverses up the ancestors of the supplied node to find a node that is a\n * DOM representation of a React component.\n *\n * @param {*} node\n * @return {?DOMEventTarget}\n * @internal\n */\n getFirstReactDOM: function(node) {\n var current = node;\n while (current && current.parentNode !== current) {\n if (ReactMount.isRenderedByReact(current)) {\n return current;\n }\n current = current.parentNode;\n }\n return null;\n },\n\n /**\n * Finds a node with the supplied `id` inside of the supplied `ancestorNode`.\n * Exploits the ID naming scheme to perform the search quickly.\n *\n * @param {DOMEventTarget} ancestorNode Search from this root.\n * @pararm {string} id ID of the DOM representation of the component.\n * @return {DOMEventTarget} DOM node with the supplied `id`.\n * @internal\n */\n findComponentRoot: function(ancestorNode, id) {\n var firstChildren = [ancestorNode.firstChild];\n var childIndex = 0;\n\n while (childIndex < firstChildren.length) {\n var child = firstChildren[childIndex++];\n while (child) {\n var childID = ReactMount.getID(child);\n if (childID) {\n if (id === childID) {\n return child;\n } else if (ReactInstanceHandles.isAncestorIDOf(childID, id)) {\n // If we find a child whose ID is an ancestor of the given ID,\n // then we can be sure that we only want to search the subtree\n // rooted at this child, so we can throw out the rest of the\n // search state.\n firstChildren.length = childIndex = 0;\n firstChildren.push(child.firstChild);\n break;\n } else {\n // TODO This should not be necessary if the ID hierarchy is\n // correct, but is occasionally necessary if the DOM has been\n // modified in unexpected ways.\n firstChildren.push(child.firstChild);\n }\n } else {\n // If this child had no ID, then there's a chance that it was\n // injected automatically by the browser, as when a `<table>`\n // element sprouts an extra `<tbody>` child as a side effect of\n // `.innerHTML` parsing. Optimistically continue down this\n // branch, but not before examining the other siblings.\n firstChildren.push(child.firstChild);\n }\n child = child.nextSibling;\n }\n }\n\n if (true) {\n console.error(\n 'Error while invoking `findComponentRoot` with the following ' +\n 'ancestor node:',\n ancestorNode\n );\n }\n invariant(\n false,\n 'findComponentRoot(..., %s): Unable to find element. This probably ' +\n 'means the DOM was unexpectedly mutated (e.g. by the browser).',\n id,\n ReactMount.getID(ancestorNode)\n );\n },\n\n\n /**\n * React ID utilities.\n */\n\n ATTR_NAME: ATTR_NAME,\n\n getID: getID,\n\n setID: setID,\n\n getNode: getNode,\n\n purgeID: purgeID,\n\n injection: {}\n};\n\nmodule.exports = ReactMount;\n\nrequire(\"./mock-modules\").register(\"ReactMount\", module);\n",
"ReactDOM":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOM\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ReactDOMComponent = require(\"./ReactDOMComponent\");\n\nvar mergeInto = require(\"./mergeInto\");\nvar objMapKeyVal = require(\"./objMapKeyVal\");\n\n/**\n * Creates a new React class that is idempotent and capable of containing other\n * React components. It accepts event listeners and DOM properties that are\n * valid according to `DOMProperty`.\n *\n * - Event listeners: `onClick`, `onMouseDown`, etc.\n * - DOM properties: `className`, `name`, `title`, etc.\n *\n * The `style` property functions differently from the DOM API. It accepts an\n * object mapping of style properties to values.\n *\n * @param {string} tag Tag name (e.g. `div`).\n * @param {boolean} omitClose True if the close tag should be omitted.\n * @private\n */\nfunction createDOMComponentClass(tag, omitClose) {\n var Constructor = function() {};\n Constructor.prototype = new ReactDOMComponent(tag, omitClose);\n Constructor.prototype.constructor = Constructor;\n Constructor.displayName = tag;\n\n var ConvenienceConstructor = function(props, children) {\n var instance = new Constructor();\n instance.construct.apply(instance, arguments);\n return instance;\n };\n ConvenienceConstructor.componentConstructor = Constructor;\n return ConvenienceConstructor;\n}\n\n/**\n * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.\n * This is also accessible via `React.DOM`.\n *\n * @public\n */\nvar ReactDOM = objMapKeyVal({\n a: false,\n abbr: false,\n address: false,\n area: false,\n article: false,\n aside: false,\n audio: false,\n b: false,\n base: false,\n bdi: false,\n bdo: false,\n big: false,\n blockquote: false,\n body: false,\n br: true,\n button: false,\n canvas: false,\n caption: false,\n cite: false,\n code: false,\n col: true,\n colgroup: false,\n data: false,\n datalist: false,\n dd: false,\n del: false,\n details: false,\n dfn: false,\n div: false,\n dl: false,\n dt: false,\n em: false,\n embed: true,\n fieldset: false,\n figcaption: false,\n figure: false,\n footer: false,\n form: false, // NOTE: Injected, see `ReactDOMForm`.\n h1: false,\n h2: false,\n h3: false,\n h4: false,\n h5: false,\n h6: false,\n head: false,\n header: false,\n hr: true,\n html: false,\n i: false,\n iframe: false,\n img: true,\n input: true,\n ins: false,\n kbd: false,\n keygen: true,\n label: false,\n legend: false,\n li: false,\n link: false,\n main: false,\n map: false,\n mark: false,\n menu: false,\n menuitem: false, // NOTE: Close tag should be omitted, but causes problems.\n meta: true,\n meter: false,\n nav: false,\n noscript: false,\n object: false,\n ol: false,\n optgroup: false,\n option: false,\n output: false,\n p: false,\n param: true,\n pre: false,\n progress: false,\n q: false,\n rp: false,\n rt: false,\n ruby: false,\n s: false,\n samp: false,\n script: false,\n section: false,\n select: false,\n small: false,\n source: false,\n span: false,\n strong: false,\n style: false,\n sub: false,\n summary: false,\n sup: false,\n table: false,\n tbody: false,\n td: false,\n textarea: false, // NOTE: Injected, see `ReactDOMTextarea`.\n tfoot: false,\n th: false,\n thead: false,\n time: false,\n title: false,\n tr: false,\n track: true,\n u: false,\n ul: false,\n 'var': false,\n video: false,\n wbr: false,\n\n // SVG\n circle: false,\n g: false,\n line: false,\n path: false,\n polyline: false,\n rect: false,\n svg: false,\n text: false\n}, createDOMComponentClass);\n\nvar injection = {\n injectComponentClasses: function(componentClasses) {\n mergeInto(ReactDOM, componentClasses);\n }\n};\n\nReactDOM.injection = injection;\n\nmodule.exports = ReactDOM;\n\nrequire(\"./mock-modules\").register(\"ReactDOM\", module);\n",
"ReactReconcileTransaction":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactReconcileTransaction\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\nvar PooledClass = require(\"./PooledClass\");\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar ReactInputSelection = require(\"./ReactInputSelection\");\nvar ReactMountReady = require(\"./ReactMountReady\");\nvar Transaction = require(\"./Transaction\");\n\nvar mixInto = require(\"./mixInto\");\n\n/**\n * Ensures that, when possible, the selection range (currently selected text\n * input) is not disturbed by performing the transaction.\n */\nvar SELECTION_RESTORATION = {\n /**\n * @return {Selection} Selection information.\n */\n initialize: ReactInputSelection.getSelectionInformation,\n /**\n * @param {Selection} sel Selection information returned from `initialize`.\n */\n close: ReactInputSelection.restoreSelection\n};\n\n/**\n * Suppresses events (blur/focus) that could be inadvertently dispatched due to\n * high level DOM manipulations (like temporarily removing a text input from the\n * DOM).\n */\nvar EVENT_SUPPRESSION = {\n /**\n * @return {boolean} The enabled status of `ReactEventEmitter` before the\n * reconciliation.\n */\n initialize: function() {\n var currentlyEnabled = ReactEventEmitter.isEnabled();\n ReactEventEmitter.setEnabled(false);\n return currentlyEnabled;\n },\n\n /**\n * @param {boolean} previouslyEnabled Enabled status of `ReactEventEmitter`\n * before the reconciliation occured. `close` restores the previous value.\n */\n close: function(previouslyEnabled) {\n ReactEventEmitter.setEnabled(previouslyEnabled);\n }\n};\n\n/**\n * Provides a `ReactMountReady` queue for collecting `onDOMReady` callbacks\n * during the performing of the transaction.\n */\nvar ON_DOM_READY_QUEUEING = {\n /**\n * Initializes the internal `onDOMReady` queue.\n */\n initialize: function() {\n this.reactMountReady.reset();\n },\n\n /**\n * After DOM is flushed, invoke all registered `onDOMReady` callbacks.\n */\n close: function() {\n this.reactMountReady.notifyAll();\n }\n};\n\n/**\n * Executed within the scope of the `Transaction` instance. Consider these as\n * being member methods, but with an implied ordering while being isolated from\n * each other.\n */\nvar TRANSACTION_WRAPPERS = [\n SELECTION_RESTORATION,\n EVENT_SUPPRESSION,\n ON_DOM_READY_QUEUEING\n];\n\n/**\n * Currently:\n * - The order that these are listed in the transaction is critical:\n * - Suppresses events.\n * - Restores selection range.\n *\n * Future:\n * - Restore document/overflow scroll positions that were unintentionally\n * modified via DOM insertions above the top viewport boundary.\n * - Implement/integrate with customized constraint based layout system and keep\n * track of which dimensions must be remeasured.\n *\n * @class ReactReconcileTransaction\n */\nfunction ReactReconcileTransaction() {\n this.reinitializeTransaction();\n this.reactMountReady = ReactMountReady.getPooled(null);\n}\n\nvar Mixin = {\n /**\n * @see Transaction\n * @abstract\n * @final\n * @return {array<object>} List of operation wrap proceedures.\n * TODO: convert to array<TransactionWrapper>\n */\n getTransactionWrappers: function() {\n if (ExecutionEnvironment.canUseDOM) {\n return TRANSACTION_WRAPPERS;\n } else {\n return [];\n }\n },\n\n /**\n * @return {object} The queue to collect `onDOMReady` callbacks with.\n * TODO: convert to ReactMountReady\n */\n getReactMountReady: function() {\n return this.reactMountReady;\n },\n\n /**\n * `PooledClass` looks for this, and will invoke this before allowing this\n * instance to be resused.\n */\n destructor: function() {\n ReactMountReady.release(this.reactMountReady);\n this.reactMountReady = null;\n }\n};\n\n\nmixInto(ReactReconcileTransaction, Transaction.Mixin);\nmixInto(ReactReconcileTransaction, Mixin);\n\nPooledClass.addPoolingTo(ReactReconcileTransaction);\n\nmodule.exports = ReactReconcileTransaction;\n\nrequire(\"./mock-modules\").register(\"ReactReconcileTransaction\", module);\n",
"ReactDefaultInjection":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDefaultInjection\n */\n\n\"use strict\";\n\nvar ReactDOM = require(\"./ReactDOM\");\nvar ReactDOMButton = require(\"./ReactDOMButton\");\nvar ReactDOMForm = require(\"./ReactDOMForm\");\nvar ReactDOMInput = require(\"./ReactDOMInput\");\nvar ReactDOMOption = require(\"./ReactDOMOption\");\nvar ReactDOMSelect = require(\"./ReactDOMSelect\");\nvar ReactDOMTextarea = require(\"./ReactDOMTextarea\");\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar ReactEventTopLevelCallback = require(\"./ReactEventTopLevelCallback\");\nvar ReactPerf = require(\"./ReactPerf\");\n\nvar DefaultDOMPropertyConfig = require(\"./DefaultDOMPropertyConfig\");\nvar DOMProperty = require(\"./DOMProperty\");\n\nvar ChangeEventPlugin = require(\"./ChangeEventPlugin\");\nvar CompositionEventPlugin = require(\"./CompositionEventPlugin\");\nvar DefaultEventPluginOrder = require(\"./DefaultEventPluginOrder\");\nvar EnterLeaveEventPlugin = require(\"./EnterLeaveEventPlugin\");\nvar EventPluginHub = require(\"./EventPluginHub\");\nvar MobileSafariClickEventPlugin = require(\"./MobileSafariClickEventPlugin\");\nvar ReactInstanceHandles = require(\"./ReactInstanceHandles\");\nvar SelectEventPlugin = require(\"./SelectEventPlugin\");\nvar SimpleEventPlugin = require(\"./SimpleEventPlugin\");\n\nvar ReactDefaultBatchingStrategy = require(\"./ReactDefaultBatchingStrategy\");\nvar ReactUpdates = require(\"./ReactUpdates\");\n\nfunction inject() {\n ReactEventEmitter.TopLevelCallbackCreator = ReactEventTopLevelCallback;\n /**\n * Inject module for resolving DOM hierarchy and plugin ordering.\n */\n EventPluginHub.injection.injectEventPluginOrder(DefaultEventPluginOrder);\n EventPluginHub.injection.injectInstanceHandle(ReactInstanceHandles);\n\n /**\n * Some important event plugins included by default (without having to require\n * them).\n */\n EventPluginHub.injection.injectEventPluginsByName({\n SimpleEventPlugin: SimpleEventPlugin,\n EnterLeaveEventPlugin: EnterLeaveEventPlugin,\n ChangeEventPlugin: ChangeEventPlugin,\n CompositionEventPlugin: CompositionEventPlugin,\n MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,\n SelectEventPlugin: SelectEventPlugin\n });\n\n ReactDOM.injection.injectComponentClasses({\n button: ReactDOMButton,\n form: ReactDOMForm,\n input: ReactDOMInput,\n option: ReactDOMOption,\n select: ReactDOMSelect,\n textarea: ReactDOMTextarea\n });\n\n DOMProperty.injection.injectDOMPropertyConfig(DefaultDOMPropertyConfig);\n\n if (true) {\n ReactPerf.injection.injectMeasure(require(\"./ReactDefaultPerf\").measure);\n }\n\n ReactUpdates.injection.injectBatchingStrategy(\n ReactDefaultBatchingStrategy\n );\n}\n\nmodule.exports = {\n inject: inject\n};\n\nrequire(\"./mock-modules\").register(\"ReactDefaultInjection\", module);\n",
"mixInto":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mixInto\n */\n\n\"use strict\";\n\n/**\n * Simply copies properties to the prototype.\n */\nvar mixInto = function(constructor, methodBag) {\n var methodName;\n for (methodName in methodBag) {\n if (!methodBag.hasOwnProperty(methodName)) {\n continue;\n }\n constructor.prototype[methodName] = methodBag[methodName];\n }\n};\n\nmodule.exports = mixInto;\n\nrequire(\"./mock-modules\").register(\"mixInto\", module);\n",
"ReactDOMComponent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMComponent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar CSSPropertyOperations = require(\"./CSSPropertyOperations\");\nvar DOMProperty = require(\"./DOMProperty\");\nvar DOMPropertyOperations = require(\"./DOMPropertyOperations\");\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar ReactMultiChild = require(\"./ReactMultiChild\");\nvar ReactMount = require(\"./ReactMount\");\nvar ReactPerf = require(\"./ReactPerf\");\n\nvar escapeTextForBrowser = require(\"./escapeTextForBrowser\");\nvar invariant = require(\"./invariant\");\nvar keyOf = require(\"./keyOf\");\nvar merge = require(\"./merge\");\nvar mixInto = require(\"./mixInto\");\n\nvar putListener = ReactEventEmitter.putListener;\nvar deleteListener = ReactEventEmitter.deleteListener;\nvar registrationNames = ReactEventEmitter.registrationNames;\n\n// For quickly matching children type, to test if can be treated as content.\nvar CONTENT_TYPES = {'string': true, 'number': true};\n\nvar STYLE = keyOf({style: null});\n\n/**\n * @param {?object} props\n */\nfunction assertValidProps(props) {\n if (!props) {\n return;\n }\n // Note the use of `==` which checks for null or undefined.\n invariant(\n props.children == null || props.dangerouslySetInnerHTML == null,\n 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'\n );\n invariant(\n props.style == null || typeof props.style === 'object',\n 'The `style` prop expects a mapping from style properties to values, ' +\n 'not a string.'\n );\n}\n\n/**\n * @constructor ReactDOMComponent\n * @extends ReactComponent\n * @extends ReactMultiChild\n */\nfunction ReactDOMComponent(tag, omitClose) {\n this._tagOpen = '<' + tag;\n this._tagClose = omitClose ? '' : '</' + tag + '>';\n this.tagName = tag.toUpperCase();\n}\n\nReactDOMComponent.Mixin = {\n\n /**\n * Generates root tag markup then recurses. This method has side effects and\n * is not idempotent.\n *\n * @internal\n * @param {string} rootID The root DOM ID for this node.\n * @param {ReactReconcileTransaction} transaction\n * @param {number} mountDepth number of components in the owner hierarchy\n * @return {string} The computed markup.\n */\n mountComponent: ReactPerf.measure(\n 'ReactDOMComponent',\n 'mountComponent',\n function(rootID, transaction, mountDepth) {\n ReactComponent.Mixin.mountComponent.call(\n this,\n rootID,\n transaction,\n mountDepth\n );\n assertValidProps(this.props);\n return (\n this._createOpenTagMarkup() +\n this._createContentMarkup(transaction) +\n this._tagClose\n );\n }\n ),\n\n /**\n * Creates markup for the open tag and all attributes.\n *\n * This method has side effects because events get registered.\n *\n * Iterating over object properties is faster than iterating over arrays.\n * @see http://jsperf.com/obj-vs-arr-iteration\n *\n * @private\n * @return {string} Markup of opening tag.\n */\n _createOpenTagMarkup: function() {\n var props = this.props;\n var ret = this._tagOpen;\n\n for (var propKey in props) {\n if (!props.hasOwnProperty(propKey)) {\n continue;\n }\n var propValue = props[propKey];\n if (propValue == null) {\n continue;\n }\n if (registrationNames[propKey]) {\n putListener(this._rootNodeID, propKey, propValue);\n } else {\n if (propKey === STYLE) {\n if (propValue) {\n propValue = props.style = merge(props.style);\n }\n propValue = CSSPropertyOperations.createMarkupForStyles(propValue);\n }\n var markup =\n DOMPropertyOperations.createMarkupForProperty(propKey, propValue);\n if (markup) {\n ret += ' ' + markup;\n }\n }\n }\n\n var escapedID = escapeTextForBrowser(this._rootNodeID);\n return ret + ' ' + ReactMount.ATTR_NAME + '=\"' + escapedID + '\">';\n },\n\n /**\n * Creates markup for the content between the tags.\n *\n * @private\n * @param {ReactReconcileTransaction} transaction\n * @return {string} Content markup.\n */\n _createContentMarkup: function(transaction) {\n // Intentional use of != to avoid catching zero/false.\n var innerHTML = this.props.dangerouslySetInnerHTML;\n if (innerHTML != null) {\n if (innerHTML.__html != null) {\n return innerHTML.__html;\n }\n } else {\n var contentToUse =\n CONTENT_TYPES[typeof this.props.children] ? this.props.children : null;\n var childrenToUse = contentToUse != null ? null : this.props.children;\n if (contentToUse != null) {\n return escapeTextForBrowser(contentToUse);\n } else if (childrenToUse != null) {\n var mountImages = this.mountChildren(\n childrenToUse,\n transaction\n );\n return mountImages.join('');\n }\n }\n return '';\n },\n\n receiveProps: function(nextProps, transaction) {\n assertValidProps(nextProps);\n ReactComponent.Mixin.receiveProps.call(this, nextProps, transaction);\n },\n\n /**\n * Updates a native DOM component after it has already been allocated and\n * attached to the DOM. Reconciles the root DOM node, then recurses.\n *\n * @param {ReactReconcileTransaction} transaction\n * @param {object} prevProps\n * @internal\n * @overridable\n */\n updateComponent: ReactPerf.measure(\n 'ReactDOMComponent',\n 'updateComponent',\n function(transaction, prevProps) {\n ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);\n this._updateDOMProperties(prevProps);\n this._updateDOMChildren(prevProps, transaction);\n }\n ),\n\n /**\n * Reconciles the properties by detecting differences in property values and\n * updating the DOM as necessary. This function is probably the single most\n * critical path for performance optimization.\n *\n * TODO: Benchmark whether checking for changed values in memory actually\n * improves performance (especially statically positioned elements).\n * TODO: Benchmark the effects of putting this at the top since 99% of props\n * do not change for a given reconciliation.\n * TODO: Benchmark areas that can be improved with caching.\n *\n * @private\n * @param {object} lastProps\n */\n _updateDOMProperties: function(lastProps) {\n var nextProps = this.props;\n var propKey;\n var styleName;\n var styleUpdates;\n for (propKey in lastProps) {\n if (nextProps.hasOwnProperty(propKey) ||\n !lastProps.hasOwnProperty(propKey)) {\n continue;\n }\n if (propKey === STYLE) {\n var lastStyle = lastProps[propKey];\n for (styleName in lastStyle) {\n if (lastStyle.hasOwnProperty(styleName)) {\n styleUpdates = styleUpdates || {};\n styleUpdates[styleName] = '';\n }\n }\n } else if (registrationNames[propKey]) {\n deleteListener(this._rootNodeID, propKey);\n } else if (\n DOMProperty.isStandardName[propKey] ||\n DOMProperty.isCustomAttribute(propKey)) {\n ReactComponent.DOMIDOperations.deletePropertyByID(\n this._rootNodeID,\n propKey\n );\n }\n }\n for (propKey in nextProps) {\n var nextProp = nextProps[propKey];\n var lastProp = lastProps[propKey];\n if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {\n continue;\n }\n if (propKey === STYLE) {\n if (nextProp) {\n nextProp = nextProps.style = merge(nextProp);\n }\n if (lastProp) {\n // Unset styles on `lastProp` but not on `nextProp`.\n for (styleName in lastProp) {\n if (lastProp.hasOwnProperty(styleName) &&\n !nextProp.hasOwnProperty(styleName)) {\n styleUpdates = styleUpdates || {};\n styleUpdates[styleName] = '';\n }\n }\n // Update styles that changed since `lastProp`.\n for (styleName in nextProp) {\n if (nextProp.hasOwnProperty(styleName) &&\n lastProp[styleName] !== nextProp[styleName]) {\n styleUpdates = styleUpdates || {};\n styleUpdates[styleName] = nextProp[styleName];\n }\n }\n } else {\n // Relies on `updateStylesByID` not mutating `styleUpdates`.\n styleUpdates = nextProp;\n }\n } else if (registrationNames[propKey]) {\n putListener(this._rootNodeID, propKey, nextProp);\n } else if (\n DOMProperty.isStandardName[propKey] ||\n DOMProperty.isCustomAttribute(propKey)) {\n ReactComponent.DOMIDOperations.updatePropertyByID(\n this._rootNodeID,\n propKey,\n nextProp\n );\n }\n }\n if (styleUpdates) {\n ReactComponent.DOMIDOperations.updateStylesByID(\n this._rootNodeID,\n styleUpdates\n );\n }\n },\n\n /**\n * Reconciles the children with the various properties that affect the\n * children content.\n *\n * @param {object} lastProps\n * @param {ReactReconcileTransaction} transaction\n */\n _updateDOMChildren: function(lastProps, transaction) {\n var nextProps = this.props;\n\n var lastContent =\n CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;\n var nextContent =\n CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;\n\n var lastHtml =\n lastProps.dangerouslySetInnerHTML &&\n lastProps.dangerouslySetInnerHTML.__html;\n var nextHtml =\n nextProps.dangerouslySetInnerHTML &&\n nextProps.dangerouslySetInnerHTML.__html;\n\n // Note the use of `!=` which checks for null or undefined.\n var lastChildren = lastContent != null ? null : lastProps.children;\n var nextChildren = nextContent != null ? null : nextProps.children;\n\n // If we're switching from children to content/html or vice versa, remove\n // the old content\n var lastHasContentOrHtml = lastContent != null || lastHtml != null;\n var nextHasContentOrHtml = nextContent != null || nextHtml != null;\n if (lastChildren != null && nextChildren == null) {\n this.updateChildren(null, transaction);\n } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {\n this.updateTextContent('');\n }\n\n if (nextContent != null) {\n if (lastContent !== nextContent) {\n this.updateTextContent('' + nextContent);\n }\n } else if (nextHtml != null) {\n if (lastHtml !== nextHtml) {\n ReactComponent.DOMIDOperations.updateInnerHTMLByID(\n this._rootNodeID,\n nextHtml\n );\n }\n } else if (nextChildren != null) {\n this.updateChildren(nextChildren, transaction);\n }\n },\n\n /**\n * Destroys all event registrations for this instance. Does not remove from\n * the DOM. That must be done by the parent.\n *\n * @internal\n */\n unmountComponent: function() {\n ReactEventEmitter.deleteAllListeners(this._rootNodeID);\n ReactComponent.Mixin.unmountComponent.call(this);\n this.unmountChildren();\n }\n\n};\n\nmixInto(ReactDOMComponent, ReactComponent.Mixin);\nmixInto(ReactDOMComponent, ReactDOMComponent.Mixin);\nmixInto(ReactDOMComponent, ReactMultiChild.Mixin);\n\nmodule.exports = ReactDOMComponent;\n\nrequire(\"./mock-modules\").register(\"ReactDOMComponent\", module);\n",
"ReactMultiChild":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactMultiChild\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactMultiChildUpdateTypes = require(\"./ReactMultiChildUpdateTypes\");\n\nvar flattenChildren = require(\"./flattenChildren\");\n\n/**\n * Given a `curChild` and `newChild`, determines if `curChild` should be\n * updated as opposed to being destroyed or replaced.\n *\n * @param {?ReactComponent} curChild\n * @param {?ReactComponent} newChild\n * @return {boolean} True if `curChild` should be updated with `newChild`.\n * @protected\n */\nfunction shouldUpdateChild(curChild, newChild) {\n return curChild && newChild && curChild.constructor === newChild.constructor;\n}\n\n/**\n * Updating children of a component may trigger recursive updates. The depth is\n * used to batch recursive updates to render markup more efficiently.\n *\n * @type {number}\n * @private\n */\nvar updateDepth = 0;\n\n/**\n * Queue of update configuration objects.\n *\n * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.\n *\n * @type {array<object>}\n * @private\n */\nvar updateQueue = [];\n\n/**\n * Queue of markup to be rendered.\n *\n * @type {array<string>}\n * @private\n */\nvar markupQueue = [];\n\n/**\n * Enqueues markup to be rendered and inserted at a supplied index.\n *\n * @param {string} parentID ID of the parent component.\n * @param {string} markup Markup that renders into an element.\n * @param {number} toIndex Destination index.\n * @private\n */\nfunction enqueueMarkup(parentID, markup, toIndex) {\n // NOTE: Null values reduce hidden classes.\n updateQueue.push({\n parentID: parentID,\n parentNode: null,\n type: ReactMultiChildUpdateTypes.INSERT_MARKUP,\n markupIndex: markupQueue.push(markup) - 1,\n fromIndex: null,\n textContent: null,\n toIndex: toIndex\n });\n}\n\n/**\n * Enqueues moving an existing element to another index.\n *\n * @param {string} parentID ID of the parent component.\n * @param {number} fromIndex Source index of the existing element.\n * @param {number} toIndex Destination index of the element.\n * @private\n */\nfunction enqueueMove(parentID, fromIndex, toIndex) {\n // NOTE: Null values reduce hidden classes.\n updateQueue.push({\n parentID: parentID,\n parentNode: null,\n type: ReactMultiChildUpdateTypes.MOVE_EXISTING,\n markupIndex: null,\n textContent: null,\n fromIndex: fromIndex,\n toIndex: toIndex\n });\n}\n\n/**\n * Enqueues removing an element at an index.\n *\n * @param {string} parentID ID of the parent component.\n * @param {number} fromIndex Index of the element to remove.\n * @private\n */\nfunction enqueueRemove(parentID, fromIndex) {\n // NOTE: Null values reduce hidden classes.\n updateQueue.push({\n parentID: parentID,\n parentNode: null,\n type: ReactMultiChildUpdateTypes.REMOVE_NODE,\n markupIndex: null,\n textContent: null,\n fromIndex: fromIndex,\n toIndex: null\n });\n}\n\n/**\n * Enqueues setting the text content.\n *\n * @param {string} parentID ID of the parent component.\n * @param {string} textContent Text content to set.\n * @private\n */\nfunction enqueueTextContent(parentID, textContent) {\n // NOTE: Null values reduce hidden classes.\n updateQueue.push({\n parentID: parentID,\n parentNode: null,\n type: ReactMultiChildUpdateTypes.TEXT_CONTENT,\n markupIndex: null,\n textContent: textContent,\n fromIndex: null,\n toIndex: null\n });\n}\n\n/**\n * Processes any enqueued updates.\n *\n * @private\n */\nfunction processQueue() {\n if (updateQueue.length) {\n ReactComponent.DOMIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}\n\n/**\n * Clears any enqueued updates.\n *\n * @private\n */\nfunction clearQueue() {\n updateQueue.length = 0;\n markupQueue.length = 0;\n}\n\n/**\n * ReactMultiChild are capable of reconciling multiple children.\n *\n * @class ReactMultiChild\n * @internal\n */\nvar ReactMultiChild = {\n\n /**\n * Provides common functionality for components that must reconcile multiple\n * children. This is used by `ReactDOMComponent` to mount, update, and\n * unmount child components.\n *\n * @lends {ReactMultiChild.prototype}\n */\n Mixin: {\n\n /**\n * Generates a \"mount image\" for each of the supplied children. In the case\n * of `ReactDOMComponent`, a mount image is a string of markup.\n *\n * @param {?object} nestedChildren Nested child maps.\n * @return {array} An array of mounted representations.\n * @internal\n */\n mountChildren: function(nestedChildren, transaction) {\n var children = flattenChildren(nestedChildren);\n var mountImages = [];\n var index = 0;\n this._renderedChildren = children;\n for (var name in children) {\n var child = children[name];\n if (children.hasOwnProperty(name) && child) {\n // Inlined for performance, see `ReactInstanceHandles.createReactID`.\n var rootID = this._rootNodeID + '.' + name;\n var mountImage = child.mountComponent(\n rootID,\n transaction,\n this._mountDepth + 1\n );\n child._mountImage = mountImage;\n child._mountIndex = index;\n mountImages.push(mountImage);\n index++;\n }\n }\n return mountImages;\n },\n\n /**\n * Replaces any rendered children with a text content string.\n *\n * @param {string} nextContent String of content.\n * @internal\n */\n updateTextContent: function(nextContent) {\n updateDepth++;\n try {\n var prevChildren = this._renderedChildren;\n // Remove any rendered children.\n for (var name in prevChildren) {\n if (prevChildren.hasOwnProperty(name) &&\n prevChildren[name]) {\n this._unmountChildByName(prevChildren[name], name);\n }\n }\n // Set new text content.\n this.setTextContent(nextContent);\n } catch (error) {\n updateDepth--;\n updateDepth || clearQueue();\n throw error;\n }\n updateDepth--;\n updateDepth || processQueue();\n },\n\n /**\n * Updates the rendered children with new children.\n *\n * @param {?object} nextNestedChildren Nested child maps.\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n updateChildren: function(nextNestedChildren, transaction) {\n updateDepth++;\n try {\n this._updateChildren(nextNestedChildren, transaction);\n } catch (error) {\n updateDepth--;\n updateDepth || clearQueue();\n throw error;\n }\n updateDepth--;\n updateDepth || processQueue();\n },\n\n /**\n * Improve performance by isolating this hot code path from the try/catch\n * block in `updateChildren`.\n *\n * @param {?object} nextNestedChildren Nested child maps.\n * @param {ReactReconcileTransaction} transaction\n * @final\n * @protected\n */\n _updateChildren: function(nextNestedChildren, transaction) {\n var nextChildren = flattenChildren(nextNestedChildren);\n var prevChildren = this._renderedChildren;\n if (!nextChildren && !prevChildren) {\n return;\n }\n var name;\n // `nextIndex` will increment for each child in `nextChildren`, but\n // `lastIndex` will be the last index visited in `prevChildren`.\n var lastIndex = 0;\n var nextIndex = 0;\n for (name in nextChildren) {\n if (!nextChildren.hasOwnProperty(name)) {\n continue;\n }\n var prevChild = prevChildren && prevChildren[name];\n var nextChild = nextChildren[name];\n if (shouldUpdateChild(prevChild, nextChild)) {\n this.moveChild(prevChild, nextIndex, lastIndex);\n lastIndex = Math.max(prevChild._mountIndex, lastIndex);\n prevChild.receiveProps(nextChild.props, transaction);\n prevChild._mountIndex = nextIndex;\n } else {\n if (prevChild) {\n // Update `lastIndex` before `_mountIndex` gets unset by unmounting.\n lastIndex = Math.max(prevChild._mountIndex, lastIndex);\n this._unmountChildByName(prevChild, name);\n }\n if (nextChild) {\n this._mountChildByNameAtIndex(\n nextChild, name, nextIndex, transaction\n );\n }\n }\n if (nextChild) {\n nextIndex++;\n }\n }\n // Remove children that are no longer present.\n for (name in prevChildren) {\n if (prevChildren.hasOwnProperty(name) &&\n prevChildren[name] &&\n !(nextChildren && nextChildren[name])) {\n this._unmountChildByName(prevChildren[name], name);\n }\n }\n },\n\n /**\n * Unmounts all rendered children. This should be used to clean up children\n * when this component is unmounted.\n *\n * @internal\n */\n unmountChildren: function() {\n var renderedChildren = this._renderedChildren;\n for (var name in renderedChildren) {\n var renderedChild = renderedChildren[name];\n if (renderedChild && renderedChild.unmountComponent) {\n renderedChild.unmountComponent();\n }\n }\n this._renderedChildren = null;\n },\n\n /**\n * Moves a child component to the supplied index.\n *\n * @param {ReactComponent} child Component to move.\n * @param {number} toIndex Destination index of the element.\n * @param {number} lastIndex Last index visited of the siblings of `child`.\n * @protected\n */\n moveChild: function(child, toIndex, lastIndex) {\n // If the index of `child` is less than `lastIndex`, then it needs to\n // be moved. Otherwise, we do not need to move it because a child will be\n // inserted or moved before `child`.\n if (child._mountIndex < lastIndex) {\n enqueueMove(this._rootNodeID, child._mountIndex, toIndex);\n }\n },\n\n /**\n * Creates a child component.\n *\n * @param {ReactComponent} child Component to create.\n * @protected\n */\n createChild: function(child) {\n enqueueMarkup(this._rootNodeID, child._mountImage, child._mountIndex);\n },\n\n /**\n * Removes a child component.\n *\n * @param {ReactComponent} child Child to remove.\n * @protected\n */\n removeChild: function(child) {\n enqueueRemove(this._rootNodeID, child._mountIndex);\n },\n\n /**\n * Sets this text content string.\n *\n * @param {string} textContent Text content to set.\n * @protected\n */\n setTextContent: function(textContent) {\n enqueueTextContent(this._rootNodeID, textContent);\n },\n\n /**\n * Mounts a child with the supplied name.\n *\n * NOTE: This is part of `updateChildren` and is here for readability.\n *\n * @param {ReactComponent} child Component to mount.\n * @param {string} name Name of the child.\n * @param {number} index Index at which to insert the child.\n * @param {ReactReconcileTransaction} transaction\n * @private\n */\n _mountChildByNameAtIndex: function(child, name, index, transaction) {\n // Inlined for performance, see `ReactInstanceHandles.createReactID`.\n var rootID = this._rootNodeID + '.' + name;\n var mountImage = child.mountComponent(\n rootID,\n transaction,\n this._mountDepth + 1\n );\n child._mountImage = mountImage;\n child._mountIndex = index;\n this.createChild(child);\n this._renderedChildren = this._renderedChildren || {};\n this._renderedChildren[name] = child;\n },\n\n /**\n * Unmounts a rendered child by name.\n *\n * NOTE: This is part of `updateChildren` and is here for readability.\n *\n * @param {ReactComponent} child Component to unmount.\n * @param {string} name Name of the child in `this._renderedChildren`.\n * @private\n */\n _unmountChildByName: function(child, name) {\n if (ReactComponent.isValidComponent(child)) {\n this.removeChild(child);\n child._mountImage = null;\n child._mountIndex = null;\n child.unmountComponent();\n delete this._renderedChildren[name];\n }\n }\n\n }\n\n};\n\nmodule.exports = ReactMultiChild;\n\nrequire(\"./mock-modules\").register(\"ReactMultiChild\", module);\n",
"ReactEventEmitter":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactEventEmitter\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventListener = require(\"./EventListener\");\nvar EventPluginHub = require(\"./EventPluginHub\");\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\nvar ReactEventEmitterMixin = require(\"./ReactEventEmitterMixin\");\nvar ViewportMetrics = require(\"./ViewportMetrics\");\n\nvar invariant = require(\"./invariant\");\nvar isEventSupported = require(\"./isEventSupported\");\nvar merge = require(\"./merge\");\n\n/**\n * Summary of `ReactEventEmitter` event handling:\n *\n * - Top-level delegation is used to trap native browser events. We normalize\n * and de-duplicate events to account for browser quirks.\n *\n * - Forward these native events (with the associated top-level type used to\n * trap it) to `EventPluginHub`, which in turn will ask plugins if they want\n * to extract any synthetic events.\n *\n * - The `EventPluginHub` will then process each event by annotating them with\n * \"dispatches\", a sequence of listeners and IDs that care about that event.\n *\n * - The `EventPluginHub` then dispatches the events.\n *\n * Overview of React and the event system:\n *\n * .\n * +------------+ .\n * | DOM | .\n * +------------+ . +-----------+\n * + . +--------+|SimpleEvent|\n * | . | |Plugin |\n * +-----|------+ . v +-----------+\n * | | | . +--------------+ +------------+\n * | +-----------.--->|EventPluginHub| | Event |\n * | | . | | +-----------+ | Propagators|\n * | ReactEvent | . | | |TapEvent | |------------|\n * | Emitter | . | |<---+|Plugin | |other plugin|\n * | | . | | +-----------+ | utilities |\n * | +-----------.---------+ | +------------+\n * | | | . +----|---------+\n * +-----|------+ . | ^ +-----------+\n * | . | | |Enter/Leave|\n * + . | +-------+|Plugin |\n * +-------------+ . v +-----------+\n * | application | . +----------+\n * |-------------| . | callback |\n * | | . | registry |\n * | | . +----------+\n * +-------------+ .\n * .\n * React Core . General Purpose Event Plugin System\n */\n\n/**\n * Traps top-level events by using event bubbling.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {string} handlerBaseName Event name (e.g. \"click\").\n * @param {DOMEventTarget} element Element on which to attach listener.\n * @internal\n */\nfunction trapBubbledEvent(topLevelType, handlerBaseName, element) {\n EventListener.listen(\n element,\n handlerBaseName,\n ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback(\n topLevelType\n )\n );\n}\n\n/**\n * Traps a top-level event by using event capturing.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {string} handlerBaseName Event name (e.g. \"click\").\n * @param {DOMEventTarget} element Element on which to attach listener.\n * @internal\n */\nfunction trapCapturedEvent(topLevelType, handlerBaseName, element) {\n EventListener.capture(\n element,\n handlerBaseName,\n ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback(\n topLevelType\n )\n );\n}\n\n/**\n * Listens to window scroll and resize events. We cache scroll values so that\n * application code can access them without triggering reflows.\n *\n * NOTE: Scroll events do not bubble.\n *\n * @private\n * @see http://www.quirksmode.org/dom/events/scroll.html\n */\nfunction registerScrollValueMonitoring() {\n var refresh = ViewportMetrics.refreshScrollValues;\n EventListener.listen(window, 'scroll', refresh);\n EventListener.listen(window, 'resize', refresh);\n}\n\n/**\n * `ReactEventEmitter` is used to attach top-level event listeners. For example:\n *\n * ReactEventEmitter.putListener('myID', 'onClick', myFunction);\n *\n * This would allocate a \"registration\" of `('onClick', myFunction)` on 'myID'.\n *\n * @internal\n */\nvar ReactEventEmitter = merge(ReactEventEmitterMixin, {\n\n /**\n * React references `ReactEventTopLevelCallback` using this property in order\n * to allow dependency injection.\n */\n TopLevelCallbackCreator: null,\n\n /**\n * Ensures that top-level event delegation listeners are installed.\n *\n * There are issues with listening to both touch events and mouse events on\n * the top-level, so we make the caller choose which one to listen to. (If\n * there's a touch top-level listeners, anchors don't receive clicks for some\n * reason, and only in some cases).\n *\n * @param {boolean} touchNotMouse Listen to touch events instead of mouse.\n * @param {DOMDocument} contentDocument DOM document to listen on\n */\n ensureListening: function(touchNotMouse, contentDocument) {\n invariant(\n ExecutionEnvironment.canUseDOM,\n 'ensureListening(...): Cannot toggle event listening in a Worker ' +\n 'thread. This is likely a bug in the framework. Please report ' +\n 'immediately.'\n );\n invariant(\n ReactEventEmitter.TopLevelCallbackCreator,\n 'ensureListening(...): Cannot be called without a top level callback ' +\n 'creator being injected.'\n );\n // Call out to base implementation.\n ReactEventEmitterMixin.ensureListening.call(\n ReactEventEmitter,\n {\n touchNotMouse: touchNotMouse,\n contentDocument: contentDocument\n }\n );\n },\n\n /**\n * Sets whether or not any created callbacks should be enabled.\n *\n * @param {boolean} enabled True if callbacks should be enabled.\n */\n setEnabled: function(enabled) {\n invariant(\n ExecutionEnvironment.canUseDOM,\n 'setEnabled(...): Cannot toggle event listening in a Worker thread. ' +\n 'This is likely a bug in the framework. Please report immediately.'\n );\n if (ReactEventEmitter.TopLevelCallbackCreator) {\n ReactEventEmitter.TopLevelCallbackCreator.setEnabled(enabled);\n }\n },\n\n /**\n * @return {boolean} True if callbacks are enabled.\n */\n isEnabled: function() {\n return !!(\n ReactEventEmitter.TopLevelCallbackCreator &&\n ReactEventEmitter.TopLevelCallbackCreator.isEnabled()\n );\n },\n\n /**\n * We listen for bubbled touch events on the document object.\n *\n * Firefox v8.01 (and possibly others) exhibited strange behavior when\n * mounting `onmousemove` events at some node that was not the document\n * element. The symptoms were that if your mouse is not moving over something\n * contained within that mount point (for example on the background) the\n * top-level listeners for `onmousemove` won't be called. However, if you\n * register the `mousemove` on the document object, then it will of course\n * catch all `mousemove`s. This along with iOS quirks, justifies restricting\n * top-level listeners to the document object only, at least for these\n * movement types of events and possibly all events.\n *\n * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html\n *\n * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but\n * they bubble to document.\n *\n * @param {boolean} touchNotMouse Listen to touch events instead of mouse.\n * @param {DOMDocument} contentDocument Document which owns the container\n * @private\n * @see http://www.quirksmode.org/dom/events/keys.html.\n */\n listenAtTopLevel: function(touchNotMouse, contentDocument) {\n invariant(\n !contentDocument._isListening,\n 'listenAtTopLevel(...): Cannot setup top-level listener more than once.'\n );\n var topLevelTypes = EventConstants.topLevelTypes;\n var mountAt = contentDocument;\n\n registerScrollValueMonitoring();\n trapBubbledEvent(topLevelTypes.topMouseOver, 'mouseover', mountAt);\n trapBubbledEvent(topLevelTypes.topMouseDown, 'mousedown', mountAt);\n trapBubbledEvent(topLevelTypes.topMouseUp, 'mouseup', mountAt);\n trapBubbledEvent(topLevelTypes.topMouseMove, 'mousemove', mountAt);\n trapBubbledEvent(topLevelTypes.topMouseOut, 'mouseout', mountAt);\n trapBubbledEvent(topLevelTypes.topClick, 'click', mountAt);\n trapBubbledEvent(topLevelTypes.topDoubleClick, 'dblclick', mountAt);\n if (touchNotMouse) {\n trapBubbledEvent(topLevelTypes.topTouchStart, 'touchstart', mountAt);\n trapBubbledEvent(topLevelTypes.topTouchEnd, 'touchend', mountAt);\n trapBubbledEvent(topLevelTypes.topTouchMove, 'touchmove', mountAt);\n trapBubbledEvent(topLevelTypes.topTouchCancel, 'touchcancel', mountAt);\n }\n trapBubbledEvent(topLevelTypes.topKeyUp, 'keyup', mountAt);\n trapBubbledEvent(topLevelTypes.topKeyPress, 'keypress', mountAt);\n trapBubbledEvent(topLevelTypes.topKeyDown, 'keydown', mountAt);\n trapBubbledEvent(topLevelTypes.topInput, 'input', mountAt);\n trapBubbledEvent(topLevelTypes.topChange, 'change', mountAt);\n trapBubbledEvent(\n topLevelTypes.topSelectionChange,\n 'selectionchange',\n mountAt\n );\n\n trapBubbledEvent(\n topLevelTypes.topCompositionEnd,\n 'compositionend',\n mountAt\n );\n trapBubbledEvent(\n topLevelTypes.topCompositionStart,\n 'compositionstart',\n mountAt\n );\n trapBubbledEvent(\n topLevelTypes.topCompositionUpdate,\n 'compositionupdate',\n mountAt\n );\n\n if (isEventSupported('drag')) {\n trapBubbledEvent(topLevelTypes.topDrag, 'drag', mountAt);\n trapBubbledEvent(topLevelTypes.topDragEnd, 'dragend', mountAt);\n trapBubbledEvent(topLevelTypes.topDragEnter, 'dragenter', mountAt);\n trapBubbledEvent(topLevelTypes.topDragExit, 'dragexit', mountAt);\n trapBubbledEvent(topLevelTypes.topDragLeave, 'dragleave', mountAt);\n trapBubbledEvent(topLevelTypes.topDragOver, 'dragover', mountAt);\n trapBubbledEvent(topLevelTypes.topDragStart, 'dragstart', mountAt);\n trapBubbledEvent(topLevelTypes.topDrop, 'drop', mountAt);\n }\n\n if (isEventSupported('wheel')) {\n trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);\n } else if (isEventSupported('mousewheel')) {\n trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);\n } else {\n // Firefox needs to capture a different mouse scroll event.\n // @see http://www.quirksmode.org/dom/events/tests/scroll.html\n trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);\n }\n\n // IE<9 does not support capturing so just trap the bubbled event there.\n if (isEventSupported('scroll', true)) {\n trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);\n } else {\n trapBubbledEvent(topLevelTypes.topScroll, 'scroll', window);\n }\n\n if (isEventSupported('focus', true)) {\n trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);\n trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);\n } else if (isEventSupported('focusin')) {\n // IE has `focusin` and `focusout` events which bubble.\n // @see\n // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html\n trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);\n trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);\n }\n\n if (isEventSupported('copy')) {\n trapBubbledEvent(topLevelTypes.topCopy, 'copy', mountAt);\n trapBubbledEvent(topLevelTypes.topCut, 'cut', mountAt);\n trapBubbledEvent(topLevelTypes.topPaste, 'paste', mountAt);\n }\n },\n\n registrationNames: EventPluginHub.registrationNames,\n\n putListener: EventPluginHub.putListener,\n\n getListener: EventPluginHub.getListener,\n\n deleteListener: EventPluginHub.deleteListener,\n\n deleteAllListeners: EventPluginHub.deleteAllListeners,\n\n trapBubbledEvent: trapBubbledEvent,\n\n trapCapturedEvent: trapCapturedEvent\n\n});\n\n\nmodule.exports = ReactEventEmitter;\n\nrequire(\"./mock-modules\").register(\"ReactEventEmitter\", module);\n",
"DOMPropertyOperations":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule DOMPropertyOperations\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar DOMProperty = require(\"./DOMProperty\");\n\nvar escapeTextForBrowser = require(\"./escapeTextForBrowser\");\nvar memoizeStringOnly = require(\"./memoizeStringOnly\");\n\nvar processAttributeNameAndPrefix = memoizeStringOnly(function(name) {\n return escapeTextForBrowser(name) + '=\"';\n});\n\nif (true) {\n var reactProps = {\n __owner__: true,\n children: true,\n dangerouslySetInnerHTML: true,\n key: true,\n ref: true\n };\n var warnedProperties = {};\n\n var warnUnknownProperty = function(name) {\n if (reactProps[name] || warnedProperties[name]) {\n return;\n }\n\n warnedProperties[name] = true;\n var lowerCasedName = name.toLowerCase();\n\n // data-* attributes should be lowercase; suggest the lowercase version\n var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ?\n lowerCasedName : DOMProperty.getPossibleStandardName[lowerCasedName];\n\n // For now, only warn when we have a suggested correction. This prevents\n // logging too much when using transferPropsTo.\n if (standardName != null) {\n console.warn(\n 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'\n );\n }\n\n };\n}\n\n/**\n * Operations for dealing with DOM properties.\n */\nvar DOMPropertyOperations = {\n\n /**\n * Creates markup for a property.\n *\n * @param {string} name\n * @param {*} value\n * @return {?string} Markup string, or null if the property was invalid.\n */\n createMarkupForProperty: function(name, value) {\n if (DOMProperty.isStandardName[name]) {\n if (value == null || DOMProperty.hasBooleanValue[name] && !value) {\n return '';\n }\n var attributeName = DOMProperty.getAttributeName[name];\n return processAttributeNameAndPrefix(attributeName) +\n escapeTextForBrowser(value) + '\"';\n } else if (DOMProperty.isCustomAttribute(name)) {\n if (value == null) {\n return '';\n }\n return processAttributeNameAndPrefix(name) +\n escapeTextForBrowser(value) + '\"';\n } else if (true) {\n warnUnknownProperty(name);\n }\n return null;\n },\n\n /**\n * Sets the value for a property on a node.\n *\n * @param {DOMElement} node\n * @param {string} name\n * @param {*} value\n */\n setValueForProperty: function(node, name, value) {\n if (DOMProperty.isStandardName[name]) {\n var mutationMethod = DOMProperty.getMutationMethod[name];\n if (mutationMethod) {\n mutationMethod(node, value);\n } else if (DOMProperty.mustUseAttribute[name]) {\n if (DOMProperty.hasBooleanValue[name] && !value) {\n node.removeAttribute(DOMProperty.getAttributeName[name]);\n } else {\n node.setAttribute(DOMProperty.getAttributeName[name], '' + value);\n }\n } else {\n var propName = DOMProperty.getPropertyName[name];\n if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) {\n node[propName] = value;\n }\n }\n } else if (DOMProperty.isCustomAttribute(name)) {\n node.setAttribute(name, '' + value);\n } else if (true) {\n warnUnknownProperty(name);\n }\n },\n\n /**\n * Deletes the value for a property on a node.\n *\n * @param {DOMElement} node\n * @param {string} name\n */\n deleteValueForProperty: function(node, name) {\n if (DOMProperty.isStandardName[name]) {\n var mutationMethod = DOMProperty.getMutationMethod[name];\n if (mutationMethod) {\n mutationMethod(node, undefined);\n } else if (DOMProperty.mustUseAttribute[name]) {\n node.removeAttribute(DOMProperty.getAttributeName[name]);\n } else {\n var propName = DOMProperty.getPropertyName[name];\n node[propName] = DOMProperty.getDefaultValueForProperty(\n node.nodeName,\n name\n );\n }\n } else if (DOMProperty.isCustomAttribute(name)) {\n node.removeAttribute(name);\n } else if (true) {\n warnUnknownProperty(name);\n }\n }\n\n};\n\nmodule.exports = DOMPropertyOperations;\n\nrequire(\"./mock-modules\").register(\"DOMPropertyOperations\", module);\n",
"ReactDOMIDOperations":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMIDOperations\n * @typechecks static-only\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar CSSPropertyOperations = require(\"./CSSPropertyOperations\");\nvar DOMChildrenOperations = require(\"./DOMChildrenOperations\");\nvar DOMPropertyOperations = require(\"./DOMPropertyOperations\");\nvar ReactMount = require(\"./ReactMount\");\n\nvar getTextContentAccessor = require(\"./getTextContentAccessor\");\nvar invariant = require(\"./invariant\");\n\n/**\n * Errors for properties that should not be updated with `updatePropertyById()`.\n *\n * @type {object}\n * @private\n */\nvar INVALID_PROPERTY_ERRORS = {\n dangerouslySetInnerHTML:\n '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',\n style: '`style` must be set using `updateStylesByID()`.'\n};\n\n/**\n * The DOM property to use when setting text content.\n *\n * @type {string}\n * @private\n */\nvar textContentAccessor = getTextContentAccessor() || 'NA';\n\nvar LEADING_SPACE = /^ /;\n\n/**\n * Operations used to process updates to DOM nodes. This is made injectable via\n * `ReactComponent.DOMIDOperations`.\n */\nvar ReactDOMIDOperations = {\n\n /**\n * Updates a DOM node with new property values. This should only be used to\n * update DOM properties in `DOMProperty`.\n *\n * @param {string} id ID of the node to update.\n * @param {string} name A valid property name, see `DOMProperty`.\n * @param {*} value New value of the property.\n * @internal\n */\n updatePropertyByID: function(id, name, value) {\n var node = ReactMount.getNode(id);\n invariant(\n !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),\n 'updatePropertyByID(...): %s',\n INVALID_PROPERTY_ERRORS[name]\n );\n\n // If we're updating to null or undefined, we should remove the property\n // from the DOM node instead of inadvertantly setting to a string. This\n // brings us in line with the same behavior we have on initial render.\n if (value != null) {\n DOMPropertyOperations.setValueForProperty(node, name, value);\n } else {\n DOMPropertyOperations.deleteValueForProperty(node, name);\n }\n },\n\n /**\n * Updates a DOM node to remove a property. This should only be used to remove\n * DOM properties in `DOMProperty`.\n *\n * @param {string} id ID of the node to update.\n * @param {string} name A property name to remove, see `DOMProperty`.\n * @internal\n */\n deletePropertyByID: function(id, name, value) {\n var node = ReactMount.getNode(id);\n invariant(\n !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),\n 'updatePropertyByID(...): %s',\n INVALID_PROPERTY_ERRORS[name]\n );\n DOMPropertyOperations.deleteValueForProperty(node, name, value);\n },\n\n /**\n * This should almost never be used instead of `updatePropertyByID()` due to\n * the extra object allocation required by the API. That said, this is useful\n * for batching up several operations across worker thread boundaries.\n *\n * @param {string} id ID of the node to update.\n * @param {object} properties A mapping of valid property names.\n * @internal\n * @see {ReactDOMIDOperations.updatePropertyByID}\n */\n updatePropertiesByID: function(id, properties) {\n for (var name in properties) {\n if (!properties.hasOwnProperty(name)) {\n continue;\n }\n ReactDOMIDOperations.updatePropertiesByID(id, name, properties[name]);\n }\n },\n\n /**\n * Updates a DOM node with new style values. If a value is specified as '',\n * the corresponding style property will be unset.\n *\n * @param {string} id ID of the node to update.\n * @param {object} styles Mapping from styles to values.\n * @internal\n */\n updateStylesByID: function(id, styles) {\n var node = ReactMount.getNode(id);\n CSSPropertyOperations.setValueForStyles(node, styles);\n },\n\n /**\n * Updates a DOM node's innerHTML.\n *\n * @param {string} id ID of the node to update.\n * @param {string} html An HTML string.\n * @internal\n */\n updateInnerHTMLByID: function(id, html) {\n var node = ReactMount.getNode(id);\n // HACK: IE8- normalize whitespace in innerHTML, removing leading spaces.\n // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html\n node.innerHTML = html.replace(LEADING_SPACE, '&nbsp;');\n },\n\n /**\n * Updates a DOM node's text content set by `props.content`.\n *\n * @param {string} id ID of the node to update.\n * @param {string} content Text content.\n * @internal\n */\n updateTextContentByID: function(id, content) {\n var node = ReactMount.getNode(id);\n node[textContentAccessor] = content;\n },\n\n /**\n * Replaces a DOM node that exists in the document with markup.\n *\n * @param {string} id ID of child to be replaced.\n * @param {string} markup Dangerous markup to inject in place of child.\n * @internal\n * @see {Danger.dangerouslyReplaceNodeWithMarkup}\n */\n dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {\n var node = ReactMount.getNode(id);\n DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);\n },\n\n /**\n * Updates a component's children by processing a series of updates.\n *\n * @param {array<object>} updates List of update configurations.\n * @param {array<string>} markup List of markup strings.\n * @internal\n */\n dangerouslyProcessChildrenUpdates: function(updates, markup) {\n for (var i = 0; i < updates.length; i++) {\n updates[i].parentNode = ReactMount.getNode(updates[i].parentID);\n }\n DOMChildrenOperations.processUpdates(updates, markup);\n }\n\n};\n\nmodule.exports = ReactDOMIDOperations;\n\nrequire(\"./mock-modules\").register(\"ReactDOMIDOperations\", module);\n",
"keyOf":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule keyOf\n */\n\n/**\n * Allows extraction of a minified key. Let's the build system minify keys\n * without loosing the ability to dynamically use key strings as values\n * themselves. Pass in an object with a single key/val pair and it will return\n * you the string key of that single record. Suppose you want to grab the\n * value for a key 'className' inside of an object. Key/val minification may\n * have aliased that key to be 'xa12'. keyOf({className: null}) will return\n * 'xa12' in that case. Resolve keys you want to use once at startup time, then\n * reuse those resolutions.\n */\nvar keyOf = function(oneKeyObj) {\n var key;\n for (key in oneKeyObj) {\n if (!oneKeyObj.hasOwnProperty(key)) {\n continue;\n }\n return key;\n }\n return null;\n};\n\n\nmodule.exports = keyOf;\n\nrequire(\"./mock-modules\").register(\"keyOf\", module);\n",
"EventPluginHub":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventPluginHub\n */\n\n\"use strict\";\n\nvar CallbackRegistry = require(\"./CallbackRegistry\");\nvar EventPluginRegistry = require(\"./EventPluginRegistry\");\nvar EventPluginUtils = require(\"./EventPluginUtils\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar accumulate = require(\"./accumulate\");\nvar forEachAccumulated = require(\"./forEachAccumulated\");\nvar invariant = require(\"./invariant\");\n\n/**\n * Internal queue of events that have accumulated their dispatches and are\n * waiting to have their dispatches executed.\n */\nvar eventQueue = null;\n\n/**\n * Dispatches an event and releases it back into the pool, unless persistent.\n *\n * @param {?object} event Synthetic event to be dispatched.\n * @private\n */\nvar executeDispatchesAndRelease = function(event) {\n if (event) {\n var executeDispatch = EventPluginUtils.executeDispatch;\n // Plugins can provide custom behavior when dispatching events.\n var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);\n if (PluginModule && PluginModule.executeDispatch) {\n executeDispatch = PluginModule.executeDispatch;\n }\n EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);\n\n if (!event.isPersistent()) {\n event.constructor.release(event);\n }\n }\n};\n\n/**\n * This is a unified interface for event plugins to be installed and configured.\n *\n * Event plugins can implement the following properties:\n *\n * `extractEvents` {function(string, DOMEventTarget, string, object): *}\n * Required. When a top-level event is fired, this method is expected to\n * extract synthetic events that will in turn be queued and dispatched.\n *\n * `eventTypes` {object}\n * Optional, plugins that fire events must publish a mapping of registration\n * names that are used to register listeners. Values of this mapping must\n * be objects that contain `registrationName` or `phasedRegistrationNames`.\n *\n * `executeDispatch` {function(object, function, string)}\n * Optional, allows plugins to override how an event gets dispatched. By\n * default, the listener is simply invoked.\n *\n * Each plugin that is injected into `EventsPluginHub` is immediately operable.\n *\n * @public\n */\nvar EventPluginHub = {\n\n /**\n * Methods for injecting dependencies.\n */\n injection: {\n\n /**\n * @param {object} InjectedInstanceHandle\n * @public\n */\n injectInstanceHandle: EventPropagators.injection.injectInstanceHandle,\n\n /**\n * @param {array} InjectedEventPluginOrder\n * @public\n */\n injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,\n\n /**\n * @param {object} injectedNamesToPlugins Map from names to plugin modules.\n */\n injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName\n\n },\n\n registrationNames: EventPluginRegistry.registrationNames,\n\n putListener: CallbackRegistry.putListener,\n\n getListener: CallbackRegistry.getListener,\n\n deleteListener: CallbackRegistry.deleteListener,\n\n deleteAllListeners: CallbackRegistry.deleteAllListeners,\n\n /**\n * Allows registered plugins an opportunity to extract events from top-level\n * native browser events.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @internal\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n var events;\n var plugins = EventPluginRegistry.plugins;\n for (var i = 0, l = plugins.length; i < l; i++) {\n // Not every plugin in the ordering may be loaded at runtime.\n var possiblePlugin = plugins[i];\n if (possiblePlugin) {\n var extractedEvents = possiblePlugin.extractEvents(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent\n );\n if (extractedEvents) {\n events = accumulate(events, extractedEvents);\n }\n }\n }\n return events;\n },\n\n /**\n * Enqueues a synthetic event that should be dispatched when\n * `processEventQueue` is invoked.\n *\n * @param {*} events An accumulation of synthetic events.\n * @internal\n */\n enqueueEvents: function(events) {\n if (events) {\n eventQueue = accumulate(eventQueue, events);\n }\n },\n\n /**\n * Dispatches all synthetic events on the event queue.\n *\n * @internal\n */\n processEventQueue: function() {\n // Set `eventQueue` to null before processing it so that we can tell if more\n // events get enqueued while processing.\n var processingEventQueue = eventQueue;\n eventQueue = null;\n forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);\n invariant(\n !eventQueue,\n 'processEventQueue(): Additional events were enqueued while processing ' +\n 'an event queue. Support for this has not yet been implemented.'\n );\n }\n\n};\n\nif (ExecutionEnvironment.canUseDOM) {\n window.EventPluginHub = EventPluginHub;\n}\n\nmodule.exports = EventPluginHub;\n\nrequire(\"./mock-modules\").register(\"EventPluginHub\", module);\n",
"TapEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule TapEventPlugin\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar EventPluginUtils = require(\"./EventPluginUtils\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar SyntheticUIEvent = require(\"./SyntheticUIEvent\");\nvar TouchEventUtils = require(\"./TouchEventUtils\");\nvar ViewportMetrics = require(\"./ViewportMetrics\");\n\nvar keyOf = require(\"./keyOf\");\n\nvar isStartish = EventPluginUtils.isStartish;\nvar isEndish = EventPluginUtils.isEndish;\n\n/**\n * Number of pixels that are tolerated in between a `touchStart` and `touchEnd`\n * in order to still be considered a 'tap' event.\n */\nvar tapMoveThreshold = 10;\nvar startCoords = {x: null, y: null};\n\nvar Axis = {\n x: {page: 'pageX', client: 'clientX', envScroll: 'currentPageScrollLeft'},\n y: {page: 'pageY', client: 'clientY', envScroll: 'currentPageScrollTop'}\n};\n\nfunction getAxisCoordOfEvent(axis, nativeEvent) {\n var singleTouch = TouchEventUtils.extractSingleTouch(nativeEvent);\n if (singleTouch) {\n return singleTouch[axis.page];\n }\n return axis.page in nativeEvent ?\n nativeEvent[axis.page] :\n nativeEvent[axis.client] + ViewportMetrics[axis.envScroll];\n}\n\nfunction getDistance(coords, nativeEvent) {\n var pageX = getAxisCoordOfEvent(Axis.x, nativeEvent);\n var pageY = getAxisCoordOfEvent(Axis.y, nativeEvent);\n return Math.pow(\n Math.pow(pageX - coords.x, 2) + Math.pow(pageY - coords.y, 2),\n 0.5\n );\n}\n\nvar eventTypes = {\n touchTap: {\n phasedRegistrationNames: {\n bubbled: keyOf({onTouchTap: null}),\n captured: keyOf({onTouchTapCapture: null})\n }\n }\n};\n\nvar TapEventPlugin = {\n\n tapMoveThreshold: tapMoveThreshold,\n\n eventTypes: eventTypes,\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n if (!isStartish(topLevelType) && !isEndish(topLevelType)) {\n return null;\n }\n var event = null;\n var distance = getDistance(startCoords, nativeEvent);\n if (isEndish(topLevelType) && distance < tapMoveThreshold) {\n event = SyntheticUIEvent.getPooled(\n eventTypes.touchTap,\n topLevelTargetID,\n nativeEvent\n );\n }\n if (isStartish(topLevelType)) {\n startCoords.x = getAxisCoordOfEvent(Axis.x, nativeEvent);\n startCoords.y = getAxisCoordOfEvent(Axis.y, nativeEvent);\n } else if (isEndish(topLevelType)) {\n startCoords.x = 0;\n startCoords.y = 0;\n }\n EventPropagators.accumulateTwoPhaseDispatches(event);\n return event;\n }\n\n};\n\nmodule.exports = TapEventPlugin;\n\nrequire(\"./mock-modules\").register(\"TapEventPlugin\", module);\n",
"ReactInstanceHandles":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactInstanceHandles\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\nvar SEPARATOR = '.';\nvar SEPARATOR_LENGTH = SEPARATOR.length;\n\n/**\n * Maximum depth of traversals before we consider the possibility of a bad ID.\n */\nvar MAX_TREE_DEPTH = 100;\n\n/**\n * Size of the reactRoot ID space. We generate random numbers for React root\n * IDs and if there's a collision the events and DOM update system will\n * get confused. If we assume 100 React components per page, and a user\n * loads 1 page per minute 24/7 for 50 years, with a mount point space of\n * 9,999,999 the likelihood of never having a collision is 99.997%.\n */\nvar GLOBAL_MOUNT_POINT_MAX = 9999999;\n\n/**\n * Creates a DOM ID prefix to use when mounting React components.\n *\n * @param {number} index A unique integer\n * @return {string} React root ID.\n * @internal\n */\nfunction getReactRootIDString(index) {\n return SEPARATOR + 'r[' + index.toString(36) + ']';\n}\n\n/**\n * Checks if a character in the supplied ID is a separator or the end.\n *\n * @param {string} id A React DOM ID.\n * @param {number} index Index of the character to check.\n * @return {boolean} True if the character is a separator or end of the ID.\n * @private\n */\nfunction isBoundary(id, index) {\n return id.charAt(index) === SEPARATOR || index === id.length;\n}\n\n/**\n * Checks if the supplied string is a valid React DOM ID.\n *\n * @param {string} id A React DOM ID, maybe.\n * @return {boolean} True if the string is a valid React DOM ID.\n * @private\n */\nfunction isValidID(id) {\n return id === '' || (\n id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR\n );\n}\n\n/**\n * Checks if the first ID is an ancestor of or equal to the second ID.\n *\n * @param {string} ancestorID\n * @param {string} descendantID\n * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.\n * @internal\n */\nfunction isAncestorIDOf(ancestorID, descendantID) {\n return (\n descendantID.indexOf(ancestorID) === 0 &&\n isBoundary(descendantID, ancestorID.length)\n );\n}\n\n/**\n * Gets the parent ID of the supplied React DOM ID, `id`.\n *\n * @param {string} id ID of a component.\n * @return {string} ID of the parent, or an empty string.\n * @private\n */\nfunction getParentID(id) {\n return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';\n}\n\n/**\n * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the\n * supplied `destinationID`. If they are equal, the ID is returned.\n *\n * @param {string} ancestorID ID of an ancestor node of `destinationID`.\n * @param {string} destinationID ID of the destination node.\n * @return {string} Next ID on the path from `ancestorID` to `destinationID`.\n * @private\n */\nfunction getNextDescendantID(ancestorID, destinationID) {\n invariant(\n isValidID(ancestorID) && isValidID(destinationID),\n 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',\n ancestorID,\n destinationID\n );\n invariant(\n isAncestorIDOf(ancestorID, destinationID),\n 'getNextDescendantID(...): React has made an invalid assumption about ' +\n 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',\n ancestorID,\n destinationID\n );\n if (ancestorID === destinationID) {\n return ancestorID;\n }\n // Skip over the ancestor and the immediate separator. Traverse until we hit\n // another separator or we reach the end of `destinationID`.\n var start = ancestorID.length + SEPARATOR_LENGTH;\n for (var i = start; i < destinationID.length; i++) {\n if (isBoundary(destinationID, i)) {\n break;\n }\n }\n return destinationID.substr(0, i);\n}\n\n/**\n * Gets the nearest common ancestor ID of two IDs.\n *\n * Using this ID scheme, the nearest common ancestor ID is the longest common\n * prefix of the two IDs that immediately preceded a \"marker\" in both strings.\n *\n * @param {string} oneID\n * @param {string} twoID\n * @return {string} Nearest common ancestor ID, or the empty string if none.\n * @private\n */\nfunction getFirstCommonAncestorID(oneID, twoID) {\n var minLength = Math.min(oneID.length, twoID.length);\n if (minLength === 0) {\n return '';\n }\n var lastCommonMarkerIndex = 0;\n // Use `<=` to traverse until the \"EOL\" of the shorter string.\n for (var i = 0; i <= minLength; i++) {\n if (isBoundary(oneID, i) && isBoundary(twoID, i)) {\n lastCommonMarkerIndex = i;\n } else if (oneID.charAt(i) !== twoID.charAt(i)) {\n break;\n }\n }\n var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);\n invariant(\n isValidID(longestCommonID),\n 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',\n oneID,\n twoID,\n longestCommonID\n );\n return longestCommonID;\n}\n\n/**\n * Traverses the parent path between two IDs (either up or down). The IDs must\n * not be the same, and there must exist a parent path between them.\n *\n * @param {?string} start ID at which to start traversal.\n * @param {?string} stop ID at which to end traversal.\n * @param {function} cb Callback to invoke each ID with.\n * @param {?boolean} skipFirst Whether or not to skip the first node.\n * @param {?boolean} skipLast Whether or not to skip the last node.\n * @private\n */\nfunction traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {\n start = start || '';\n stop = stop || '';\n invariant(\n start !== stop,\n 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',\n start\n );\n var traverseUp = isAncestorIDOf(stop, start);\n invariant(\n traverseUp || isAncestorIDOf(start, stop),\n 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +\n 'not have a parent path.',\n start,\n stop\n );\n // Traverse from `start` to `stop` one depth at a time.\n var depth = 0;\n var traverse = traverseUp ? getParentID : getNextDescendantID;\n for (var id = start; /* until break */; id = traverse(id, stop)) {\n if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {\n cb(id, traverseUp, arg);\n }\n if (id === stop) {\n // Only break //after// visiting `stop`.\n break;\n }\n invariant(\n depth++ < MAX_TREE_DEPTH,\n 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +\n 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',\n start, stop\n );\n }\n}\n\n/**\n * Manages the IDs assigned to DOM representations of React components. This\n * uses a specific scheme in order to traverse the DOM efficiently (e.g. in\n * order to simulate events).\n *\n * @internal\n */\nvar ReactInstanceHandles = {\n\n createReactRootID: function() {\n return getReactRootIDString(\n Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX)\n );\n },\n\n /**\n * Constructs a React ID by joining a root ID with a name.\n *\n * @param {string} rootID Root ID of a parent component.\n * @param {string} name A component's name (as flattened children).\n * @return {string} A React ID.\n * @internal\n */\n createReactID: function(rootID, name) {\n return rootID + SEPARATOR + name;\n },\n\n /**\n * Gets the DOM ID of the React component that is the root of the tree that\n * contains the React component with the supplied DOM ID.\n *\n * @param {string} id DOM ID of a React component.\n * @return {?string} DOM ID of the React component that is the root.\n * @internal\n */\n getReactRootIDFromNodeID: function(id) {\n var regexResult = /\\.r\\[[^\\]]+\\]/.exec(id);\n return regexResult && regexResult[0];\n },\n\n /**\n * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that\n * should would receive a `mouseEnter` or `mouseLeave` event.\n *\n * NOTE: Does not invoke the callback on the nearest common ancestor because\n * nothing \"entered\" or \"left\" that element.\n *\n * @param {string} leaveID ID being left.\n * @param {string} enterID ID being entered.\n * @param {function} cb Callback to invoke on each entered/left ID.\n * @param {*} upArg Argument to invoke the callback with on left IDs.\n * @param {*} downArg Argument to invoke the callback with on entered IDs.\n * @internal\n */\n traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {\n var ancestorID = getFirstCommonAncestorID(leaveID, enterID);\n if (ancestorID !== leaveID) {\n traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);\n }\n if (ancestorID !== enterID) {\n traverseParentPath(ancestorID, enterID, cb, downArg, true, false);\n }\n },\n\n /**\n * Simulates the traversal of a two-phase, capture/bubble event dispatch.\n *\n * NOTE: This traversal happens on IDs without touching the DOM.\n *\n * @param {string} targetID ID of the target node.\n * @param {function} cb Callback to invoke.\n * @param {*} arg Argument to invoke the callback with.\n * @internal\n */\n traverseTwoPhase: function(targetID, cb, arg) {\n if (targetID) {\n traverseParentPath('', targetID, cb, arg, true, false);\n traverseParentPath(targetID, '', cb, arg, false, true);\n }\n },\n\n /**\n * Exposed for unit testing.\n * @private\n */\n _getFirstCommonAncestorID: getFirstCommonAncestorID,\n\n /**\n * Exposed for unit testing.\n * @private\n */\n _getNextDescendantID: getNextDescendantID,\n\n isAncestorIDOf: isAncestorIDOf,\n\n SEPARATOR: SEPARATOR\n\n};\n\nmodule.exports = ReactInstanceHandles;\n\nrequire(\"./mock-modules\").register(\"ReactInstanceHandles\", module);\n",
"objMapKeyVal":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule objMapKeyVal\n */\n\n\"use strict\";\n\n/**\n * Behaves the same as `objMap` but invokes func with the key first, and value\n * second. Use `objMap` unless you need this special case.\n * Invokes func as:\n *\n * func(key, value, iteration)\n *\n * @param {?object} obj Object to map keys over\n * @param {!function} func Invoked for each key/val pair.\n * @param {?*} context\n * @return {?object} Result of mapping or null if obj is falsey\n */\nfunction objMapKeyVal(obj, func, context) {\n if (!obj) {\n return null;\n }\n var i = 0;\n var ret = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n ret[key] = func.call(context, key, obj[key], i++);\n }\n }\n return ret;\n}\n\nmodule.exports = objMapKeyVal;\n\nrequire(\"./mock-modules\").register(\"objMapKeyVal\", module);\n",
"getTestDocument":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getTestDocument\n */\n\n/**\n * We need to work around the fact that we have two different\n * test implementations: once that breaks if we clobber document\n * (open-source) and one that doesn't support createHTMLDocument()\n * (jst).\n */\nfunction getTestDocument() {\n if (document.implementation &&\n document.implementation.createHTMLDocument) {\n return document.implementation.createHTMLDocument('test doc');\n }\n return null;\n}\n\nmodule.exports = getTestDocument;\n\nrequire(\"./mock-modules\").register(\"getTestDocument\", module);\n",
"ReactStateSetters":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactStateSetters\n */\n\n\"use strict\";\n\nvar ReactStateSetters = {\n /**\n * Returns a function that calls the provided function, and uses the result\n * of that to set the component's state.\n *\n * @param {ReactCompositeComponent} component\n * @param {function} funcReturningState Returned callback uses this to\n * determine how to update state.\n * @return {function} callback that when invoked uses funcReturningState to\n * determined the object literal to setState.\n */\n createStateSetter: function(component, funcReturningState) {\n return function(a, b, c, d, e, f) {\n var partialState = funcReturningState.call(component, a, b, c, d, e, f);\n if (partialState) {\n component.setState(partialState);\n }\n };\n },\n\n /**\n * Returns a single-argument callback that can be used to update a single\n * key in the component's state.\n *\n * Note: this is memoized function, which makes it inexpensive to call.\n *\n * @param {ReactCompositeComponent} component\n * @param {string} key The key in the state that you should update.\n * @return {function} callback of 1 argument which calls setState() with\n * the provided keyName and callback argument.\n */\n createStateKeySetter: function(component, key) {\n // Memoize the setters.\n var cache = component.__keySetters || (component.__keySetters = {});\n return cache[key] || (cache[key] = createStateKeySetter(component, key));\n }\n};\n\nfunction createStateKeySetter(component, key) {\n // Partial state is allocated outside of the function closure so it can be\n // reused with every call, avoiding memory allocation when this function\n // is called.\n var partialState = {};\n return function stateKeySetter(value) {\n partialState[key] = value;\n component.setState(partialState);\n };\n}\n\nReactStateSetters.Mixin = {\n /**\n * Returns a function that calls the provided function, and uses the result\n * of that to set the component's state.\n *\n * For example, these statements are equivalent:\n *\n * this.setState({x: 1});\n * this.createStateSetter(function(xValue) {\n * return {x: xValue};\n * })(1);\n *\n * @param {function} funcReturningState Returned callback uses this to\n * determine how to update state.\n * @return {function} callback that when invoked uses funcReturningState to\n * determined the object literal to setState.\n */\n createStateSetter: function(funcReturningState) {\n return ReactStateSetters.createStateSetter(this, funcReturningState);\n },\n\n /**\n * Returns a single-argument callback that can be used to update a single\n * key in the component's state.\n *\n * For example, these statements are equivalent:\n *\n * this.setState({x: 1});\n * this.createStateKeySetter('x')(1);\n *\n * Note: this is memoized function, which makes it inexpensive to call.\n *\n * @param {string} key The key in the state that you should update.\n * @return {function} callback of 1 argument which calls setState() with\n * the provided keyName and callback argument.\n */\n createStateKeySetter: function(key) {\n return ReactStateSetters.createStateKeySetter(this, key);\n }\n};\n\nmodule.exports = ReactStateSetters;\n\nrequire(\"./mock-modules\").register(\"ReactStateSetters\", module);\n",
"ReactUpdates":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactUpdates\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\nvar dirtyComponents = [];\n\nvar batchingStrategy = null;\n\nfunction ensureBatchingStrategy() {\n invariant(batchingStrategy, 'ReactUpdates: must inject a batching strategy');\n}\n\nfunction batchedUpdates(callback, param) {\n ensureBatchingStrategy();\n batchingStrategy.batchedUpdates(callback, param);\n}\n\n/**\n * Array comparator for ReactComponents by owner depth\n *\n * @param {ReactComponent} c1 first component you're comparing\n * @param {ReactComponent} c2 second component you're comparing\n * @return {number} Return value usable by Array.prototype.sort().\n */\nfunction mountDepthComparator(c1, c2) {\n return c1._mountDepth - c2._mountDepth;\n}\n\nfunction runBatchedUpdates() {\n // Since reconciling a component higher in the owner hierarchy usually (not\n // always -- see shouldComponentUpdate()) will reconcile children, reconcile\n // them before their children by sorting the array.\n\n dirtyComponents.sort(mountDepthComparator);\n\n for (var i = 0; i < dirtyComponents.length; i++) {\n // If a component is unmounted before pending changes apply, ignore them\n // TODO: Queue unmounts in the same list to avoid this happening at all\n var component = dirtyComponents[i];\n if (component.isMounted()) {\n // If performUpdateIfNecessary happens to enqueue any new updates, we\n // shouldn't execute the callbacks until the next render happens, so\n // stash the callbacks first\n var callbacks = component._pendingCallbacks;\n component._pendingCallbacks = null;\n component.performUpdateIfNecessary();\n if (callbacks) {\n for (var j = 0; j < callbacks.length; j++) {\n callbacks[j].call(component);\n }\n }\n }\n }\n}\n\nfunction clearDirtyComponents() {\n dirtyComponents.length = 0;\n}\n\nfunction flushBatchedUpdates() {\n // Run these in separate functions so the JIT can optimize\n try {\n runBatchedUpdates();\n } catch (e) {\n // IE 8 requires catch to use finally.\n throw e;\n } finally {\n clearDirtyComponents();\n }\n}\n\n/**\n * Mark a component as needing a rerender, adding an optional callback to a\n * list of functions which will be executed once the rerender occurs.\n */\nfunction enqueueUpdate(component, callback) {\n invariant(\n !callback || typeof callback === \"function\",\n 'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' +\n '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +\n 'isn\\'t callable.'\n );\n ensureBatchingStrategy();\n\n if (!batchingStrategy.isBatchingUpdates) {\n component.performUpdateIfNecessary();\n callback && callback();\n return;\n }\n\n dirtyComponents.push(component);\n\n if (callback) {\n if (component._pendingCallbacks) {\n component._pendingCallbacks.push(callback);\n } else {\n component._pendingCallbacks = [callback];\n }\n }\n}\n\nvar ReactUpdatesInjection = {\n injectBatchingStrategy: function(_batchingStrategy) {\n invariant(\n _batchingStrategy,\n 'ReactUpdates: must provide a batching strategy'\n );\n invariant(\n typeof _batchingStrategy.batchedUpdates === 'function',\n 'ReactUpdates: must provide a batchedUpdates() function'\n );\n invariant(\n typeof _batchingStrategy.isBatchingUpdates === 'boolean',\n 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'\n );\n batchingStrategy = _batchingStrategy;\n }\n};\n\nvar ReactUpdates = {\n batchedUpdates: batchedUpdates,\n enqueueUpdate: enqueueUpdate,\n flushBatchedUpdates: flushBatchedUpdates,\n injection: ReactUpdatesInjection\n};\n\nmodule.exports = ReactUpdates;\n\nrequire(\"./mock-modules\").register(\"ReactUpdates\", module);\n",
"CSSPropertyOperations":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule CSSPropertyOperations\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar CSSProperty = require(\"./CSSProperty\");\n\nvar dangerousStyleValue = require(\"./dangerousStyleValue\");\nvar escapeTextForBrowser = require(\"./escapeTextForBrowser\");\nvar hyphenate = require(\"./hyphenate\");\nvar memoizeStringOnly = require(\"./memoizeStringOnly\");\n\nvar processStyleName = memoizeStringOnly(function(styleName) {\n return escapeTextForBrowser(hyphenate(styleName));\n});\n\n/**\n * Operations for dealing with CSS properties.\n */\nvar CSSPropertyOperations = {\n\n /**\n * Serializes a mapping of style properties for use as inline styles:\n *\n * > createMarkupForStyles({width: '200px', height: 0})\n * \"width:200px;height:0;\"\n *\n * Undefined values are ignored so that declarative programming is easier.\n *\n * @param {object} styles\n * @return {?string}\n */\n createMarkupForStyles: function(styles) {\n var serialized = '';\n for (var styleName in styles) {\n if (!styles.hasOwnProperty(styleName)) {\n continue;\n }\n var styleValue = styles[styleName];\n if (styleValue != null) {\n serialized += processStyleName(styleName) + ':';\n serialized += dangerousStyleValue(styleName, styleValue) + ';';\n }\n }\n return serialized || null;\n },\n\n /**\n * Sets the value for multiple styles on a node. If a value is specified as\n * '' (empty string), the corresponding style property will be unset.\n *\n * @param {DOMElement} node\n * @param {object} styles\n */\n setValueForStyles: function(node, styles) {\n var style = node.style;\n for (var styleName in styles) {\n if (!styles.hasOwnProperty(styleName)) {\n continue;\n }\n var styleValue = dangerousStyleValue(styleName, styles[styleName]);\n if (styleValue) {\n style[styleName] = styleValue;\n } else {\n var expansion = CSSProperty.shorthandPropertyExpansions[styleName];\n if (expansion) {\n // Shorthand property that IE8 won't like unsetting, so unset each\n // component to placate it\n for (var individualStyleName in expansion) {\n style[individualStyleName] = '';\n }\n } else {\n style[styleName] = '';\n }\n }\n }\n }\n\n};\n\nmodule.exports = CSSPropertyOperations;\n\nrequire(\"./mock-modules\").register(\"CSSPropertyOperations\", module);\n",
"DOMProperty":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule DOMProperty\n * @typechecks static-only\n */\n\n/*jslint bitwise: true */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\nvar DOMPropertyInjection = {\n /**\n * Mapping from normalized, camelcased property names to a configuration that\n * specifies how the associated DOM property should be accessed or rendered.\n */\n MUST_USE_ATTRIBUTE: 0x1,\n MUST_USE_PROPERTY: 0x2,\n HAS_BOOLEAN_VALUE: 0x4,\n HAS_SIDE_EFFECTS: 0x8,\n\n /**\n * Inject some specialized knowledge about the DOM. This takes a config object\n * with the following properties:\n *\n * isCustomAttribute: function that given an attribute name will return true\n * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*\n * attributes where it's impossible to enumerate all of the possible\n * attribute names,\n *\n * Properties: object mapping DOM property name to one of the\n * DOMPropertyInjection constants or null. If your attribute isn't in here,\n * it won't get written to the DOM.\n *\n * DOMAttributeNames: object mapping React attribute name to the DOM\n * attribute name. Attribute names not specified use the **lowercase**\n * normalized name.\n *\n * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.\n * Property names not specified use the normalized name.\n *\n * DOMMutationMethods: Properties that require special mutation methods. If\n * `value` is undefined, the mutation method should unset the property.\n *\n * @param {object} domPropertyConfig the config as described above.\n */\n injectDOMPropertyConfig: function(domPropertyConfig) {\n var Properties = domPropertyConfig.Properties || {};\n var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};\n var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};\n var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};\n\n if (domPropertyConfig.isCustomAttribute) {\n DOMProperty._isCustomAttributeFunctions.push(\n domPropertyConfig.isCustomAttribute\n );\n }\n\n for (var propName in Properties) {\n invariant(\n !DOMProperty.isStandardName[propName],\n 'injectDOMPropertyConfig(...): You\\'re trying to inject DOM property ' +\n '\\'%s\\' which has already been injected. You may be accidentally ' +\n 'injecting the same DOM property config twice, or you may be ' +\n 'injecting two configs that have conflicting property names.',\n propName\n );\n\n DOMProperty.isStandardName[propName] = true;\n\n var lowerCased = propName.toLowerCase();\n DOMProperty.getPossibleStandardName[lowerCased] = propName;\n\n var attributeName = DOMAttributeNames[propName];\n if (attributeName) {\n DOMProperty.getPossibleStandardName[attributeName] = propName;\n }\n\n DOMProperty.getAttributeName[propName] = attributeName || lowerCased;\n\n DOMProperty.getPropertyName[propName] =\n DOMPropertyNames[propName] || propName;\n\n var mutationMethod = DOMMutationMethods[propName];\n if (mutationMethod) {\n DOMProperty.getMutationMethod[propName] = mutationMethod;\n }\n\n var propConfig = Properties[propName];\n DOMProperty.mustUseAttribute[propName] =\n propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE;\n DOMProperty.mustUseProperty[propName] =\n propConfig & DOMPropertyInjection.MUST_USE_PROPERTY;\n DOMProperty.hasBooleanValue[propName] =\n propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;\n DOMProperty.hasSideEffects[propName] =\n propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;\n\n invariant(\n !DOMProperty.mustUseAttribute[propName] ||\n !DOMProperty.mustUseProperty[propName],\n 'DOMProperty: Cannot use require using both attribute and property: %s',\n propName\n );\n invariant(\n DOMProperty.mustUseProperty[propName] ||\n !DOMProperty.hasSideEffects[propName],\n 'DOMProperty: Properties that have side effects must use property: %s',\n propName\n );\n }\n }\n};\nvar defaultValueCache = {};\n\n/**\n * DOMProperty exports lookup objects that can be used like functions:\n *\n * > DOMProperty.isValid['id']\n * true\n * > DOMProperty.isValid['foobar']\n * undefined\n *\n * Although this may be confusing, it performs better in general.\n *\n * @see http://jsperf.com/key-exists\n * @see http://jsperf.com/key-missing\n */\nvar DOMProperty = {\n\n /**\n * Checks whether a property name is a standard property.\n * @type {Object}\n */\n isStandardName: {},\n\n /**\n * Mapping from lowercase property names to the properly cased version, used\n * to warn in the case of missing properties.\n * @type {Object}\n */\n getPossibleStandardName: {},\n\n /**\n * Mapping from normalized names to attribute names that differ. Attribute\n * names are used when rendering markup or with `*Attribute()`.\n * @type {Object}\n */\n getAttributeName: {},\n\n /**\n * Mapping from normalized names to properties on DOM node instances.\n * (This includes properties that mutate due to external factors.)\n * @type {Object}\n */\n getPropertyName: {},\n\n /**\n * Mapping from normalized names to mutation methods. This will only exist if\n * mutation cannot be set simply by the property or `setAttribute()`.\n * @type {Object}\n */\n getMutationMethod: {},\n\n /**\n * Whether the property must be accessed and mutated as an object property.\n * @type {Object}\n */\n mustUseAttribute: {},\n\n /**\n * Whether the property must be accessed and mutated using `*Attribute()`.\n * (This includes anything that fails `<propName> in <element>`.)\n * @type {Object}\n */\n mustUseProperty: {},\n\n /**\n * Whether the property should be removed when set to a falsey value.\n * @type {Object}\n */\n hasBooleanValue: {},\n\n /**\n * Whether or not setting a value causes side effects such as triggering\n * resources to be loaded or text selection changes. We must ensure that\n * the value is only set if it has changed.\n * @type {Object}\n */\n hasSideEffects: {},\n\n /**\n * All of the isCustomAttribute() functions that have been injected.\n */\n _isCustomAttributeFunctions: [],\n\n /**\n * Checks whether a property name is a custom attribute.\n * @method\n */\n isCustomAttribute: function(attributeName) {\n return DOMProperty._isCustomAttributeFunctions.some(\n function(isCustomAttributeFn) {\n return isCustomAttributeFn.call(null, attributeName);\n }\n );\n },\n\n /**\n * Returns the default property value for a DOM property (i.e., not an\n * attribute). Most default values are '' or false, but not all. Worse yet,\n * some (in particular, `type`) vary depending on the type of element.\n *\n * TODO: Is it better to grab all the possible properties when creating an\n * element to avoid having to create the same element twice?\n */\n getDefaultValueForProperty: function(nodeName, prop) {\n var nodeDefaults = defaultValueCache[nodeName];\n var testElement;\n if (!nodeDefaults) {\n defaultValueCache[nodeName] = nodeDefaults = {};\n }\n if (!(prop in nodeDefaults)) {\n testElement = document.createElement(nodeName);\n nodeDefaults[prop] = testElement[prop];\n }\n return nodeDefaults[prop];\n },\n\n injection: DOMPropertyInjection\n};\n\nmodule.exports = DOMProperty;\n\nrequire(\"./mock-modules\").register(\"DOMProperty\", module);\n",
"Danger":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule Danger\n * @typechecks static-only\n */\n\n/*jslint evil: true, sub: true */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar createNodesFromMarkup = require(\"./createNodesFromMarkup\");\nvar emptyFunction = require(\"./emptyFunction\");\nvar getMarkupWrap = require(\"./getMarkupWrap\");\nvar invariant = require(\"./invariant\");\nvar mutateHTMLNodeWithMarkup = require(\"./mutateHTMLNodeWithMarkup\");\n\nvar OPEN_TAG_NAME_EXP = /^(<[^ \\/>]+)/;\nvar RESULT_INDEX_ATTR = 'data-danger-index';\n\n/**\n * Extracts the `nodeName` from a string of markup.\n *\n * NOTE: Extracting the `nodeName` does not require a regular expression match\n * because we make assumptions about React-generated markup (i.e. there are no\n * spaces surrounding the opening tag and there is at least one attribute).\n *\n * @param {string} markup String of markup.\n * @return {string} Node name of the supplied markup.\n * @see http://jsperf.com/extract-nodename\n */\nfunction getNodeName(markup) {\n return markup.substring(1, markup.indexOf(' '));\n}\n\nvar Danger = {\n\n /**\n * Renders markup into an array of nodes. The markup is expected to render\n * into a list of root nodes. Also, the length of `resultList` and\n * `markupList` should be the same.\n *\n * @param {array<string>} markupList List of markup strings to render.\n * @return {array<DOMElement>} List of rendered nodes.\n * @internal\n */\n dangerouslyRenderMarkup: function(markupList) {\n invariant(\n ExecutionEnvironment.canUseDOM,\n 'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' +\n 'thread. This is likely a bug in the framework. Please report ' +\n 'immediately.'\n );\n var nodeName;\n var markupByNodeName = {};\n // Group markup by `nodeName` if a wrap is necessary, else by '*'.\n for (var i = 0; i < markupList.length; i++) {\n invariant(\n markupList[i],\n 'dangerouslyRenderMarkup(...): Missing markup.'\n );\n nodeName = getNodeName(markupList[i]);\n nodeName = getMarkupWrap(nodeName) ? nodeName : '*';\n markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];\n markupByNodeName[nodeName][i] = markupList[i];\n }\n var resultList = [];\n var resultListAssignmentCount = 0;\n for (nodeName in markupByNodeName) {\n if (!markupByNodeName.hasOwnProperty(nodeName)) {\n continue;\n }\n var markupListByNodeName = markupByNodeName[nodeName];\n\n // This for-in loop skips the holes of the sparse array. The order of\n // iteration should follow the order of assignment, which happens to match\n // numerical index order, but we don't rely on that.\n for (var resultIndex in markupListByNodeName) {\n if (markupListByNodeName.hasOwnProperty(resultIndex)) {\n var markup = markupListByNodeName[resultIndex];\n\n // Push the requested markup with an additional RESULT_INDEX_ATTR\n // attribute. If the markup does not start with a < character, it\n // will be discarded below (with an appropriate console.error).\n markupListByNodeName[resultIndex] = markup.replace(\n OPEN_TAG_NAME_EXP,\n // This index will be parsed back out below.\n '$1 ' + RESULT_INDEX_ATTR + '=\"' + resultIndex + '\" '\n );\n }\n }\n\n // Render each group of markup with similar wrapping `nodeName`.\n var renderNodes = createNodesFromMarkup(\n markupListByNodeName.join(''),\n emptyFunction // Do nothing special with <script> tags.\n );\n\n for (i = 0; i < renderNodes.length; ++i) {\n var renderNode = renderNodes[i];\n if (renderNode.hasAttribute &&\n renderNode.hasAttribute(RESULT_INDEX_ATTR)) {\n\n resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);\n renderNode.removeAttribute(RESULT_INDEX_ATTR);\n\n invariant(\n !resultList.hasOwnProperty(resultIndex),\n 'Danger: Assigning to an already-occupied result index.'\n );\n\n resultList[resultIndex] = renderNode;\n\n // This should match resultList.length and markupList.length when\n // we're done.\n resultListAssignmentCount += 1;\n\n } else if (true) {\n console.error(\n \"Danger: Discarding unexpected node:\",\n renderNode\n );\n }\n }\n }\n\n // Although resultList was populated out of order, it should now be a dense\n // array.\n invariant(\n resultListAssignmentCount === resultList.length,\n 'Danger: Did not assign to every index of resultList.'\n );\n\n invariant(\n resultList.length === markupList.length,\n 'Danger: Expected markup to render %s nodes, but rendered %s.',\n markupList.length,\n resultList.length\n );\n\n return resultList;\n },\n\n /**\n * Replaces a node with a string of markup at its current position within its\n * parent. The markup must render into a single root node.\n *\n * @param {DOMElement} oldChild Child node to replace.\n * @param {string} markup Markup to render in place of the child node.\n * @internal\n */\n dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {\n invariant(\n ExecutionEnvironment.canUseDOM,\n 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +\n 'worker thread. This is likely a bug in the framework. Please report ' +\n 'immediately.'\n );\n invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.');\n // createNodesFromMarkup() won't work if the markup is rooted by <html>\n // since it has special semantic meaning. So we use an alternatie strategy.\n if (oldChild.tagName.toLowerCase() === 'html') {\n mutateHTMLNodeWithMarkup(oldChild, markup);\n return;\n }\n var newChild = createNodesFromMarkup(markup, emptyFunction)[0];\n oldChild.parentNode.replaceChild(newChild, oldChild);\n }\n\n};\n\nmodule.exports = Danger;\n\nrequire(\"./mock-modules\").register(\"Danger\", module);\n",
"getNodeForCharacterOffset":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getNodeForCharacterOffset\n */\n\n\"use strict\";\n\n/**\n * Given any node return the first leaf node without children.\n *\n * @param {DOMElement|DOMTextNode} node\n * @return {DOMElement|DOMTextNode}\n */\nfunction getLeafNode(node) {\n while (node && node.firstChild) {\n node = node.firstChild;\n }\n return node;\n}\n\n/**\n * Get the next sibling within a container. This will walk up the\n * DOM if a node's siblings have been exhausted.\n *\n * @param {DOMElement|DOMTextNode} node\n * @return {?DOMElement|DOMTextNode}\n */\nfunction getSiblingNode(node) {\n while (node) {\n if (node.nextSibling) {\n return node.nextSibling;\n }\n node = node.parentNode;\n }\n}\n\n/**\n * Get object describing the nodes which contain characters at offset.\n *\n * @param {DOMElement|DOMTextNode} root\n * @param {number} offset\n * @return {?object}\n */\nfunction getNodeForCharacterOffset(root, offset) {\n var node = getLeafNode(root);\n var nodeStart = 0;\n var nodeEnd = 0;\n\n while (node) {\n if (node.nodeType == 3) {\n nodeEnd = nodeStart + node.textContent.length;\n\n if (nodeStart <= offset && nodeEnd >= offset) {\n return {\n node: node,\n offset: offset - nodeStart\n };\n }\n\n nodeStart = nodeEnd;\n }\n\n node = getLeafNode(getSiblingNode(node));\n }\n}\n\nmodule.exports = getNodeForCharacterOffset;\n\nrequire(\"./mock-modules\").register(\"getNodeForCharacterOffset\", module);\n",
"mutateHTMLNodeWithMarkup":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mutateHTMLNodeWithMarkup\n * @typechecks static-only\n */\n\n/*jslint evil: true */\n\n'use strict';\n\nvar createNodesFromMarkup = require(\"./createNodesFromMarkup\");\nvar filterAttributes = require(\"./filterAttributes\");\nvar invariant = require(\"./invariant\");\n\n/**\n * You can't set the innerHTML of a document. Unless you have\n * this function.\n *\n * @param {DOMElement} node with tagName == 'html'\n * @param {string} markup markup string including <html>.\n */\nfunction mutateHTMLNodeWithMarkup(node, markup) {\n invariant(\n node.tagName.toLowerCase() === 'html',\n 'mutateHTMLNodeWithMarkup(): node must have tagName of \"html\", got %s',\n node.tagName\n );\n\n markup = markup.trim();\n invariant(\n markup.toLowerCase().indexOf('<html') === 0,\n 'mutateHTMLNodeWithMarkup(): markup must start with <html'\n );\n\n // First let's extract the various pieces of markup.\n var htmlOpenTagEnd = markup.indexOf('>') + 1;\n var htmlCloseTagStart = markup.lastIndexOf('<');\n var htmlOpenTag = markup.substring(0, htmlOpenTagEnd);\n var innerHTML = markup.substring(htmlOpenTagEnd, htmlCloseTagStart);\n\n // Now for the fun stuff. Pass through both sets of attributes and\n // bring them up-to-date. We get the new set by creating a markup\n // fragment.\n var shouldExtractAttributes = htmlOpenTag.indexOf(' ') > -1;\n var attributeHolder = null;\n\n if (shouldExtractAttributes) {\n // We extract the attributes by creating a <span> and evaluating\n // the node.\n attributeHolder = createNodesFromMarkup(\n htmlOpenTag.replace('html ', 'span ') + '</span>'\n )[0];\n\n // Add all attributes present in attributeHolder\n var attributesToSet = filterAttributes(\n attributeHolder,\n function(attr) {\n return node.getAttributeNS(attr.namespaceURI, attr.name) !== attr.value;\n }\n );\n attributesToSet.forEach(function(attr) {\n node.setAttributeNS(attr.namespaceURI, attr.name, attr.value);\n });\n }\n\n // Remove all attributes not present in attributeHolder\n var attributesToRemove = filterAttributes(\n node,\n function(attr) {\n // Remove all attributes if attributeHolder is null or if it does not have\n // the desired attribute.\n return !(\n attributeHolder &&\n attributeHolder.hasAttributeNS(attr.namespaceURI, attr.name)\n );\n }\n );\n attributesToRemove.forEach(function(attr) {\n node.removeAttributeNS(attr.namespaceURI, attr.name);\n });\n\n // Finally, set the inner HTML. No tricks needed. Do this last to\n // minimize likelihood of triggering reflows.\n node.innerHTML = innerHTML;\n}\n\nmodule.exports = mutateHTMLNodeWithMarkup;\n\nrequire(\"./mock-modules\").register(\"mutateHTMLNodeWithMarkup\", module);\n",
"emptyFunction":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule emptyFunction\n */\n\nvar copyProperties = require(\"./copyProperties\");\n\nfunction makeEmptyFunction(arg) {\n return function() {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nfunction emptyFunction() {}\n\ncopyProperties(emptyFunction, {\n thatReturns: makeEmptyFunction,\n thatReturnsFalse: makeEmptyFunction(false),\n thatReturnsTrue: makeEmptyFunction(true),\n thatReturnsNull: makeEmptyFunction(null),\n thatReturnsThis: function() { return this; },\n thatReturnsArgument: function(arg) { return arg; }\n});\n\nmodule.exports = emptyFunction;\n\nrequire(\"./mock-modules\").register(\"emptyFunction\", module);\n",
"ExecutionEnvironment":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ExecutionEnvironment\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar canUseDOM = typeof window !== 'undefined';\n\n/**\n * Simple, lightweight module assisting with the detection and context of\n * Worker. Helps avoid circular dependencies and allows code to reason about\n * whether or not they are in a Worker, even if they never include the main\n * `ReactWorker` dependency.\n */\nvar ExecutionEnvironment = {\n\n canUseDOM: canUseDOM,\n\n canUseWorkers: typeof Worker !== 'undefined',\n\n isInWorker: !canUseDOM // For now, this is true - might change in the future.\n\n};\n\nmodule.exports = ExecutionEnvironment;\n\nrequire(\"./mock-modules\").register(\"ExecutionEnvironment\", module);\n",
"ReactServerRendering":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @typechecks static-only\n * @providesModule ReactServerRendering\n */\n\"use strict\";\n\nvar ReactMarkupChecksum = require(\"./ReactMarkupChecksum\");\nvar ReactReconcileTransaction = require(\"./ReactReconcileTransaction\");\nvar ReactInstanceHandles = require(\"./ReactInstanceHandles\");\n\n/**\n * @param {object} component\n * @param {function} callback\n */\nfunction renderComponentToString(component, callback) {\n // We use a callback API to keep the API async in case in the future we ever\n // need it, but in reality this is a synchronous operation.\n var id = ReactInstanceHandles.createReactRootID();\n var transaction = ReactReconcileTransaction.getPooled();\n transaction.reinitializeTransaction();\n try {\n transaction.perform(function() {\n var markup = component.mountComponent(id, transaction, 0);\n markup = ReactMarkupChecksum.addChecksumToMarkup(markup);\n callback(markup);\n }, null);\n } finally {\n ReactReconcileTransaction.release(transaction);\n }\n}\n\nmodule.exports = {\n renderComponentToString: renderComponentToString\n};\n\nrequire(\"./mock-modules\").register(\"ReactServerRendering\", module);\n",
"ReactMarkupChecksum":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactMarkupChecksum\n */\n\n\"use strict\";\n\nvar adler32 = require(\"./adler32\");\n\nvar ReactMarkupChecksum = {\n CHECKSUM_ATTR_NAME: 'data-react-checksum',\n\n /**\n * @param {string} markup Markup string\n * @return {string} Markup string with checksum attribute attached\n */\n addChecksumToMarkup: function(markup) {\n var checksum = adler32(markup);\n return markup.replace(\n '>',\n ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '=\"' + checksum + '\">'\n );\n },\n\n /**\n * @param {string} markup to use\n * @param {DOMElement} element root React element\n * @returns {boolean} whether or not the markup is the same\n */\n canReuseMarkup: function(markup, element) {\n var existingChecksum = element.getAttribute(\n ReactMarkupChecksum.CHECKSUM_ATTR_NAME\n );\n existingChecksum = existingChecksum && parseInt(existingChecksum, 10);\n var markupChecksum = adler32(markup);\n return markupChecksum === existingChecksum;\n }\n};\n\nmodule.exports = ReactMarkupChecksum;\n\nrequire(\"./mock-modules\").register(\"ReactMarkupChecksum\", module);\n",
"merge":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule merge\n */\n\n\"use strict\";\n\nvar mergeInto = require(\"./mergeInto\");\n\n/**\n * Shallow merges two structures into a return value, without mutating either.\n *\n * @param {?object} one Optional object with properties to merge from.\n * @param {?object} two Optional object with properties to merge from.\n * @return {object} The shallow extension of one by two.\n */\nvar merge = function(one, two) {\n var result = {};\n mergeInto(result, one);\n mergeInto(result, two);\n return result;\n};\n\nmodule.exports = merge;\n\nrequire(\"./mock-modules\").register(\"merge\", module);\n",
"EventPluginRegistry":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventPluginRegistry\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\n/**\n * Injectable ordering of event plugins.\n */\nvar EventPluginOrder = null;\n\n/**\n * Injectable mapping from names to event plugin modules.\n */\nvar namesToPlugins = {};\n\n/**\n * Recomputes the plugin list using the injected plugins and plugin ordering.\n *\n * @private\n */\nfunction recomputePluginOrdering() {\n if (!EventPluginOrder) {\n // Wait until an `EventPluginOrder` is injected.\n return;\n }\n for (var pluginName in namesToPlugins) {\n var PluginModule = namesToPlugins[pluginName];\n var pluginIndex = EventPluginOrder.indexOf(pluginName);\n invariant(\n pluginIndex > -1,\n 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +\n 'the plugin ordering, `%s`.',\n pluginName\n );\n if (EventPluginRegistry.plugins[pluginIndex]) {\n continue;\n }\n invariant(\n PluginModule.extractEvents,\n 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +\n 'method, but `%s` does not.',\n pluginName\n );\n EventPluginRegistry.plugins[pluginIndex] = PluginModule;\n var publishedEvents = PluginModule.eventTypes;\n for (var eventName in publishedEvents) {\n invariant(\n publishEventForPlugin(publishedEvents[eventName], PluginModule),\n 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',\n eventName,\n pluginName\n );\n }\n }\n}\n\n/**\n * Publishes an event so that it can be dispatched by the supplied plugin.\n *\n * @param {object} dispatchConfig Dispatch configuration for the event.\n * @param {object} PluginModule Plugin publishing the event.\n * @return {boolean} True if the event was successfully published.\n * @private\n */\nfunction publishEventForPlugin(dispatchConfig, PluginModule) {\n var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;\n if (phasedRegistrationNames) {\n for (var phaseName in phasedRegistrationNames) {\n if (phasedRegistrationNames.hasOwnProperty(phaseName)) {\n var phasedRegistrationName = phasedRegistrationNames[phaseName];\n publishRegistrationName(phasedRegistrationName, PluginModule);\n }\n }\n return true;\n } else if (dispatchConfig.registrationName) {\n publishRegistrationName(dispatchConfig.registrationName, PluginModule);\n return true;\n }\n return false;\n}\n\n/**\n * Publishes a registration name that is used to identify dispatched events and\n * can be used with `EventPluginHub.putListener` to register listeners.\n *\n * @param {string} registrationName Registration name to add.\n * @param {object} PluginModule Plugin publishing the event.\n * @private\n */\nfunction publishRegistrationName(registrationName, PluginModule) {\n invariant(\n !EventPluginRegistry.registrationNames[registrationName],\n 'EventPluginHub: More than one plugin attempted to publish the same ' +\n 'registration name, `%s`.',\n registrationName\n );\n EventPluginRegistry.registrationNames[registrationName] = PluginModule;\n EventPluginRegistry.registrationNamesKeys.push(registrationName);\n}\n\n/**\n * Registers plugins so that they can extract and dispatch events.\n *\n * @see {EventPluginHub}\n */\nvar EventPluginRegistry = {\n\n /**\n * Ordered list of injected plugins.\n */\n plugins: [],\n\n /**\n * Mapping from registration names to plugin modules.\n */\n registrationNames: {},\n\n /**\n * The keys of `registrationNames`.\n */\n registrationNamesKeys: [],\n\n /**\n * Injects an ordering of plugins (by plugin name). This allows the ordering\n * to be decoupled from injection of the actual plugins so that ordering is\n * always deterministic regardless of packaging, on-the-fly injection, etc.\n *\n * @param {array} InjectedEventPluginOrder\n * @internal\n * @see {EventPluginHub.injection.injectEventPluginOrder}\n */\n injectEventPluginOrder: function(InjectedEventPluginOrder) {\n invariant(\n !EventPluginOrder,\n 'EventPluginRegistry: Cannot inject event plugin ordering more than once.'\n );\n // Clone the ordering so it cannot be dynamically mutated.\n EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);\n recomputePluginOrdering();\n },\n\n /**\n * Injects plugins to be used by `EventPluginHub`. The plugin names must be\n * in the ordering injected by `injectEventPluginOrder`.\n *\n * Plugins can be injected as part of page initialization or on-the-fly.\n *\n * @param {object} injectedNamesToPlugins Map from names to plugin modules.\n * @internal\n * @see {EventPluginHub.injection.injectEventPluginsByName}\n */\n injectEventPluginsByName: function(injectedNamesToPlugins) {\n var isOrderingDirty = false;\n for (var pluginName in injectedNamesToPlugins) {\n if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {\n continue;\n }\n var PluginModule = injectedNamesToPlugins[pluginName];\n if (namesToPlugins[pluginName] !== PluginModule) {\n invariant(\n !namesToPlugins[pluginName],\n 'EventPluginRegistry: Cannot inject two different event plugins ' +\n 'using the same name, `%s`.',\n pluginName\n );\n namesToPlugins[pluginName] = PluginModule;\n isOrderingDirty = true;\n }\n }\n if (isOrderingDirty) {\n recomputePluginOrdering();\n }\n },\n\n /**\n * Looks up the plugin for the supplied event.\n *\n * @param {object} event A synthetic event.\n * @return {?object} The plugin that created the supplied event.\n * @internal\n */\n getPluginModuleForEvent: function(event) {\n var dispatchConfig = event.dispatchConfig;\n if (dispatchConfig.registrationName) {\n return EventPluginRegistry.registrationNames[\n dispatchConfig.registrationName\n ] || null;\n }\n for (var phase in dispatchConfig.phasedRegistrationNames) {\n if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {\n continue;\n }\n var PluginModule = EventPluginRegistry.registrationNames[\n dispatchConfig.phasedRegistrationNames[phase]\n ];\n if (PluginModule) {\n return PluginModule;\n }\n }\n return null;\n },\n\n /**\n * Exposed for unit testing.\n * @private\n */\n _resetEventPlugins: function() {\n EventPluginOrder = null;\n for (var pluginName in namesToPlugins) {\n if (namesToPlugins.hasOwnProperty(pluginName)) {\n delete namesToPlugins[pluginName];\n }\n }\n EventPluginRegistry.plugins.length = 0;\n var registrationNames = EventPluginRegistry.registrationNames;\n for (var registrationName in registrationNames) {\n if (registrationNames.hasOwnProperty(registrationName)) {\n delete registrationNames[registrationName];\n }\n }\n EventPluginRegistry.registrationNamesKeys.length = 0;\n }\n\n};\n\nmodule.exports = EventPluginRegistry;\n\nrequire(\"./mock-modules\").register(\"EventPluginRegistry\", module);\n",
"SyntheticEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar PooledClass = require(\"./PooledClass\");\n\nvar emptyFunction = require(\"./emptyFunction\");\nvar getEventTarget = require(\"./getEventTarget\");\nvar merge = require(\"./merge\");\nvar mergeInto = require(\"./mergeInto\");\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar EventInterface = {\n type: null,\n target: getEventTarget,\n currentTarget: null,\n eventPhase: null,\n bubbles: null,\n cancelable: null,\n timeStamp: function(event) {\n return event.timeStamp || Date.now();\n },\n defaultPrevented: null,\n isTrusted: null\n};\n\n/**\n * Synthetic events are dispatched by event plugins, typically in response to a\n * top-level event delegation handler.\n *\n * These systems should generally use pooling to reduce the frequency of garbage\n * collection. The system should check `isPersistent` to determine whether the\n * event should be released into the pool after being dispatched. Users that\n * need a persisted event should invoke `persist`.\n *\n * Synthetic events (and subclasses) implement the DOM Level 3 Events API by\n * normalizing browser quirks. Subclasses do not necessarily have to implement a\n * DOM interface; custom application-specific events can also subclass this.\n *\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n */\nfunction SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n this.dispatchConfig = dispatchConfig;\n this.dispatchMarker = dispatchMarker;\n this.nativeEvent = nativeEvent;\n\n var Interface = this.constructor.Interface;\n for (var propName in Interface) {\n if (!Interface.hasOwnProperty(propName)) {\n continue;\n }\n var normalize = Interface[propName];\n if (normalize) {\n this[propName] = normalize(nativeEvent);\n } else {\n this[propName] = nativeEvent[propName];\n }\n }\n\n if (nativeEvent.defaultPrevented || nativeEvent.returnValue === false) {\n this.isDefaultPrevented = emptyFunction.thatReturnsTrue;\n } else {\n this.isDefaultPrevented = emptyFunction.thatReturnsFalse;\n }\n this.isPropagationStopped = emptyFunction.thatReturnsFalse;\n}\n\nmergeInto(SyntheticEvent.prototype, {\n\n preventDefault: function() {\n this.defaultPrevented = true;\n var event = this.nativeEvent;\n event.preventDefault ? event.preventDefault() : event.returnValue = false;\n this.isDefaultPrevented = emptyFunction.thatReturnsTrue;\n },\n\n stopPropagation: function() {\n var event = this.nativeEvent;\n event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true;\n this.isPropagationStopped = emptyFunction.thatReturnsTrue;\n },\n\n /**\n * We release all dispatched `SyntheticEvent`s after each event loop, adding\n * them back into the pool. This allows a way to hold onto a reference that\n * won't be added back into the pool.\n */\n persist: function() {\n this.isPersistent = emptyFunction.thatReturnsTrue;\n },\n\n /**\n * Checks if this event should be released back into the pool.\n *\n * @return {boolean} True if this should not be released, false otherwise.\n */\n isPersistent: emptyFunction.thatReturnsFalse,\n\n /**\n * `PooledClass` looks for `destructor` on each instance it releases.\n */\n destructor: function() {\n var Interface = this.constructor.Interface;\n for (var propName in Interface) {\n this[propName] = null;\n }\n this.dispatchConfig = null;\n this.dispatchMarker = null;\n this.nativeEvent = null;\n }\n\n});\n\nSyntheticEvent.Interface = EventInterface;\n\n/**\n * Helper to reduce boilerplate when creating subclasses.\n *\n * @param {function} Class\n * @param {?object} Interface\n */\nSyntheticEvent.augmentClass = function(Class, Interface) {\n var Super = this;\n\n var prototype = Object.create(Super.prototype);\n mergeInto(prototype, Class.prototype);\n Class.prototype = prototype;\n Class.prototype.constructor = Class;\n\n Class.Interface = merge(Super.Interface, Interface);\n Class.augmentClass = Super.augmentClass;\n\n PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);\n};\n\nPooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);\n\nmodule.exports = SyntheticEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticEvent\", module);\n",
"SyntheticWheelEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticWheelEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticMouseEvent = require(\"./SyntheticMouseEvent\");\n\n/**\n * @interface WheelEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar WheelEventInterface = {\n deltaX: function(event) {\n // NOTE: IE<9 does not support x-axis delta.\n return (\n 'deltaX' in event ? event.deltaX :\n // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).\n 'wheelDeltaX' in event ? -event.wheelDeltaX : 0\n );\n },\n deltaY: function(event) {\n return (\n // Normalize (up is positive).\n 'deltaY' in event ? -event.deltaY :\n // Fallback to `wheelDeltaY` for Webkit.\n 'wheelDeltaY' in event ? event.wheelDeltaY :\n // Fallback to `wheelDelta` for IE<9.\n 'wheelDelta' in event ? event.wheelData : 0\n );\n },\n deltaZ: null,\n deltaMode: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticMouseEvent}\n */\nfunction SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);\n\nmodule.exports = SyntheticWheelEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticWheelEvent\", module);\n",
"AnalyticsEventPluginFactory":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule AnalyticsEventPluginFactory\n *\n * This module provides a factory method to create the AnalyticsEventPlugin that\n * can be used to track the usage of React components that are of interest to\n * the user.\n *\n * In order to enable a component for analytics tracking, you need to specify\n * two additional attributes to the component when you describe the structure of\n * your component in the render() method:\n *\n * 1. 'data-analytics-id': This represents a unique ID that the analytics module\n * will use to identify this component in all the analytics data. Note that\n * this is independent of the ref or the DOM id of the element. Over the\n * lifetime of the product, even if the component id or ref needs to be\n * changed, as long as you can ensure the analytics ID doesnt change, the\n * historical data can be correlated. Also note that React does NOT do\n * anything to guarantee or enforce uniqueness of this ID. If its not unique\n * the analytics data reported will be incorrect.\n *\n * 2. 'data-analytics-events': This is a comma separated list of DOM events that\n * you want analytics on. React currently supports tracking only on a\n * distinct set of events (See topLevelTypesToAnalyticsEvent).\n * If the list contains an event that React does not recognize for analytics\n * tracking, in __DEV__, an error will be thrown. Note that it is case\n * sensitive and space sensitive.\n *\n * By default the AnalyticsEventPlugin is NOT enabled in React. To use it, you\n * need to create the plugin using the factory method and add it to the list of\n * Plugins maintained in the EventPluginHub before your component is rendered.\n * As creation parameters you can specify two arguments:\n *\n * 1. callback: This is a required parameter. In __DEV__, an error will be\n * thrown if this param is missing. The callback will be called with the\n * analyticsData as an argument. The analyticsData will contain one property\n * per every React component, identified by its data-analytics-id. The value\n * of this property will be an object containing properties corresponding to\n * each of the comma separated events specified in data-analytics-events.\n *\n * For example, if you have:\n * <Button ...\n * data-analytics-id=\"createButton\"\n * data-analytics-events=\"click\"\n * />\n * and\n * <TextBox ...\n * data-analytics-id=\"disclaimerBox\"\n * data-analytics-events=\"focus,scroll\"\n * />\n * analyticsData will be something like:\n * '{\"createButton\":{\"click\":50}, \"disclaimerBox\":{\"focus\":15, \"scroll\":5}}'\n *\n * DO NOT mutate the data that you get in the callback. Mutating it will lead\n * to errors and unstable behavior.\n *\n * The React component will be included for analytics as long as some user\n * interaction has happened with that component. If no user interaction has\n * happened with any of the components tracked for analytics, the callback\n * will not be called.\n *\n * 2. interval (in milliseconds): This is an optional parameter to specify the\n * interval at which the callback needs to be called. It needs to be greater\n * than the 2 minutes (which is the default value if this parameter is not\n * specified or a value less than 2 minutes is specified)\n *\n * Please refer to the unit tests AnalyticsEventPlugin-test.js for details on\n * usage.\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar emptyFunction = require(\"./emptyFunction\");\nvar invariant = require(\"./invariant\");\nvar topLevelTypes = require(\"./EventConstants\").topLevelTypes;\n\nvar ANALYTICS_ID = 'data-analytics-id';\nvar ANALYTICS_EVENTS = 'data-analytics-events';\nvar DEFAULT_INTERVAL_MS = 2 * 60 * 1000; // 2 minutes\n\nvar analyticsData = {};\n\n// List of topLevel event types that React supports for analytics tracking\nvar topLevelTypesToAnalyticsEvent = {\n topClick: 'click',\n topDoubleClick: 'doubleClick',\n wheel: 'wheel',\n topTouchStart: 'touchStart',\n topTouchEnd: 'touchEnd',\n topTouchMove: 'touchMove',\n topTouchCancel: 'touchCancel',\n topKeyUp: 'keyUp',\n topKeyPress: 'keyPress',\n topKeyDown: 'keyDown',\n topFocus: 'focus',\n topBlur: 'blur',\n topScroll: 'scroll',\n topChange: 'change'\n};\n\nif (true) {\n var analyticsEventNameToTopLevelType = {\n 'click': topLevelTypes.topClick,\n 'doubleClick': topLevelTypes.topDoubleClick,\n 'wheel': topLevelTypes.wheel,\n 'touchStart': topLevelTypes.topTouchStart,\n 'touchEnd': topLevelTypes.topTouchEnd,\n 'touchMove': topLevelTypes.topTouchMove,\n 'touchCancel': topLevelTypes.topTouchCancel,\n 'keyUp': topLevelTypes.topKeyUp,\n 'keyPress': topLevelTypes.topKeyPress,\n 'keyDown': topLevelTypes.topKeyDown,\n 'focus': topLevelTypes.topFocus,\n 'blur': topLevelTypes.topBlur,\n 'scroll': topLevelTypes.topScroll,\n 'change': topLevelTypes.topChange\n };\n}\n\n/**\n * This plugin does not really extract any synthetic events. Rather it just\n * looks at the top-level event and bumps up counters as appropriate\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\nfunction extractEvents(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n var currentEvent = topLevelTypesToAnalyticsEvent[topLevelType];\n if (!currentEvent || !topLevelTarget || !topLevelTarget.attributes) {\n return null;\n }\n\n var analyticsIDAttribute = topLevelTarget.attributes[ANALYTICS_ID];\n var analyticsEventsAttribute = topLevelTarget.attributes[ANALYTICS_EVENTS];\n if(!analyticsIDAttribute || !analyticsEventsAttribute) {\n return null;\n }\n\n var analyticsEventsArr = analyticsEventsAttribute.value.split(\",\");\n var analyticsID = analyticsIDAttribute.value;\n if (!analyticsData[analyticsID]) {\n initAnalyticsDataForID(analyticsID, analyticsEventsArr);\n }\n\n if (analyticsEventsArr.indexOf(currentEvent) !== -1) {\n analyticsData[analyticsID][currentEvent]++;\n }\n\n return null;\n}\n\n/**\n * Initialize the analytics data for a specific element identified by the\n * analyticsID - Create an entry in the analyticsData object for the element and\n * initialize all counters for that element to 0.\n */\nfunction initAnalyticsDataForID(analyticsID, analyticsEventsArr) {\n analyticsData[analyticsID] = {};\n analyticsEventsArr.forEach(function(analyticsEvent) {\n if (true) {\n invariant(\n analyticsEventNameToTopLevelType[analyticsEvent],\n 'Invalid analyticsEvent:%s for analyticsID:%s',\n analyticsEvent,\n analyticsID\n );\n }\n analyticsData[analyticsID][analyticsEvent] = 0;\n });\n}\n\n/**\n * Returns the analytics event plugin given the callback that needs to be\n * invoked for reporting analytics and the interval at which the callback needs\n * to be invoked. This interval has to be atleast DEFAULT_INTERVAL_MS.\n */\nvar createAnalyticsPlugin = function(cb, interval) {\n invariant(\n ExecutionEnvironment.canUseDOM,\n 'createAnalyticsPlugin(...): The DOM is not supported in the execution ' +\n 'environment.'\n );\n\n if (true) {\n invariant(cb, 'createAnalyticsPlugin(...): You must provide a callback.');\n }\n cb = cb || emptyFunction;\n\n setInterval(\n function() {\n if (Object.keys(analyticsData).length) {\n // Invoke the callback with a clone of analyticsData, otherwise our\n // analyticsData will be dirtied by user changes\n cb(analyticsData);\n }\n },\n interval > DEFAULT_INTERVAL_MS ? interval : DEFAULT_INTERVAL_MS\n );\n\n return {extractEvents: extractEvents};\n};\n\nvar AnalyticsEventPluginFactory = {\n createAnalyticsPlugin: createAnalyticsPlugin\n};\n\nmodule.exports = AnalyticsEventPluginFactory;\n\nrequire(\"./mock-modules\").register(\"AnalyticsEventPluginFactory\", module);\n",
"DefaultEventPluginOrder":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule DefaultEventPluginOrder\n */\n\n\"use strict\";\n\n var keyOf = require(\"./keyOf\");\n\n/**\n * Module that is injectable into `EventPluginHub`, that specifies a\n * deterministic ordering of `EventPlugin`s. A convenient way to reason about\n * plugins, without having to package every one of them. This is better than\n * having plugins be ordered in the same order that they are injected because\n * that ordering would be influenced by the packaging order.\n * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that\n * preventing default on events is convenient in `SimpleEventPlugin` handlers.\n */\nvar DefaultEventPluginOrder = [\n keyOf({ResponderEventPlugin: null}),\n keyOf({SimpleEventPlugin: null}),\n keyOf({TapEventPlugin: null}),\n keyOf({EnterLeaveEventPlugin: null}),\n keyOf({ChangeEventPlugin: null}),\n keyOf({SelectEventPlugin: null}),\n keyOf({CompositionEventPlugin: null}),\n keyOf({AnalyticsEventPlugin: null}),\n keyOf({MobileSafariClickEventPlugin: null})\n];\n\nmodule.exports = DefaultEventPluginOrder;\n\nrequire(\"./mock-modules\").register(\"DefaultEventPluginOrder\", module);\n",
"EnterLeaveEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EnterLeaveEventPlugin\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar SyntheticMouseEvent = require(\"./SyntheticMouseEvent\");\n\nvar ReactMount = require(\"./ReactMount\");\nvar keyOf = require(\"./keyOf\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\nvar getFirstReactDOM = ReactMount.getFirstReactDOM;\n\nvar eventTypes = {\n mouseEnter: {registrationName: keyOf({onMouseEnter: null})},\n mouseLeave: {registrationName: keyOf({onMouseLeave: null})}\n};\n\nvar extractedEvents = [null, null];\n\nvar EnterLeaveEventPlugin = {\n\n eventTypes: eventTypes,\n\n /**\n * For almost every interaction we care about, there will be both a top-level\n * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that\n * we do not extract duplicate events. However, moving the mouse into the\n * browser from outside will not fire a `mouseout` event. In this case, we use\n * the `mouseover` top-level event.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n if (topLevelType === topLevelTypes.topMouseOver &&\n (nativeEvent.relatedTarget || nativeEvent.fromElement)) {\n return null;\n }\n if (topLevelType !== topLevelTypes.topMouseOut &&\n topLevelType !== topLevelTypes.topMouseOver) {\n // Must not be a mouse in or mouse out - ignoring.\n return null;\n }\n\n var from, to;\n if (topLevelType === topLevelTypes.topMouseOut) {\n from = topLevelTarget;\n to =\n getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||\n window;\n } else {\n from = window;\n to = topLevelTarget;\n }\n\n if (from === to) {\n // Nothing pertains to our managed components.\n return null;\n }\n\n var fromID = from ? ReactMount.getID(from) : '';\n var toID = to ? ReactMount.getID(to) : '';\n\n var leave = SyntheticMouseEvent.getPooled(\n eventTypes.mouseLeave,\n fromID,\n nativeEvent\n );\n var enter = SyntheticMouseEvent.getPooled(\n eventTypes.mouseEnter,\n toID,\n nativeEvent\n );\n\n EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);\n\n extractedEvents[0] = leave;\n extractedEvents[1] = enter;\n\n return extractedEvents;\n }\n\n};\n\nmodule.exports = EnterLeaveEventPlugin;\n\nrequire(\"./mock-modules\").register(\"EnterLeaveEventPlugin\", module);\n",
"ChangeEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ChangeEventPlugin\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventPluginHub = require(\"./EventPluginHub\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\nvar SyntheticEvent = require(\"./SyntheticEvent\");\n\nvar isEventSupported = require(\"./isEventSupported\");\nvar isTextInputElement = require(\"./isTextInputElement\");\nvar keyOf = require(\"./keyOf\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nvar eventTypes = {\n change: {\n phasedRegistrationNames: {\n bubbled: keyOf({onChange: null}),\n captured: keyOf({onChangeCapture: null})\n }\n }\n};\n\n/**\n * For IE shims\n */\nvar activeElement = null;\nvar activeElementID = null;\nvar activeElementValue = null;\nvar activeElementValueProp = null;\n\n/**\n * SECTION: handle `change` event\n */\nfunction shouldUseChangeEvent(elem) {\n return (\n elem.nodeName === 'SELECT' ||\n (elem.nodeName === 'INPUT' && elem.type === 'file')\n );\n}\n\nvar doesChangeEventBubble = false;\nif (ExecutionEnvironment.canUseDOM) {\n // See `handleChange` comment below\n doesChangeEventBubble = isEventSupported('change') && (\n !('documentMode' in document) || document.documentMode > 8\n );\n}\n\nfunction manualDispatchChangeEvent(nativeEvent) {\n var event = SyntheticEvent.getPooled(\n eventTypes.change,\n activeElementID,\n nativeEvent\n );\n EventPropagators.accumulateTwoPhaseDispatches(event);\n\n // If change bubbled, we'd just bind to it like all the other events\n // and have it go through ReactEventTopLevelCallback. Since it doesn't, we\n // manually listen for the change event and so we have to enqueue and\n // process the abstract event manually.\n EventPluginHub.enqueueEvents(event);\n EventPluginHub.processEventQueue();\n}\n\nfunction startWatchingForChangeEventIE8(target, targetID) {\n activeElement = target;\n activeElementID = targetID;\n activeElement.attachEvent('onchange', manualDispatchChangeEvent);\n}\n\nfunction stopWatchingForChangeEventIE8() {\n if (!activeElement) {\n return;\n }\n activeElement.detachEvent('onchange', manualDispatchChangeEvent);\n activeElement = null;\n activeElementID = null;\n}\n\nfunction getTargetIDForChangeEvent(\n topLevelType,\n topLevelTarget,\n topLevelTargetID) {\n if (topLevelType === topLevelTypes.topChange) {\n return topLevelTargetID;\n }\n}\nfunction handleEventsForChangeEventIE8(\n topLevelType,\n topLevelTarget,\n topLevelTargetID) {\n if (topLevelType === topLevelTypes.topFocus) {\n // stopWatching() should be a noop here but we call it just in case we\n // missed a blur event somehow.\n stopWatchingForChangeEventIE8();\n startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);\n } else if (topLevelType === topLevelTypes.topBlur) {\n stopWatchingForChangeEventIE8();\n }\n}\n\n\n/**\n * SECTION: handle `input` event\n */\nvar isInputEventSupported = false;\nif (ExecutionEnvironment.canUseDOM) {\n // IE9 claims to support the input event but fails to trigger it when\n // deleting text, so we ignore its input events\n isInputEventSupported = isEventSupported('input') && (\n !('documentMode' in document) || document.documentMode > 9\n );\n}\n\n/**\n * (For old IE.) Replacement getter/setter for the `value` property that gets\n * set on the active element.\n */\nvar newValueProp = {\n get: function() {\n return activeElementValueProp.get.call(this);\n },\n set: function(val) {\n // Cast to a string so we can do equality checks.\n activeElementValue = '' + val;\n activeElementValueProp.set.call(this, val);\n }\n};\n\n/**\n * (For old IE.) Starts tracking propertychange events on the passed-in element\n * and override the value property so that we can distinguish user events from\n * value changes in JS.\n */\nfunction startWatchingForValueChange(target, targetID) {\n activeElement = target;\n activeElementID = targetID;\n activeElementValue = target.value;\n activeElementValueProp = Object.getOwnPropertyDescriptor(\n target.constructor.prototype,\n 'value'\n );\n\n Object.defineProperty(activeElement, 'value', newValueProp);\n activeElement.attachEvent('onpropertychange', handlePropertyChange);\n}\n\n/**\n * (For old IE.) Removes the event listeners from the currently-tracked element,\n * if any exists.\n */\nfunction stopWatchingForValueChange() {\n if (!activeElement) {\n return;\n }\n\n // delete restores the original property definition\n delete activeElement.value;\n activeElement.detachEvent('onpropertychange', handlePropertyChange);\n\n activeElement = null;\n activeElementID = null;\n activeElementValue = null;\n activeElementValueProp = null;\n}\n\n/**\n * (For old IE.) Handles a propertychange event, sending a `change` event if\n * the value of the active element has changed.\n */\nfunction handlePropertyChange(nativeEvent) {\n if (nativeEvent.propertyName !== 'value') {\n return;\n }\n var value = nativeEvent.srcElement.value;\n if (value === activeElementValue) {\n return;\n }\n activeElementValue = value;\n\n manualDispatchChangeEvent(nativeEvent);\n}\n\n/**\n * If a `change` event should be fired, returns the target's ID.\n */\nfunction getTargetIDForInputEvent(\n topLevelType,\n topLevelTarget,\n topLevelTargetID) {\n if (topLevelType === topLevelTypes.topInput) {\n // In modern browsers (i.e., not IE8 or IE9), the input event is exactly\n // what we want so fall through here and trigger an abstract event\n return topLevelTargetID;\n }\n}\n\n// For IE8 and IE9.\nfunction handleEventsForInputEventIE(\n topLevelType,\n topLevelTarget,\n topLevelTargetID) {\n if (topLevelType === topLevelTypes.topFocus) {\n // In IE8, we can capture almost all .value changes by adding a\n // propertychange handler and looking for events with propertyName\n // equal to 'value'\n // In IE9, propertychange fires for most input events but is buggy and\n // doesn't fire when text is deleted, but conveniently, selectionchange\n // appears to fire in all of the remaining cases so we catch those and\n // forward the event if the value has changed\n // In either case, we don't want to call the event handler if the value\n // is changed from JS so we redefine a setter for `.value` that updates\n // our activeElementValue variable, allowing us to ignore those changes\n //\n // stopWatching() should be a noop here but we call it just in case we\n // missed a blur event somehow.\n stopWatchingForValueChange();\n startWatchingForValueChange(topLevelTarget, topLevelTargetID);\n } else if (topLevelType === topLevelTypes.topBlur) {\n stopWatchingForValueChange();\n }\n}\n\n// For IE8 and IE9.\nfunction getTargetIDForInputEventIE(\n topLevelType,\n topLevelTarget,\n topLevelTargetID) {\n if (topLevelType === topLevelTypes.topSelectionChange ||\n topLevelType === topLevelTypes.topKeyUp ||\n topLevelType === topLevelTypes.topKeyDown) {\n // On the selectionchange event, the target is just document which isn't\n // helpful for us so just check activeElement instead.\n //\n // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire\n // propertychange on the first input event after setting `value` from a\n // script and fires only keydown, keypress, keyup. Catching keyup usually\n // gets it and catching keydown lets us fire an event for the first\n // keystroke if user does a key repeat (it'll be a little delayed: right\n // before the second keystroke). Other input methods (e.g., paste) seem to\n // fire selectionchange normally.\n if (activeElement && activeElement.value !== activeElementValue) {\n activeElementValue = activeElement.value;\n return activeElementID;\n }\n }\n}\n\n\n/**\n * SECTION: handle `click` event\n */\nfunction shouldUseClickEvent(elem) {\n // Use the `click` event to detect changes to checkbox and radio inputs.\n // This approach works across all browsers, whereas `change` does not fire\n // until `blur` in IE8.\n return (\n elem.nodeName === 'INPUT' &&\n (elem.type === 'checkbox' || elem.type === 'radio')\n );\n}\n\nfunction getTargetIDForClickEvent(\n topLevelType,\n topLevelTarget,\n topLevelTargetID) {\n if (topLevelType === topLevelTypes.topClick) {\n return topLevelTargetID;\n }\n}\n\n/**\n * This plugin creates an `onChange` event that normalizes change events\n * across form elements. This event fires at a time when it's possible to\n * change the element's value without seeing a flicker.\n *\n * Supported elements are:\n * - input (see `isTextInputElement`)\n * - textarea\n * - select\n */\nvar ChangeEventPlugin = {\n\n eventTypes: eventTypes,\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n\n var getTargetIDFunc, handleEventFunc;\n if (shouldUseChangeEvent(topLevelTarget)) {\n if (doesChangeEventBubble) {\n getTargetIDFunc = getTargetIDForChangeEvent;\n } else {\n handleEventFunc = handleEventsForChangeEventIE8;\n }\n } else if (isTextInputElement(topLevelTarget)) {\n if (isInputEventSupported) {\n getTargetIDFunc = getTargetIDForInputEvent;\n } else {\n getTargetIDFunc = getTargetIDForInputEventIE;\n handleEventFunc = handleEventsForInputEventIE;\n }\n } else if (shouldUseClickEvent(topLevelTarget)) {\n getTargetIDFunc = getTargetIDForClickEvent;\n }\n\n if (getTargetIDFunc) {\n var targetID = getTargetIDFunc(\n topLevelType,\n topLevelTarget,\n topLevelTargetID\n );\n if (targetID) {\n var event = SyntheticEvent.getPooled(\n eventTypes.change,\n targetID,\n nativeEvent\n );\n EventPropagators.accumulateTwoPhaseDispatches(event);\n return event;\n }\n }\n\n if (handleEventFunc) {\n handleEventFunc(\n topLevelType,\n topLevelTarget,\n topLevelTargetID\n );\n }\n }\n\n};\n\nmodule.exports = ChangeEventPlugin;\n\nrequire(\"./mock-modules\").register(\"ChangeEventPlugin\", module);\n",
"SimpleEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SimpleEventPlugin\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar SyntheticClipboardEvent = require(\"./SyntheticClipboardEvent\");\nvar SyntheticEvent = require(\"./SyntheticEvent\");\nvar SyntheticFocusEvent = require(\"./SyntheticFocusEvent\");\nvar SyntheticKeyboardEvent = require(\"./SyntheticKeyboardEvent\");\nvar SyntheticMouseEvent = require(\"./SyntheticMouseEvent\");\nvar SyntheticTouchEvent = require(\"./SyntheticTouchEvent\");\nvar SyntheticUIEvent = require(\"./SyntheticUIEvent\");\nvar SyntheticWheelEvent = require(\"./SyntheticWheelEvent\");\n\nvar invariant = require(\"./invariant\");\nvar keyOf = require(\"./keyOf\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nvar eventTypes = {\n blur: {\n phasedRegistrationNames: {\n bubbled: keyOf({onBlur: true}),\n captured: keyOf({onBlurCapture: true})\n }\n },\n click: {\n phasedRegistrationNames: {\n bubbled: keyOf({onClick: true}),\n captured: keyOf({onClickCapture: true})\n }\n },\n copy: {\n phasedRegistrationNames: {\n bubbled: keyOf({onCopy: true}),\n captured: keyOf({onCopyCapture: true})\n }\n },\n cut: {\n phasedRegistrationNames: {\n bubbled: keyOf({onCut: true}),\n captured: keyOf({onCutCapture: true})\n }\n },\n doubleClick: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDoubleClick: true}),\n captured: keyOf({onDoubleClickCapture: true})\n }\n },\n drag: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDrag: true}),\n captured: keyOf({onDragCapture: true})\n }\n },\n dragEnd: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDragEnd: true}),\n captured: keyOf({onDragEndCapture: true})\n }\n },\n dragEnter: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDragEnter: true}),\n captured: keyOf({onDragEnterCapture: true})\n }\n },\n dragExit: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDragExit: true}),\n captured: keyOf({onDragExitCapture: true})\n }\n },\n dragLeave: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDragLeave: true}),\n captured: keyOf({onDragLeaveCapture: true})\n }\n },\n dragOver: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDragOver: true}),\n captured: keyOf({onDragOverCapture: true})\n }\n },\n dragStart: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDragStart: true}),\n captured: keyOf({onDragStartCapture: true})\n }\n },\n drop: {\n phasedRegistrationNames: {\n bubbled: keyOf({onDrop: true}),\n captured: keyOf({onDropCapture: true})\n }\n },\n focus: {\n phasedRegistrationNames: {\n bubbled: keyOf({onFocus: true}),\n captured: keyOf({onFocusCapture: true})\n }\n },\n input: {\n phasedRegistrationNames: {\n bubbled: keyOf({onInput: true}),\n captured: keyOf({onInputCapture: true})\n }\n },\n keyDown: {\n phasedRegistrationNames: {\n bubbled: keyOf({onKeyDown: true}),\n captured: keyOf({onKeyDownCapture: true})\n }\n },\n keyPress: {\n phasedRegistrationNames: {\n bubbled: keyOf({onKeyPress: true}),\n captured: keyOf({onKeyPressCapture: true})\n }\n },\n keyUp: {\n phasedRegistrationNames: {\n bubbled: keyOf({onKeyUp: true}),\n captured: keyOf({onKeyUpCapture: true})\n }\n },\n // Note: We do not allow listening to mouseOver events. Instead, use the\n // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.\n mouseDown: {\n phasedRegistrationNames: {\n bubbled: keyOf({onMouseDown: true}),\n captured: keyOf({onMouseDownCapture: true})\n }\n },\n mouseMove: {\n phasedRegistrationNames: {\n bubbled: keyOf({onMouseMove: true}),\n captured: keyOf({onMouseMoveCapture: true})\n }\n },\n mouseUp: {\n phasedRegistrationNames: {\n bubbled: keyOf({onMouseUp: true}),\n captured: keyOf({onMouseUpCapture: true})\n }\n },\n paste: {\n phasedRegistrationNames: {\n bubbled: keyOf({onPaste: true}),\n captured: keyOf({onPasteCapture: true})\n }\n },\n scroll: {\n phasedRegistrationNames: {\n bubbled: keyOf({onScroll: true}),\n captured: keyOf({onScrollCapture: true})\n }\n },\n submit: {\n phasedRegistrationNames: {\n bubbled: keyOf({onSubmit: true}),\n captured: keyOf({onSubmitCapture: true})\n }\n },\n touchCancel: {\n phasedRegistrationNames: {\n bubbled: keyOf({onTouchCancel: true}),\n captured: keyOf({onTouchCancelCapture: true})\n }\n },\n touchEnd: {\n phasedRegistrationNames: {\n bubbled: keyOf({onTouchEnd: true}),\n captured: keyOf({onTouchEndCapture: true})\n }\n },\n touchMove: {\n phasedRegistrationNames: {\n bubbled: keyOf({onTouchMove: true}),\n captured: keyOf({onTouchMoveCapture: true})\n }\n },\n touchStart: {\n phasedRegistrationNames: {\n bubbled: keyOf({onTouchStart: true}),\n captured: keyOf({onTouchStartCapture: true})\n }\n },\n wheel: {\n phasedRegistrationNames: {\n bubbled: keyOf({onWheel: true}),\n captured: keyOf({onWheelCapture: true})\n }\n }\n};\n\nvar topLevelEventsToDispatchConfig = {\n topBlur: eventTypes.blur,\n topClick: eventTypes.click,\n topCopy: eventTypes.copy,\n topCut: eventTypes.cut,\n topDoubleClick: eventTypes.doubleClick,\n topDrag: eventTypes.drag,\n topDragEnd: eventTypes.dragEnd,\n topDragEnter: eventTypes.dragEnter,\n topDragExit: eventTypes.dragExit,\n topDragLeave: eventTypes.dragLeave,\n topDragOver: eventTypes.dragOver,\n topDragStart: eventTypes.dragStart,\n topDrop: eventTypes.drop,\n topFocus: eventTypes.focus,\n topInput: eventTypes.input,\n topKeyDown: eventTypes.keyDown,\n topKeyPress: eventTypes.keyPress,\n topKeyUp: eventTypes.keyUp,\n topMouseDown: eventTypes.mouseDown,\n topMouseMove: eventTypes.mouseMove,\n topMouseUp: eventTypes.mouseUp,\n topPaste: eventTypes.paste,\n topScroll: eventTypes.scroll,\n topSubmit: eventTypes.submit,\n topTouchCancel: eventTypes.touchCancel,\n topTouchEnd: eventTypes.touchEnd,\n topTouchMove: eventTypes.touchMove,\n topTouchStart: eventTypes.touchStart,\n topWheel: eventTypes.wheel\n};\n\nvar SimpleEventPlugin = {\n\n eventTypes: eventTypes,\n\n /**\n * Same as the default implementation, except cancels the event when return\n * value is false.\n *\n * @param {object} Event to be dispatched.\n * @param {function} Application-level callback.\n * @param {string} domID DOM ID to pass to the callback.\n */\n executeDispatch: function(event, listener, domID) {\n var returnValue = listener(event, domID);\n if (returnValue === false) {\n event.stopPropagation();\n event.preventDefault();\n }\n },\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];\n if (!dispatchConfig) {\n return null;\n }\n var EventConstructor;\n switch(topLevelType) {\n case topLevelTypes.topInput:\n case topLevelTypes.topSubmit:\n // HTML Events\n // @see http://www.w3.org/TR/html5/index.html#events-0\n EventConstructor = SyntheticEvent;\n break;\n case topLevelTypes.topKeyDown:\n case topLevelTypes.topKeyPress:\n case topLevelTypes.topKeyUp:\n EventConstructor = SyntheticKeyboardEvent;\n break;\n case topLevelTypes.topBlur:\n case topLevelTypes.topFocus:\n EventConstructor = SyntheticFocusEvent;\n break;\n case topLevelTypes.topClick:\n // Firefox creates a click event on right mouse clicks. This removes the\n // unwanted click events.\n if (nativeEvent.button === 2) {\n return null;\n }\n /* falls through */\n case topLevelTypes.topDoubleClick:\n case topLevelTypes.topDrag:\n case topLevelTypes.topDragEnd:\n case topLevelTypes.topDragEnter:\n case topLevelTypes.topDragExit:\n case topLevelTypes.topDragLeave:\n case topLevelTypes.topDragOver:\n case topLevelTypes.topDragStart:\n case topLevelTypes.topDrop:\n case topLevelTypes.topMouseDown:\n case topLevelTypes.topMouseMove:\n case topLevelTypes.topMouseUp:\n EventConstructor = SyntheticMouseEvent;\n break;\n case topLevelTypes.topTouchCancel:\n case topLevelTypes.topTouchEnd:\n case topLevelTypes.topTouchMove:\n case topLevelTypes.topTouchStart:\n EventConstructor = SyntheticTouchEvent;\n break;\n case topLevelTypes.topScroll:\n EventConstructor = SyntheticUIEvent;\n break;\n case topLevelTypes.topWheel:\n EventConstructor = SyntheticWheelEvent;\n break;\n case topLevelTypes.topCopy:\n case topLevelTypes.topCut:\n case topLevelTypes.topPaste:\n EventConstructor = SyntheticClipboardEvent;\n break;\n }\n invariant(\n EventConstructor,\n 'SimpleEventPlugin: Unhandled event type, `%s`.',\n topLevelType\n );\n var event = EventConstructor.getPooled(\n dispatchConfig,\n topLevelTargetID,\n nativeEvent\n );\n EventPropagators.accumulateTwoPhaseDispatches(event);\n return event;\n }\n\n};\n\nmodule.exports = SimpleEventPlugin;\n\nrequire(\"./mock-modules\").register(\"SimpleEventPlugin\", module);\n",
"CallbackRegistry":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule CallbackRegistry\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar listenerBank = {};\n\n/**\n * Stores \"listeners\" by `registrationName`/`id`. There should be at most one\n * \"listener\" per `registrationName`/`id` in the `listenerBank`.\n *\n * Access listeners via `listenerBank[registrationName][id]`.\n *\n * @class CallbackRegistry\n * @internal\n */\nvar CallbackRegistry = {\n\n /**\n * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.\n *\n * @param {string} id ID of the DOM element.\n * @param {string} registrationName Name of listener (e.g. `onClick`).\n * @param {?function} listener The callback to store.\n */\n putListener: function(id, registrationName, listener) {\n var bankForRegistrationName =\n listenerBank[registrationName] || (listenerBank[registrationName] = {});\n bankForRegistrationName[id] = listener;\n },\n\n /**\n * @param {string} id ID of the DOM element.\n * @param {string} registrationName Name of listener (e.g. `onClick`).\n * @return {?function} The stored callback.\n */\n getListener: function(id, registrationName) {\n var bankForRegistrationName = listenerBank[registrationName];\n return bankForRegistrationName && bankForRegistrationName[id];\n },\n\n /**\n * Deletes a listener from the registration bank.\n *\n * @param {string} id ID of the DOM element.\n * @param {string} registrationName Name of listener (e.g. `onClick`).\n */\n deleteListener: function(id, registrationName) {\n var bankForRegistrationName = listenerBank[registrationName];\n if (bankForRegistrationName) {\n delete bankForRegistrationName[id];\n }\n },\n\n /**\n * Deletes all listeners for the DOM element with the supplied ID.\n *\n * @param {string} id ID of the DOM element.\n */\n deleteAllListeners: function(id) {\n for (var registrationName in listenerBank) {\n delete listenerBank[registrationName][id];\n }\n },\n\n /**\n * This is needed for tests only. Do not use!\n */\n __purge: function() {\n listenerBank = {};\n }\n\n};\n\nmodule.exports = CallbackRegistry;\n\nrequire(\"./mock-modules\").register(\"CallbackRegistry\", module);\n",
"EventConstants":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventConstants\n */\n\n\"use strict\";\n\nvar keyMirror = require(\"./keyMirror\");\n\nvar PropagationPhases = keyMirror({bubbled: null, captured: null});\n\n/**\n * Types of raw signals from the browser caught at the top level.\n */\nvar topLevelTypes = keyMirror({\n topBlur: null,\n topChange: null,\n topClick: null,\n topCompositionEnd: null,\n topCompositionStart: null,\n topCompositionUpdate: null,\n topCopy: null,\n topCut: null,\n topDoubleClick: null,\n topDrag: null,\n topDragEnd: null,\n topDragEnter: null,\n topDragExit: null,\n topDragLeave: null,\n topDragOver: null,\n topDragStart: null,\n topDrop: null,\n topFocus: null,\n topInput: null,\n topKeyDown: null,\n topKeyPress: null,\n topKeyUp: null,\n topMouseDown: null,\n topMouseMove: null,\n topMouseOut: null,\n topMouseOver: null,\n topMouseUp: null,\n topPaste: null,\n topScroll: null,\n topSelectionChange: null,\n topSubmit: null,\n topTouchCancel: null,\n topTouchEnd: null,\n topTouchMove: null,\n topTouchStart: null,\n topWheel: null\n});\n\nvar EventConstants = {\n topLevelTypes: topLevelTypes,\n PropagationPhases: PropagationPhases\n};\n\nmodule.exports = EventConstants;\n\nrequire(\"./mock-modules\").register(\"EventConstants\", module);\n",
"EventPropagators":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventPropagators\n */\n\n\"use strict\";\n\nvar CallbackRegistry = require(\"./CallbackRegistry\");\nvar EventConstants = require(\"./EventConstants\");\n\nvar accumulate = require(\"./accumulate\");\nvar forEachAccumulated = require(\"./forEachAccumulated\");\nvar getListener = CallbackRegistry.getListener;\nvar PropagationPhases = EventConstants.PropagationPhases;\n\n/**\n * Injected dependencies:\n */\n\n/**\n * - `InstanceHandle`: [required] Module that performs logical traversals of DOM\n * hierarchy given ids of the logical DOM elements involved.\n */\nvar injection = {\n InstanceHandle: null,\n injectInstanceHandle: function(InjectedInstanceHandle) {\n injection.InstanceHandle = InjectedInstanceHandle;\n if (true) {\n injection.validate();\n }\n },\n validate: function() {\n var invalid = !injection.InstanceHandle||\n !injection.InstanceHandle.traverseTwoPhase ||\n !injection.InstanceHandle.traverseEnterLeave;\n if (invalid) {\n throw new Error('InstanceHandle not injected before use!');\n }\n }\n};\n\n/**\n * Some event types have a notion of different registration names for different\n * \"phases\" of propagation. This finds listeners by a given phase.\n */\nfunction listenerAtPhase(id, event, propagationPhase) {\n var registrationName =\n event.dispatchConfig.phasedRegistrationNames[propagationPhase];\n return getListener(id, registrationName);\n}\n\n/**\n * Tags a `SyntheticEvent` with dispatched listeners. Creating this function\n * here, allows us to not have to bind or create functions for each event.\n * Mutating the event's members allows us to not have to create a wrapping\n * \"dispatch\" object that pairs the event with the listener.\n */\nfunction accumulateDirectionalDispatches(domID, upwards, event) {\n if (true) {\n if (!domID) {\n throw new Error('Dispatching id must not be null');\n }\n injection.validate();\n }\n var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;\n var listener = listenerAtPhase(domID, event, phase);\n if (listener) {\n event._dispatchListeners = accumulate(event._dispatchListeners, listener);\n event._dispatchIDs = accumulate(event._dispatchIDs, domID);\n }\n}\n\n/**\n * Collect dispatches (must be entirely collected before dispatching - see unit\n * tests). Lazily allocate the array to conserve memory. We must loop through\n * each event and perform the traversal for each one. We can not perform a\n * single traversal for the entire collection of events because each event may\n * have a different target.\n */\nfunction accumulateTwoPhaseDispatchesSingle(event) {\n if (event && event.dispatchConfig.phasedRegistrationNames) {\n injection.InstanceHandle.traverseTwoPhase(\n event.dispatchMarker,\n accumulateDirectionalDispatches,\n event\n );\n }\n}\n\n\n/**\n * Accumulates without regard to direction, does not look for phased\n * registration names. Same as `accumulateDirectDispatchesSingle` but without\n * requiring that the `dispatchMarker` be the same as the dispatched ID.\n */\nfunction accumulateDispatches(id, ignoredDirection, event) {\n if (event && event.dispatchConfig.registrationName) {\n var registrationName = event.dispatchConfig.registrationName;\n var listener = getListener(id, registrationName);\n if (listener) {\n event._dispatchListeners = accumulate(event._dispatchListeners, listener);\n event._dispatchIDs = accumulate(event._dispatchIDs, id);\n }\n }\n}\n\n/**\n * Accumulates dispatches on an `SyntheticEvent`, but only for the\n * `dispatchMarker`.\n * @param {SyntheticEvent} event\n */\nfunction accumulateDirectDispatchesSingle(event) {\n if (event && event.dispatchConfig.registrationName) {\n accumulateDispatches(event.dispatchMarker, null, event);\n }\n}\n\nfunction accumulateTwoPhaseDispatches(events) {\n if (true) {\n injection.validate();\n }\n forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);\n}\n\nfunction accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {\n if (true) {\n injection.validate();\n }\n injection.InstanceHandle.traverseEnterLeave(\n fromID,\n toID,\n accumulateDispatches,\n leave,\n enter\n );\n}\n\n\nfunction accumulateDirectDispatches(events) {\n if (true) {\n injection.validate();\n }\n forEachAccumulated(events, accumulateDirectDispatchesSingle);\n}\n\n\n\n/**\n * A small set of propagation patterns, each of which will accept a small amount\n * of information, and generate a set of \"dispatch ready event objects\" - which\n * are sets of events that have already been annotated with a set of dispatched\n * listener functions/ids. The API is designed this way to discourage these\n * propagation strategies from actually executing the dispatches, since we\n * always want to collect the entire set of dispatches before executing event a\n * single one.\n *\n * @constructor EventPropagators\n */\nvar EventPropagators = {\n accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,\n accumulateDirectDispatches: accumulateDirectDispatches,\n accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches,\n injection: injection\n};\n\nmodule.exports = EventPropagators;\n\nrequire(\"./mock-modules\").register(\"EventPropagators\", module);\n",
"ResponderEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ResponderEventPlugin\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventPluginUtils = require(\"./EventPluginUtils\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar SyntheticEvent = require(\"./SyntheticEvent\");\n\nvar accumulate = require(\"./accumulate\");\nvar keyOf = require(\"./keyOf\");\n\nvar isStartish = EventPluginUtils.isStartish;\nvar isMoveish = EventPluginUtils.isMoveish;\nvar isEndish = EventPluginUtils.isEndish;\nvar executeDirectDispatch = EventPluginUtils.executeDirectDispatch;\nvar hasDispatches = EventPluginUtils.hasDispatches;\nvar executeDispatchesInOrderStopAtTrue =\n EventPluginUtils.executeDispatchesInOrderStopAtTrue;\n\n/**\n * ID of element that should respond to touch/move types of interactions, as\n * indicated explicitly by relevant callbacks.\n */\nvar responderID = null;\nvar isPressing = false;\n\nvar eventTypes = {\n /**\n * On a `touchStart`/`mouseDown`, is it desired that this element become the\n * responder?\n */\n startShouldSetResponder: {\n phasedRegistrationNames: {\n bubbled: keyOf({onStartShouldSetResponder: null}),\n captured: keyOf({onStartShouldSetResponderCapture: null})\n }\n },\n\n /**\n * On a `scroll`, is it desired that this element become the responder? This\n * is usually not needed, but should be used to retroactively infer that a\n * `touchStart` had occured during momentum scroll. During a momentum scroll,\n * a touch start will be immediately followed by a scroll event if the view is\n * currently scrolling.\n */\n scrollShouldSetResponder: {\n phasedRegistrationNames: {\n bubbled: keyOf({onScrollShouldSetResponder: null}),\n captured: keyOf({onScrollShouldSetResponderCapture: null})\n }\n },\n\n /**\n * On a `touchMove`/`mouseMove`, is it desired that this element become the\n * responder?\n */\n moveShouldSetResponder: {\n phasedRegistrationNames: {\n bubbled: keyOf({onMoveShouldSetResponder: null}),\n captured: keyOf({onMoveShouldSetResponderCapture: null})\n }\n },\n\n /**\n * Direct responder events dispatched directly to responder. Do not bubble.\n */\n responderMove: {registrationName: keyOf({onResponderMove: null})},\n responderRelease: {registrationName: keyOf({onResponderRelease: null})},\n responderTerminationRequest: {\n registrationName: keyOf({onResponderTerminationRequest: null})\n },\n responderGrant: {registrationName: keyOf({onResponderGrant: null})},\n responderReject: {registrationName: keyOf({onResponderReject: null})},\n responderTerminate: {registrationName: keyOf({onResponderTerminate: null})}\n};\n\n/**\n * Performs negotiation between any existing/current responder, checks to see if\n * any new entity is interested in becoming responder, performs that handshake\n * and returns any events that must be emitted to notify the relevant parties.\n *\n * A note about event ordering in the `EventPluginHub`.\n *\n * Suppose plugins are injected in the following order:\n *\n * `[R, S, C]`\n *\n * To help illustrate the example, assume `S` is `SimpleEventPlugin` (for\n * `onClick` etc) and `R` is `ResponderEventPlugin`.\n *\n * \"Deferred-Dispatched Events\":\n *\n * - The current event plugin system will traverse the list of injected plugins,\n * in order, and extract events by collecting the plugin's return value of\n * `extractEvents()`.\n * - These events that are returned from `extractEvents` are \"deferred\n * dispatched events\".\n * - When returned from `extractEvents`, deferred-dispatched events contain an\n * \"accumulation\" of deferred dispatches.\n * - These deferred dispatches are accumulated/collected before they are\n * returned, but processed at a later time by the `EventPluginHub` (hence the\n * name deferred).\n *\n * In the process of returning their deferred-dispatched events, event plugins\n * themselves can dispatch events on-demand without returning them from\n * `extractEvents`. Plugins might want to do this, so that they can use event\n * dispatching as a tool that helps them decide which events should be extracted\n * in the first place.\n *\n * \"On-Demand-Dispatched Events\":\n *\n * - On-demand-dispatched events are not returned from `extractEvents`.\n * - On-demand-dispatched events are dispatched during the process of returning\n * the deferred-dispatched events.\n * - They should not have side effects.\n * - They should be avoided, and/or eventually be replaced with another\n * abstraction that allows event plugins to perform multiple \"rounds\" of event\n * extraction.\n *\n * Therefore, the sequence of event dispatches becomes:\n *\n * - `R`s on-demand events (if any) (dispatched by `R` on-demand)\n * - `S`s on-demand events (if any) (dispatched by `S` on-demand)\n * - `C`s on-demand events (if any) (dispatched by `C` on-demand)\n * - `R`s extracted events (if any) (dispatched by `EventPluginHub`)\n * - `S`s extracted events (if any) (dispatched by `EventPluginHub`)\n * - `C`s extracted events (if any) (dispatched by `EventPluginHub`)\n *\n * In the case of `ResponderEventPlugin`: If the `startShouldSetResponder`\n * on-demand dispatch returns `true` (and some other details are satisfied) the\n * `onResponderGrant` deferred dispatched event is returned from\n * `extractEvents`. The sequence of dispatch executions in this case\n * will appear as follows:\n *\n * - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand)\n * - `touchStartCapture` (`EventPluginHub` dispatches as usual)\n * - `touchStart` (`EventPluginHub` dispatches as usual)\n * - `responderGrant/Reject` (`EventPluginHub` dispatches as usual)\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {string} topLevelTargetID ID of deepest React rendered element.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n */\nfunction setResponderAndExtractTransfer(\n topLevelType,\n topLevelTargetID,\n nativeEvent) {\n var shouldSetEventType =\n isStartish(topLevelType) ? eventTypes.startShouldSetResponder :\n isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder :\n eventTypes.scrollShouldSetResponder;\n\n var bubbleShouldSetFrom = responderID || topLevelTargetID;\n var shouldSetEvent = SyntheticEvent.getPooled(\n shouldSetEventType,\n bubbleShouldSetFrom,\n nativeEvent\n );\n EventPropagators.accumulateTwoPhaseDispatches(shouldSetEvent);\n var wantsResponderID = executeDispatchesInOrderStopAtTrue(shouldSetEvent);\n if (!shouldSetEvent.isPersistent()) {\n shouldSetEvent.constructor.release(shouldSetEvent);\n }\n\n if (!wantsResponderID || wantsResponderID === responderID) {\n return null;\n }\n var extracted;\n var grantEvent = SyntheticEvent.getPooled(\n eventTypes.responderGrant,\n wantsResponderID,\n nativeEvent\n );\n\n EventPropagators.accumulateDirectDispatches(grantEvent);\n if (responderID) {\n var terminationRequestEvent = SyntheticEvent.getPooled(\n eventTypes.responderTerminationRequest,\n responderID,\n nativeEvent\n );\n EventPropagators.accumulateDirectDispatches(terminationRequestEvent);\n var shouldSwitch = !hasDispatches(terminationRequestEvent) ||\n executeDirectDispatch(terminationRequestEvent);\n if (!terminationRequestEvent.isPersistent()) {\n terminationRequestEvent.constructor.release(terminationRequestEvent);\n }\n\n if (shouldSwitch) {\n var terminateType = eventTypes.responderTerminate;\n var terminateEvent = SyntheticEvent.getPooled(\n terminateType,\n responderID,\n nativeEvent\n );\n EventPropagators.accumulateDirectDispatches(terminateEvent);\n extracted = accumulate(extracted, [grantEvent, terminateEvent]);\n responderID = wantsResponderID;\n } else {\n var rejectEvent = SyntheticEvent.getPooled(\n eventTypes.responderReject,\n wantsResponderID,\n nativeEvent\n );\n EventPropagators.accumulateDirectDispatches(rejectEvent);\n extracted = accumulate(extracted, rejectEvent);\n }\n } else {\n extracted = accumulate(extracted, grantEvent);\n responderID = wantsResponderID;\n }\n return extracted;\n}\n\n/**\n * A transfer is a negotiation between a currently set responder and the next\n * element to claim responder status. Any start event could trigger a transfer\n * of responderID. Any move event could trigger a transfer, so long as there is\n * currently a responder set (in other words as long as the user is pressing\n * down).\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @return {boolean} True if a transfer of responder could possibly occur.\n */\nfunction canTriggerTransfer(topLevelType) {\n return topLevelType === EventConstants.topLevelTypes.topScroll ||\n isStartish(topLevelType) ||\n (isPressing && isMoveish(topLevelType));\n}\n\n/**\n * Event plugin for formalizing the negotiation between claiming locks on\n * receiving touches.\n */\nvar ResponderEventPlugin = {\n\n getResponderID: function() {\n return responderID;\n },\n\n eventTypes: eventTypes,\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n var extracted;\n // Must have missed an end event - reset the state here.\n if (responderID && isStartish(topLevelType)) {\n responderID = null;\n }\n if (isStartish(topLevelType)) {\n isPressing = true;\n } else if (isEndish(topLevelType)) {\n isPressing = false;\n }\n if (canTriggerTransfer(topLevelType)) {\n var transfer = setResponderAndExtractTransfer(\n topLevelType,\n topLevelTargetID,\n nativeEvent\n );\n if (transfer) {\n extracted = accumulate(extracted, transfer);\n }\n }\n // Now that we know the responder is set correctly, we can dispatch\n // responder type events (directly to the responder).\n var type = isMoveish(topLevelType) ? eventTypes.responderMove :\n isEndish(topLevelType) ? eventTypes.responderRelease :\n isStartish(topLevelType) ? eventTypes.responderStart : null;\n if (type) {\n var gesture = SyntheticEvent.getPooled(\n type,\n responderID || '',\n nativeEvent\n );\n EventPropagators.accumulateDirectDispatches(gesture);\n extracted = accumulate(extracted, gesture);\n }\n if (type === eventTypes.responderRelease) {\n responderID = null;\n }\n return extracted;\n }\n\n};\n\nmodule.exports = ResponderEventPlugin;\n\nrequire(\"./mock-modules\").register(\"ResponderEventPlugin\", module);\n",
"ImmutableObject":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ImmutableObject\n * @typechecks\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\nvar isNode = require(\"./isNode\");\nvar merge = require(\"./merge\");\nvar mergeInto = require(\"./mergeInto\");\nvar mergeHelpers = require(\"./mergeHelpers\");\n\nvar checkMergeObjectArgs = mergeHelpers.checkMergeObjectArgs;\nvar isTerminal = mergeHelpers.isTerminal;\n\n/**\n * Wrapper around JavaScript objects that provide a guarantee of immutability at\n * developer time when strict mode is used. The extra computations required to\n * enforce immutability is stripped out in production for performance reasons.\n */\nvar ImmutableObject;\n\nfunction assertImmutableObject(immutableObject) {\n invariant(\n immutableObject instanceof ImmutableObject,\n 'ImmutableObject: Attempted to set fields on an object that is not an ' +\n 'instance of ImmutableObject.'\n );\n}\n\nif (true) {\n /**\n * Constructs an instance of `ImmutableObject`.\n *\n * @param {?object} initialProperties The initial set of properties.\n * @constructor\n */\n ImmutableObject = function ImmutableObject(initialProperties) {\n mergeInto(this, initialProperties);\n deepFreeze(this);\n };\n\n /**\n * Checks if an object should be deep frozen. Instances of `ImmutableObject`\n * are assumed to have already been deep frozen.\n *\n * @param {*} object The object to check.\n * @return {boolean} Whether or not deep freeze is needed.\n */\n var shouldRecurseFreeze = function(object) {\n return (\n typeof object === 'object' &&\n !(object instanceof ImmutableObject) &&\n object !== null\n );\n };\n\n /**\n * Freezes the supplied object deeply.\n *\n * @param {*} object The object to freeze.\n */\n var deepFreeze = function(object) {\n if (isNode(object)) {\n return; // Don't try to freeze DOM nodes.\n }\n Object.freeze(object); // First freeze the object.\n for (var prop in object) {\n var field = object[prop];\n if (object.hasOwnProperty(prop) && shouldRecurseFreeze(field)) {\n deepFreeze(field);\n }\n }\n };\n\n /**\n * Returns a new ImmutableObject that is identical to the supplied object but\n * with the supplied changes, `put`.\n *\n * @param {ImmutableObject} immutableObject Starting object.\n * @param {?object} put Fields to merge into the object.\n * @return {ImmutableObject} The result of merging in `put` fields.\n */\n ImmutableObject.set = function(immutableObject, put) {\n assertImmutableObject(immutableObject);\n var totalNewFields = merge(immutableObject, put);\n return new ImmutableObject(totalNewFields);\n };\n\n}\n\n/**\n * Sugar for `ImmutableObject.set(ImmutableObject, {fieldName: putField})`.\n *\n * @param {ImmutableObject} immutableObject Object on which to set field.\n * @param {string} fieldName Name of the field to set.\n * @param {*} putField Value of the field to set.\n * @return {ImmutableObject} [description]\n */\nImmutableObject.setField = function(immutableObject, fieldName, putField) {\n var put = {};\n put[fieldName] = putField;\n return ImmutableObject.set(immutableObject, put);\n};\n\n/**\n * Returns a new ImmutableObject that is identical to the supplied object but\n * with the supplied changes recursively applied.\n *\n * @param {ImmutableObject} immutableObject Object on which to set fields.\n * @param {object} put Fields to merge into the object.\n * @return {ImmutableObject} The result of merging in `put` fields.\n */\nImmutableObject.setDeep = function(immutableObject, put) {\n assertImmutableObject(immutableObject);\n return _setDeep(immutableObject, put);\n};\n\nfunction _setDeep(object, put) {\n checkMergeObjectArgs(object, put);\n var totalNewFields = {};\n\n // To maintain the order of the keys, copy the base object's entries first.\n var keys = Object.keys(object);\n for (var ii = 0; ii < keys.length; ii++) {\n var key = keys[ii];\n if (!put.hasOwnProperty(key)) {\n totalNewFields[key] = object[key];\n } else if (isTerminal(object[key]) || isTerminal(put[key])) {\n totalNewFields[key] = put[key];\n } else {\n totalNewFields[key] = _setDeep(object[key], put[key]);\n }\n }\n\n // Apply any new keys that the base object didn't have.\n var newKeys = Object.keys(put);\n for (ii = 0; ii < newKeys.length; ii++) {\n var newKey = newKeys[ii];\n if (object.hasOwnProperty(newKey)) {\n continue;\n }\n totalNewFields[newKey] = put[newKey];\n }\n\n return (object instanceof ImmutableObject || put instanceof ImmutableObject) ?\n new ImmutableObject(totalNewFields) :\n totalNewFields;\n}\n\nmodule.exports = ImmutableObject;\n\nrequire(\"./mock-modules\").register(\"ImmutableObject\", module);\n",
"OrderedMap":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule OrderedMap\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\nvar mixInto = require(\"./mixInto\");\n\nvar PREFIX = 'key:';\n\n/**\n * Utility to extract a backing object from an initialization `Array`, allowing\n * the caller to assist in resolving the unique ID for each entry via the\n * `keyExtractor` callback. The `keyExtractor` must extract non-empty strings or\n * numbers.\n * @param {Array<Object!>} arr Array of items.\n * @param {function} keyExtractor Extracts a unique key from each item.\n * @return {Object} Map from unique key to originating value that the key was\n * extracted from.\n * @throws Exception if the initialization array has duplicate extracted keys.\n */\nfunction extractObjectFromArray(arr, keyExtractor) {\n var normalizedObj = {};\n for (var i=0; i < arr.length; i++) {\n var item = arr[i];\n var key = keyExtractor(item);\n assertValidPublicKey(key);\n var normalizedKey = PREFIX + key;\n invariant(\n !(normalizedKey in normalizedObj),\n 'OrderedMap: IDs returned by the key extraction function must be unique.'\n );\n normalizedObj[normalizedKey] = item;\n }\n return normalizedObj;\n}\n\n/**\n * Utility class for mappings with ordering. This class is to be used in an\n * immutable manner. A `OrderedMap` is very much like the native JavaScript\n * object, where keys map to values via the `get()` function. Also, like the\n * native JavaScript object, there is an ordering associated with the mapping.\n * This class is helpful because it eliminates many of the pitfalls that come\n * with the native JavaScript ordered mappings. Specifically, there are\n * inconsistencies with numeric keys in some JavaScript implementations\n * (enumeration ordering). This class protects against those pitfalls and\n * provides functional utilities for dealing with these `OrderedMap`s.\n *\n * - TODO:\n * - orderedMergeExclusive: Merges mutually exclusive `OrderedMap`s.\n * - mapReverse().\n *\n * @class {OrderedMap}\n * @constructor {OrderedMap}\n * @param {Object} normalizedObj Object that is known to be a defensive copy of\n * caller supplied data. We require a defensive copy to guard against callers\n * mutating. It is also assumed that the keys of `normalizedObj` have been\n * normalized and do not contain any numeric-appearing strings.\n * @param {number} computedLength The precomputed length of `_normalizedObj`\n * keys.\n * @private\n */\nfunction OrderedMapImpl(normalizedObj, computedLength) {\n this._normalizedObj = normalizedObj;\n this._computedPositions = null;\n this.length = computedLength;\n}\n\n/**\n * Validates a \"public\" key - that is, one that the public facing API supplies.\n * The key is then normalized for internal storage. In order to be considered\n * valid, all keys must be non-empty, defined, non-null strings or numbers.\n *\n * @param {string?} key Validates that the key is suitable for use in a\n * `OrderedMap`.\n * @throws Error if key is not appropriate for use in `OrderedMap`.\n */\nfunction assertValidPublicKey(key) {\n invariant(\n key !== '' && (typeof key === 'string' || typeof key === 'number'),\n 'OrderedMap: Key must be non-empty, non-null string or number.'\n );\n}\n\n/**\n * Validates that arguments to range operations are within the correct limits.\n *\n * @param {number} start Start of range.\n * @param {number} length Length of range.\n * @param {number} actualLen Actual length of range that should not be\n * exceeded.\n * @return {void} description\n */\nfunction assertValidRangeIndices(start, length, actualLen) {\n invariant(\n typeof start === 'number' &&\n typeof length === 'number' &&\n length >= 0 &&\n start >= 0 &&\n start + length <= actualLen,\n 'OrderedMap: `mapRange` and `forEachRange` expect non-negative start and ' +\n 'length arguments within the bounds of the instance.'\n );\n}\n\n/**\n * Merges two \"normalized\" objects (objects who's key have been normalized) into\n * a `OrderedMap`.\n *\n * @param {Object} a Object of key value pairs.\n * @param {Object} b Object of key value pairs.\n * @return {OrderedMap} new `OrderedMap` that results in merging `a` and `b`.\n */\nfunction _fromNormalizedObjects(a, b) {\n // Second optional, both must be plain JavaScript objects.\n invariant(\n a && a.constructor === Object && (!b || b.constructor === Object),\n 'OrderedMap: Corrupted instance of OrderedMap detected.'\n );\n\n var newSet = {};\n var length = 0;\n var key;\n for (key in a) {\n if (a.hasOwnProperty(key)) {\n newSet[key] = a[key];\n length++;\n }\n }\n\n for (key in b) {\n if (b.hasOwnProperty(key)) {\n // Increment length if not already added via first object (a)\n if (!(key in newSet)) {\n length++;\n }\n newSet[key] = b[key];\n }\n }\n return new OrderedMapImpl(newSet, length);\n}\n\n/**\n * Methods for `OrderedMap` instances.\n *\n * @lends OrderedMap.prototype\n * TODO: Make this data structure lazy, unify with LazyArray.\n * TODO: Unify this with ImmutableObject - it is to be used immutably.\n * TODO: If so, consider providing `fromObject` API.\n * TODO: Create faster implementation of merging/mapping from original Array,\n * without having to first create an object - simply for the sake of merging.\n */\nvar OrderedMapMethods = {\n\n /**\n * Returns whether or not a given key is present in the map.\n *\n * @param {string} key Valid string key to lookup membership for.\n * @return {boolean} Whether or not `key` is a member of the map.\n * @throws Error if provided known invalid key.\n */\n has: function(key) {\n assertValidPublicKey(key);\n var normalizedKey = PREFIX + key;\n return normalizedKey in this._normalizedObj;\n },\n\n /**\n * Returns the object for a given key, or `undefined` if not present. To\n * distinguish a undefined entry vs not being in the set, use `has()`.\n *\n * @param {string} key String key to lookup the value for.\n * @return {Object?} Object at key `key`, or undefined if not in map.\n * @throws Error if provided known invalid key.\n */\n get: function(key) {\n assertValidPublicKey(key);\n var normalizedKey = PREFIX + key;\n return this.has(key) ? this._normalizedObj[normalizedKey] : undefined;\n },\n\n /**\n * Merges, appending new keys to the end of the ordering. Keys in `orderedMap`\n * that are redundant with `this`, maintain the same ordering index that they\n * had in `this`. This is how standard JavaScript object merging would work.\n * If you wish to prepend a `OrderedMap` to the beginning of another\n * `OrderedMap` then simply reverse the order of operation. This is the analog\n * to `merge(x, y)`.\n *\n * @param {OrderedMap} orderedMap OrderedMap to merge onto the end.\n * @return {OrderedMap} New OrderedMap that represents the result of the\n * merge.\n */\n merge: function(orderedMap) {\n invariant(\n orderedMap instanceof OrderedMapImpl,\n 'OrderedMap.merge(...): Expected an OrderedMap instance.'\n );\n return _fromNormalizedObjects(\n this._normalizedObj,\n orderedMap._normalizedObj\n );\n },\n\n /**\n * Functional map API. Returns a new `OrderedMap`.\n *\n * @param {Function} cb Callback to invoke for each item.\n * @param {Object?=} context Context to invoke callback from.\n * @return {OrderedMap} OrderedMap that results from mapping.\n */\n map: function(cb, context) {\n return this.mapRange(cb, 0, this.length, context);\n },\n\n /**\n * The callback `cb` is invoked with the arguments (item, key,\n * indexInOriginal).\n *\n * @param {Function} cb Determines result for each item.\n * @param {number} start Start index of map range.\n * @param {end} end End index of map range.\n * @param {*!?} context Context of callback invocation.\n * @return {OrderedMap} OrderedMap resulting from mapping the range.\n */\n mapRange: function(cb, start, length, context) {\n var thisSet = this._normalizedObj;\n var newSet = {};\n var i = 0;\n assertValidRangeIndices(start, length, this.length);\n var end = start + length - 1;\n for (var key in thisSet) {\n if (thisSet.hasOwnProperty(key)) {\n if (i >= start) {\n if (i > end) {\n break;\n }\n var item = thisSet[key];\n newSet[key] = cb.call(context, item, key.substr(PREFIX.length), i);\n }\n i++;\n }\n }\n return new OrderedMapImpl(newSet, length);\n },\n\n /**\n * Function filter API. Returns new `OrderedMap`.\n *\n * @param {Function} cb Callback to invoke for each item.\n * @param {Object?=} context Context to invoke callback from.\n * @return {OrderedMap} OrderedMap that results from filtering.\n */\n filter: function(cb, context) {\n return this.filterRange(cb, 0, this.length, context);\n },\n\n /**\n * The callback `cb` is invoked with the arguments (item, key,\n * indexInOriginal).\n *\n * @param {Function} cb Returns true if item should be in result.\n * @param {number} start Start index of filter range.\n * @param {number} end End index of map range.\n * @param {*!?} context Context of callback invocation.\n * @return {OrderedMap} OrderedMap resulting from filtering the range.\n */\n filterRange: function(cb, start, length, context) {\n var newSet = {};\n var newSetLength = 0;\n this.forEachRange(function(item, key, originalIndex) {\n if (cb.call(context, item, key, originalIndex)) {\n var normalizedKey = PREFIX + key;\n newSet[normalizedKey] = item;\n newSetLength++;\n }\n }, start, length);\n return new OrderedMapImpl(newSet, newSetLength);\n },\n\n forEach: function(cb, context) {\n this.forEachRange(cb, 0, this.length, context);\n },\n\n forEachRange: function(cb, start, length, context) {\n assertValidRangeIndices(start, length, this.length);\n var thisSet = this._normalizedObj;\n var i = 0;\n var end = start + length - 1;\n for (var key in thisSet) {\n if (thisSet.hasOwnProperty(key)) {\n if (i >= start) {\n if (i > end) {\n break;\n }\n var item = thisSet[key];\n cb.call(context, item, key.substr(PREFIX.length), i);\n }\n i++;\n }\n }\n },\n\n /**\n * Even though `mapRange`/`forEachKeyRange` allow zero length mappings, we'll\n * impose an additional restriction here that the length of mapping be greater\n * than zero - the only reason is that there are many ways to express length\n * zero in terms of two keys and that is confusing.\n */\n mapKeyRange: function(cb, startKey, endKey, context) {\n var startIndex = this.indexOfKey(startKey);\n var endIndex = this.indexOfKey(endKey);\n invariant(\n startIndex !== undefined && endIndex !== undefined,\n 'mapKeyRange must be given keys that are present.'\n );\n invariant(\n endIndex >= startIndex,\n 'OrderedMap.mapKeyRange(...): `endKey` must not come before `startIndex`.'\n );\n return this.mapRange(cb, startIndex, (endIndex - startIndex) + 1, context);\n },\n\n forEachKeyRange: function(cb, startKey, endKey, context) {\n var startIndex = this.indexOfKey(startKey);\n var endIndex = this.indexOfKey(endKey);\n invariant(\n startIndex !== undefined && endIndex !== undefined,\n 'forEachKeyRange must be given keys that are present.'\n );\n invariant(\n endIndex >= startIndex,\n 'OrderedMap.forEachKeyRange(...): `endKey` must not come before ' +\n '`startIndex`.'\n );\n this.forEachRange(cb, startIndex, (endIndex - startIndex) + 1, context);\n },\n\n /**\n * @param {number} pos Index to search for key at.\n * @return {string|undefined} Either the key at index `pos` or undefined if\n * not in map.\n */\n keyAtIndex: function(pos) {\n var computedPositions = this._getOrComputePositions();\n var keyAtPos = computedPositions.keyByIndex[pos];\n return keyAtPos ? keyAtPos.substr(PREFIX.length) : undefined;\n },\n\n /**\n * @param {string} key String key from which to find the next key.\n * @return {string|undefined} Either the next key, or undefined if there is no\n * next key.\n * @throws Error if `key` is not in this `OrderedMap`.\n */\n keyAfter: function(key) {\n return this.nthKeyAfter(key, 1);\n },\n\n /**\n * @param {string} key String key from which to find the preceding key.\n * @return {string|undefined} Either the preceding key, or undefined if there\n * is no preceding.key.\n * @throws Error if `key` is not in this `OrderedMap`.\n */\n keyBefore: function(key) {\n return this.nthKeyBefore(key, 1);\n },\n\n /**\n * @param {string} key String key from which to find a following key.\n * @param {number} n Distance to scan forward after `key`.\n * @return {string|undefined} Either the nth key after `key`, or undefined if\n * there is no next key.\n * @throws Error if `key` is not in this `OrderedMap`.\n */\n nthKeyAfter: function(key, n) {\n var curIndex = this.indexOfKey(key);\n invariant(\n curIndex !== undefined,\n 'OrderedMap.nthKeyAfter: The key `%s` does not exist in this instance.',\n key\n );\n return this.keyAtIndex(curIndex + n);\n },\n\n /**\n * @param {string} key String key from which to find a preceding key.\n * @param {number} n Distance to scan backwards before `key`.\n * @return {string|undefined} Either the nth key before `key`, or undefined if\n * there is no previous key.\n * @throws Error if `key` is not in this `OrderedMap`.\n */\n nthKeyBefore: function(key, n) {\n return this.nthKeyAfter(key, -n);\n },\n\n /**\n * @param {string} key Key to find the index of.\n * @return {number|undefined} Index of the provided key, or `undefined` if the\n * key is not found.\n */\n indexOfKey: function(key) {\n assertValidPublicKey(key);\n var normalizedKey = PREFIX + key;\n var computedPositions = this._getOrComputePositions();\n var computedPosition = computedPositions.indexByKey[normalizedKey];\n // Just writing it this way to make it clear this is intentional.\n return computedPosition === undefined ? undefined : computedPosition;\n },\n\n /**\n * @return {Array} An ordered array of this object's values.\n */\n toArray: function() {\n var result = [];\n var thisSet = this._normalizedObj;\n for (var key in thisSet) {\n if (thisSet.hasOwnProperty(key)) {\n result.push(thisSet[key]);\n }\n }\n return result;\n },\n\n /**\n * Finds the key at a given position, or indicates via `undefined` that that\n * position does not exist in the `OrderedMap`. It is appropriate to return\n * undefined, indicating that the key doesn't exist in the `OrderedMap`\n * because `undefined` is not ever a valid `OrderedMap` key.\n *\n * @private\n * @param {number} pos Position for which we're querying the name.\n * @return {string?} Name of the item at position `pos`, or `undefined` if\n * there is no item at that position.\n */\n _getOrComputePositions: function() {\n // TODO: Entertain computing this at construction time in some less\n // performance critical paths.\n var computedPositions = this._computedPositions;\n if (!computedPositions) {\n this._computePositions();\n }\n return this._computedPositions;\n },\n\n /**\n * Precomputes the index/key mapping for future lookup. Since `OrderedMap`s\n * are immutable, there is only ever a need to perform this once.\n * @private\n */\n _computePositions: function() {\n this._computedPositions = {\n keyByIndex: {},\n indexByKey: {}\n };\n var keyByIndex = this._computedPositions.keyByIndex;\n var indexByKey = this._computedPositions.indexByKey;\n var index = 0;\n var thisSet = this._normalizedObj;\n for (var key in thisSet) {\n if (thisSet.hasOwnProperty(key)) {\n keyByIndex[index] = key;\n indexByKey[key] = index;\n index++;\n }\n }\n }\n};\n\nmixInto(OrderedMapImpl, OrderedMapMethods);\n\nvar OrderedMap = {\n from: function(orderedMap) {\n invariant(\n orderedMap instanceof OrderedMapImpl,\n 'OrderedMap.from(...): Expected an OrderedMap instance.'\n );\n return _fromNormalizedObjects(orderedMap._normalizedObj, null);\n },\n\n fromArray: function(arr, keyExtractor) {\n invariant(\n Array.isArray(arr),\n 'OrderedMap.fromArray(...): First argument must be an array.'\n );\n invariant(\n typeof keyExtractor === 'function',\n 'OrderedMap.fromArray(...): Second argument must be a function used ' +\n 'to determine the unique key for each entry.'\n );\n return new OrderedMapImpl(\n extractObjectFromArray(arr, keyExtractor),\n arr.length\n );\n }\n};\n\nmodule.exports = OrderedMap;\n\nrequire(\"./mock-modules\").register(\"OrderedMap\", module);\n",
"ReactChildren":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactChildren\n */\n\n\"use strict\";\n\nvar PooledClass = require(\"./PooledClass\");\n\nvar invariant = require(\"./invariant\");\nvar traverseAllChildren = require(\"./traverseAllChildren\");\n\nvar twoArgumentPooler = PooledClass.twoArgumentPooler;\nvar threeArgumentPooler = PooledClass.threeArgumentPooler;\n\n/**\n * PooledClass representing the bookkeeping associated with performing a child\n * traversal. Allows avoiding binding callbacks.\n *\n * @constructor ForEachBookKeeping\n * @param {!function} forEachFunction Function to perform traversal with.\n * @param {?*} forEachContext Context to perform context with.\n */\nfunction ForEachBookKeeping(forEachFunction, forEachContext) {\n this.forEachFunction = forEachFunction;\n this.forEachContext = forEachContext;\n}\nPooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);\n\nfunction forEachSingleChild(traverseContext, child, name, i) {\n var forEachBookKeeping = traverseContext;\n forEachBookKeeping.forEachFunction.call(\n forEachBookKeeping.forEachContext, child, i);\n}\n\n/**\n * Iterates through children that are typically specified as `props.children`.\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child.\n *\n * @param {array} children\n * @param {function(*, int)} forEachFunc.\n * @param {*} forEachContext Context for forEachContext.\n */\nfunction forEachChildren(children, forEachFunc, forEachContext) {\n if (children == null) {\n return children;\n }\n\n var traverseContext =\n ForEachBookKeeping.getPooled(forEachFunc, forEachContext);\n traverseAllChildren(children, forEachSingleChild, traverseContext);\n ForEachBookKeeping.release(traverseContext);\n}\n\n/**\n * PooledClass representing the bookkeeping associated with performing a child\n * mapping. Allows avoiding binding callbacks.\n *\n * @constructor MapBookKeeping\n * @param {!*} mapResult Object containing the ordered map of results.\n * @param {!function} mapFunction Function to perform mapping with.\n * @param {?*} mapContext Context to perform mapping with.\n */\nfunction MapBookKeeping(mapResult, mapFunction, mapContext) {\n this.mapResult = mapResult;\n this.mapFunction = mapFunction;\n this.mapContext = mapContext;\n}\nPooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);\n\nfunction mapSingleChildIntoContext(traverseContext, child, name, i) {\n var mapBookKeeping = traverseContext;\n var mapResult = mapBookKeeping.mapResult;\n var mappedChild =\n mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);\n // We found a component instance\n invariant(\n !mapResult.hasOwnProperty(name),\n 'ReactChildren.map(...): Encountered two children with the same key, ' +\n '`%s`. Children keys must be unique.',\n name\n );\n mapResult[name] = mappedChild;\n}\n\n/**\n * Maps children that are typically specified as `props.children`.\n *\n * The provided mapFunction(child, key, index) will be called for each\n * leaf child.\n *\n * TODO: This may likely break any calls to `ReactChildren.map` that were\n * previously relying on the fact that we guarded against null children.\n *\n * @param {array} children\n * @param {function(*, int)} mapFunction.\n * @param {*} mapContext Context for mapFunction.\n * @return {array} mirrored array with mapped children.\n */\nfunction mapChildren(children, func, context) {\n if (children == null) {\n return children;\n }\n\n var mapResult = {};\n var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);\n traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);\n MapBookKeeping.release(traverseContext);\n return mapResult;\n}\n\nvar ReactChildren = {\n forEach: forEachChildren,\n map: mapChildren\n};\n\nmodule.exports = ReactChildren;\n\nrequire(\"./mock-modules\").register(\"ReactChildren\", module);\n",
"Transaction":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule Transaction\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\n/**\n * `Transaction` creates a black box that is able to wrap any method such that\n * certain invariants are maintained before and after the method is invoked\n * (Even if an exception is thrown while invoking the wrapped method). Whoever\n * instantiates a transaction can provide enforcers of the invariants at\n * creation time. The `Transaction` class itself will supply one additional\n * automatic invariant for you - the invariant that any transaction instance\n * should not be ran while it is already being ran. You would typically create a\n * single instance of a `Transaction` for reuse multiple times, that potentially\n * is used to wrap several different methods. Wrappers are extremely simple -\n * they only require implementing two methods.\n *\n * <pre>\n * wrappers (injected at creation time)\n * + +\n * | |\n * +-----------------|--------|--------------+\n * | v | |\n * | +---------------+ | |\n * | +--| wrapper1 |---|----+ |\n * | | +---------------+ v | |\n * | | +-------------+ | |\n * | | +----| wrapper2 |--------+ |\n * | | | +-------------+ | | |\n * | | | | | |\n * | v v v v | wrapper\n * | +---+ +---+ +---------+ +---+ +---+ | invariants\n * perform(anyMethod) | | | | | | | | | | | | maintained\n * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->\n * | | | | | | | | | | | |\n * | | | | | | | | | | | |\n * | | | | | | | | | | | |\n * | +---+ +---+ +---------+ +---+ +---+ |\n * | initialize close |\n * +-----------------------------------------+\n * </pre>\n *\n * Bonus:\n * - Reports timing metrics by method name and wrapper index.\n *\n * Use cases:\n * - Preserving the input selection ranges before/after reconciliation.\n * Restoring selection even in the event of an unexpected error.\n * - Deactivating events while rearranging the DOM, preventing blurs/focuses,\n * while guaranteeing that afterwards, the event system is reactivated.\n * - Flushing a queue of collected DOM mutations to the main UI thread after a\n * reconciliation takes place in a worker thread.\n * - Invoking any collected `componentDidRender` callbacks after rendering new\n * content.\n * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue\n * to preserve the `scrollTop` (an automatic scroll aware DOM).\n * - (Future use case): Layout calculations before and after DOM upates.\n *\n * Transactional plugin API:\n * - A module that has an `initialize` method that returns any precomputation.\n * - and a `close` method that accepts the precomputation. `close` is invoked\n * when the wrapped process is completed, or has failed.\n *\n * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules\n * that implement `initialize` and `close`.\n * @return {Transaction} Single transaction for reuse in thread.\n *\n * @class Transaction\n */\nvar Mixin = {\n /**\n * Sets up this instance so that it is prepared for collecting metrics. Does\n * so such that this setup method may be used on an instance that is already\n * initialized, in a way that does not consume additional memory upon reuse.\n * That can be useful if you decide to make your subclass of this mixin a\n * \"PooledClass\".\n */\n reinitializeTransaction: function() {\n this.transactionWrappers = this.getTransactionWrappers();\n if (!this.wrapperInitData) {\n this.wrapperInitData = [];\n } else {\n this.wrapperInitData.length = 0;\n }\n if (!this.timingMetrics) {\n this.timingMetrics = {};\n }\n this.timingMetrics.methodInvocationTime = 0;\n if (!this.timingMetrics.wrapperInitTimes) {\n this.timingMetrics.wrapperInitTimes = [];\n } else {\n this.timingMetrics.wrapperInitTimes.length = 0;\n }\n if (!this.timingMetrics.wrapperCloseTimes) {\n this.timingMetrics.wrapperCloseTimes = [];\n } else {\n this.timingMetrics.wrapperCloseTimes.length = 0;\n }\n this._isInTransaction = false;\n },\n\n _isInTransaction: false,\n\n /**\n * @abstract\n * @return {Array<TransactionWrapper>} Array of transaction wrappers.\n */\n getTransactionWrappers: null,\n\n isInTransaction: function() {\n return !!this._isInTransaction;\n },\n\n /**\n * Executes the function within a safety window. Use this for the top level\n * methods that result in large amounts of computation/mutations that would\n * need to be safety checked.\n *\n * @param {function} method Member of scope to call.\n * @param {Object} scope Scope to invoke from.\n * @param {Object?=} args... Arguments to pass to the method (optional).\n * Helps prevent need to bind in many cases.\n * @return Return value from `method`.\n */\n perform: function(method, scope, a, b, c, d, e, f) {\n invariant(\n !this.isInTransaction(),\n 'Transaction.perform(...): Cannot initialize a transaction when there ' +\n 'is already an outstanding transaction.'\n );\n var memberStart = Date.now();\n var errorToThrow = null;\n var ret;\n try {\n this.initializeAll();\n ret = method.call(scope, a, b, c, d, e, f);\n } catch (error) {\n // IE8 requires `catch` in order to use `finally`.\n errorToThrow = error;\n } finally {\n var memberEnd = Date.now();\n this.methodInvocationTime += (memberEnd - memberStart);\n try {\n this.closeAll();\n } catch (closeError) {\n // If `method` throws, prefer to show that stack trace over any thrown\n // by invoking `closeAll`.\n errorToThrow = errorToThrow || closeError;\n }\n }\n if (errorToThrow) {\n throw errorToThrow;\n }\n return ret;\n },\n\n initializeAll: function() {\n this._isInTransaction = true;\n var transactionWrappers = this.transactionWrappers;\n var wrapperInitTimes = this.timingMetrics.wrapperInitTimes;\n var errorToThrow = null;\n for (var i = 0; i < transactionWrappers.length; i++) {\n var initStart = Date.now();\n var wrapper = transactionWrappers[i];\n try {\n this.wrapperInitData[i] = wrapper.initialize ?\n wrapper.initialize.call(this) :\n null;\n } catch (initError) {\n // Prefer to show the stack trace of the first error.\n errorToThrow = errorToThrow || initError;\n this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;\n } finally {\n var curInitTime = wrapperInitTimes[i];\n var initEnd = Date.now();\n wrapperInitTimes[i] = (curInitTime || 0) + (initEnd - initStart);\n }\n }\n if (errorToThrow) {\n throw errorToThrow;\n }\n },\n\n /**\n * Invokes each of `this.transactionWrappers.close[i]` functions, passing into\n * them the respective return values of `this.transactionWrappers.init[i]`\n * (`close`rs that correspond to initializers that failed will not be\n * invoked).\n */\n closeAll: function() {\n invariant(\n this.isInTransaction(),\n 'Transaction.closeAll(): Cannot close transaction when none are open.'\n );\n var transactionWrappers = this.transactionWrappers;\n var wrapperCloseTimes = this.timingMetrics.wrapperCloseTimes;\n var errorToThrow = null;\n for (var i = 0; i < transactionWrappers.length; i++) {\n var wrapper = transactionWrappers[i];\n var closeStart = Date.now();\n var initData = this.wrapperInitData[i];\n try {\n if (initData !== Transaction.OBSERVED_ERROR) {\n wrapper.close && wrapper.close.call(this, initData);\n }\n } catch (closeError) {\n // Prefer to show the stack trace of the first error.\n errorToThrow = errorToThrow || closeError;\n } finally {\n var closeEnd = Date.now();\n var curCloseTime = wrapperCloseTimes[i];\n wrapperCloseTimes[i] = (curCloseTime || 0) + (closeEnd - closeStart);\n }\n }\n this.wrapperInitData.length = 0;\n this._isInTransaction = false;\n if (errorToThrow) {\n throw errorToThrow;\n }\n }\n};\n\nvar Transaction = {\n\n Mixin: Mixin,\n\n /**\n * Token to look for to determine if an error occured.\n */\n OBSERVED_ERROR: {}\n\n};\n\nmodule.exports = Transaction;\n\nrequire(\"./mock-modules\").register(\"Transaction\", module);\n",
"escapeTextForBrowser":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule escapeTextForBrowser\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ESCAPE_LOOKUP = {\n \"&\": \"&amp;\",\n \">\": \"&gt;\",\n \"<\": \"&lt;\",\n \"\\\"\": \"&quot;\",\n \"'\": \"&#x27;\",\n \"/\": \"&#x2f;\"\n};\n\nvar ESCAPE_REGEX = /[&><\"'\\/]/g;\n\nfunction escaper(match) {\n return ESCAPE_LOOKUP[match];\n}\n\n/**\n * Escapes text to prevent scripting attacks.\n *\n * @param {*} text Text value to escape.\n * @return {string} An escaped string.\n */\nfunction escapeTextForBrowser(text) {\n return ('' + text).replace(ESCAPE_REGEX, escaper);\n}\n\nmodule.exports = escapeTextForBrowser;\n\nrequire(\"./mock-modules\").register(\"escapeTextForBrowser\", module);\n",
"joinClasses":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule joinClasses\n * @typechecks static-only\n */\n\n\"use strict\";\n\n/**\n * Combines multiple className strings into one.\n * http://jsperf.com/joinclasses-args-vs-array\n *\n * @param {...?string} classes\n * @return {string}\n */\nfunction joinClasses(className/*, ... */) {\n if (!className) {\n className = '';\n }\n var nextClass;\n var argLength = arguments.length;\n if (argLength > 1) {\n for (var ii = 1; ii < argLength; ii++) {\n nextClass = arguments[ii];\n nextClass && (className += ' ' + nextClass);\n }\n }\n return className;\n}\n\nmodule.exports = joinClasses;\n\nrequire(\"./mock-modules\").register(\"joinClasses\", module);\n",
"keyMirror":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule keyMirror\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\n/**\n * Constructs an enumeration with keys equal to their value.\n *\n * For example:\n *\n * var COLORS = keyMirror({blue: null, red: null});\n * var myColor = COLORS.blue;\n * var isColorValid = !!COLORS[myColor];\n *\n * The last line could not be performed if the values of the generated enum were\n * not equal to their keys.\n *\n * Input: {key1: val1, key2: val2}\n * Output: {key1: key1, key2: key2}\n *\n * @param {object} obj\n * @return {object}\n */\nvar keyMirror = function(obj) {\n var ret = {};\n var key;\n invariant(\n obj instanceof Object && !Array.isArray(obj),\n 'keyMirror(...): Argument must be an object.'\n );\n for (key in obj) {\n if (!obj.hasOwnProperty(key)) {\n continue;\n }\n ret[key] = key;\n }\n return ret;\n};\n\nmodule.exports = keyMirror;\n\nrequire(\"./mock-modules\").register(\"keyMirror\", module);\n",
"memoizeStringOnly":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule memoizeStringOnly\n * @typechecks static-only\n */\n\n\"use strict\";\n\n/**\n * Memoizes the return value of a function that accepts one string argument.\n *\n * @param {function} callback\n * @return {function}\n */\nfunction memoizeStringOnly(callback) {\n var cache = {};\n return function(string) {\n if (cache.hasOwnProperty(string)) {\n return cache[string];\n } else {\n return cache[string] = callback.call(this, string);\n }\n };\n}\n\nmodule.exports = memoizeStringOnly;\n\nrequire(\"./mock-modules\").register(\"memoizeStringOnly\", module);\n",
"onlyChild":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule onlyChild\n */\n\"use strict\";\n\nvar ReactComponent = require(\"./ReactComponent\");\n\nvar invariant = require(\"./invariant\");\n\n/**\n * Returns the first child in a collection of children and verifies that there\n * is only one child in the collection. The current implementation of this\n * function assumes that a single child gets passed without a wrapper, but the\n * purpose of this helper function is to abstract away the particular structure\n * of children.\n *\n * @param {?object} children Child collection structure.\n * @return {ReactComponent} The first and only `ReactComponent` contained in the\n * structure.\n */\nfunction onlyChild(children) {\n invariant(\n ReactComponent.isValidComponent(children),\n 'onlyChild must be passed a children with exactly one child.'\n );\n return children;\n}\n\nmodule.exports = onlyChild;\n\nrequire(\"./mock-modules\").register(\"onlyChild\", module);\n",
"mergeHelpers":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mergeHelpers\n *\n * requiresPolyfills: Array.isArray\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\nvar keyMirror = require(\"./keyMirror\");\n\n/**\n * Maximum number of levels to traverse. Will catch circular structures.\n * @const\n */\nvar MAX_MERGE_DEPTH = 36;\n\n/**\n * We won't worry about edge cases like new String('x') or new Boolean(true).\n * Functions are considered terminals, and arrays are not.\n * @param {*} o The item/object/value to test.\n * @return {boolean} true iff the argument is a terminal.\n */\nvar isTerminal = function(o) {\n return typeof o !== 'object' || o === null;\n};\n\nvar mergeHelpers = {\n\n MAX_MERGE_DEPTH: MAX_MERGE_DEPTH,\n\n isTerminal: isTerminal,\n\n /**\n * Converts null/undefined values into empty object.\n *\n * @param {?Object=} arg Argument to be normalized (nullable optional)\n * @return {!Object}\n */\n normalizeMergeArg: function(arg) {\n return arg === undefined || arg === null ? {} : arg;\n },\n\n /**\n * If merging Arrays, a merge strategy *must* be supplied. If not, it is\n * likely the caller's fault. If this function is ever called with anything\n * but `one` and `two` being `Array`s, it is the fault of the merge utilities.\n *\n * @param {*} one Array to merge into.\n * @param {*} two Array to merge from.\n */\n checkMergeArrayArgs: function(one, two) {\n invariant(\n Array.isArray(one) && Array.isArray(two),\n 'Critical assumptions about the merge functions have been violated. ' +\n 'This is the fault of the merge functions themselves, not necessarily ' +\n 'the callers.'\n );\n },\n\n /**\n * @param {*} one Object to merge into.\n * @param {*} two Object to merge from.\n */\n checkMergeObjectArgs: function(one, two) {\n mergeHelpers.checkMergeObjectArg(one);\n mergeHelpers.checkMergeObjectArg(two);\n },\n\n /**\n * @param {*} arg\n */\n checkMergeObjectArg: function(arg) {\n invariant(\n !isTerminal(arg) && !Array.isArray(arg),\n 'Critical assumptions about the merge functions have been violated. ' +\n 'This is the fault of the merge functions themselves, not necessarily ' +\n 'the callers.'\n );\n },\n\n /**\n * Checks that a merge was not given a circular object or an object that had\n * too great of depth.\n *\n * @param {number} Level of recursion to validate against maximum.\n */\n checkMergeLevel: function(level) {\n invariant(\n level < MAX_MERGE_DEPTH,\n 'Maximum deep merge depth exceeded. You may be attempting to merge ' +\n 'circular structures in an unsupported way.'\n );\n },\n\n /**\n * Checks that the supplied merge strategy is valid.\n *\n * @param {string} Array merge strategy.\n */\n checkArrayStrategy: function(strategy) {\n invariant(\n strategy === undefined || strategy in mergeHelpers.ArrayStrategies,\n 'You must provide an array strategy to deep merge functions to ' +\n 'instruct the deep merge how to resolve merging two arrays.'\n );\n },\n\n /**\n * Set of possible behaviors of merge algorithms when encountering two Arrays\n * that must be merged together.\n * - `clobber`: The left `Array` is ignored.\n * - `indexByIndex`: The result is achieved by recursively deep merging at\n * each index. (not yet supported.)\n */\n ArrayStrategies: keyMirror({\n Clobber: true,\n IndexByIndex: true\n })\n\n};\n\nmodule.exports = mergeHelpers;\n\nrequire(\"./mock-modules\").register(\"mergeHelpers\", module);\n",
"mergeInto":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mergeInto\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar mergeHelpers = require(\"./mergeHelpers\");\n\nvar checkMergeObjectArg = mergeHelpers.checkMergeObjectArg;\n\n/**\n * Shallow merges two structures by mutating the first parameter.\n *\n * @param {object} one Object to be merged into.\n * @param {?object} two Optional object with properties to merge from.\n */\nfunction mergeInto(one, two) {\n checkMergeObjectArg(one);\n if (two != null) {\n checkMergeObjectArg(two);\n for (var key in two) {\n if (!two.hasOwnProperty(key)) {\n continue;\n }\n one[key] = two[key];\n }\n }\n}\n\nmodule.exports = mergeInto;\n\nrequire(\"./mock-modules\").register(\"mergeInto\", module);\n",
"mergeDeep":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mergeDeep\n */\n\n\"use strict\";\n\nvar mergeHelpers = require(\"./mergeHelpers\");\nvar mergeDeepInto = require(\"./mergeDeepInto\");\n\nvar checkArrayStrategy = mergeHelpers.checkArrayStrategy;\nvar checkMergeObjectArgs = mergeHelpers.checkMergeObjectArgs;\nvar normalizeMergeArg = mergeHelpers.normalizeMergeArg;\n\n/**\n * @see mergeDeepImpl comments.\n *\n * @param {!Object} one returned will be an structural extension of this.\n * @param {!Object} two values from two take precedence over values in one.\n * @param {?Enum=} arrayStrategy One of `arrayStrategies`.\n * @return {!Object} the extension of one by two.\n */\nvar mergeDeep = function(oneParam, twoParam, arrayStrategy) {\n var one = normalizeMergeArg(oneParam);\n var two = normalizeMergeArg(twoParam);\n checkMergeObjectArgs(one, two);\n checkArrayStrategy(arrayStrategy);\n var newObj = {};\n // TODO: This is horribly inefficient. Even when some deep object in `one`\n // will be clobbered by another entity in `two`, we perform a clone of that\n // entire structure. To make this code more efficient, we'll need to either\n // enhance `mergeDeepInto` to accept multiple arguments or mirror that code\n // here.\n mergeDeepInto(newObj, one, arrayStrategy);\n mergeDeepInto(newObj, two, arrayStrategy);\n return newObj;\n};\n\n\nmodule.exports = mergeDeep;\n\nrequire(\"./mock-modules\").register(\"mergeDeep\", module);\n",
"mergeDeepInto":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule mergeDeepInto\n */\n\n// Empty blocks improve readability so disable that warning\n// jshint -W035\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\nvar mergeHelpers = require(\"./mergeHelpers\");\n\nvar ArrayStrategies = mergeHelpers.ArrayStrategies;\nvar checkArrayStrategy = mergeHelpers.checkArrayStrategy;\nvar checkMergeArrayArgs = mergeHelpers.checkMergeArrayArgs;\nvar checkMergeLevel = mergeHelpers.checkMergeLevel;\nvar checkMergeObjectArgs = mergeHelpers.checkMergeObjectArgs;\nvar isTerminal = mergeHelpers.isTerminal;\nvar normalizeMergeArg = mergeHelpers.normalizeMergeArg;\n\n/**\n * Every deep merge function must handle merging in each of the following cases\n * at every level. We may refer to letters below in implementations. For each\n * case listed, the \"Result\" listed describes the *value* of the result, but\n * does not specify anything about the memory graph of the result. In other\n * words the Results listed below will be the same for `merge` and `mergeInto`\n * but `merge` may have different guarantees about mutation/cloning. In the\n * table, \"Object\" refers to a non- Array, non-terminal object. One result is\n * undefined and requires that the caller specify the resolution policy (only\n * when trying to merge two arrays).\n *\n * Scenario Result\n * --------------------------------------------------------------\n * [A]: (terminal, terminal) right terminal\n * [B]: (terminal, Array) right Array\n * [C]: (terminal, Object) right Object\n * [D]: (terminal, not present) left terminal\n * [E]: (Array, terminal) right terminal\n * [F]: (Array, Array) UNDEFINED - MUST SPECIFY POLICY\n * [G]: (Array, Object) right Object\n * [H]: (Array, not present) left Array\n * [I]: (Object, terminal) right terminal\n * [J]: (Object, Array) right Array\n * [K]: (Object, Object) merge of left and right Objects\n * [L]: (Object, not present) left Object\n * [M]: (not present, terminal) right terminal\n * [N]: (not present, Array) right Array\n * [O]: (not present, Object) right Object\n *\n * All merge functions are only expected to reason about \"own\" properties and,\n * any prototypical properties should have no effect on the result. At the first\n * level of recursion in deep merges, we may choose to normalize arguments\n * (convert undefined to empty objects etc.) The above chart does not describe\n * the result of those top level operations which behave specially due to the\n * normalization.\n */\n\n/**\n * Deep merge implementation for non-Array, non-terminal Objects.\n *\n * @param {!Object} one non-Array, non-terminal Object to be mutated deeply.\n * @param {!Object} two non-Array, non-terminal taking precedence over `one`.\n * @param {?Enum=} arrayStrategy one of `arrayStrategies`.\n * @param {!number} level The level of recursion.\n */\nvar mergeDeepIntoObjects = function(one, two, arrayStrategy, level) {\n checkMergeObjectArgs(one, two);\n checkMergeLevel(level);\n var twoKeys = two ? Object.keys(two) : [];\n for (var i = 0; i < twoKeys.length; i++) {\n var twoKey = twoKeys[i];\n mergeSingleFieldDeep(one, two, twoKey, arrayStrategy, level);\n }\n};\n\n/**\n * Deep merge implementation for Arrays.\n *\n * @param {!Array} one Array to deep merge.\n * @param {!Array} two Array to deep merge \"into\" `one`.\n * @param {?Enum=} arrayStrategy one of `arrayStrategies`.\n * @param {!number} level Level of recursion.\n */\nvar mergeDeepIntoArrays = function(one, two, arrayStrategy, level) {\n checkMergeArrayArgs(one, two);\n checkMergeLevel(level);\n\n var maxLen = Math.max(one.length, two.length);\n for (var i = 0; i < maxLen; i++) {\n mergeSingleFieldDeep(one, two, i, arrayStrategy, level);\n }\n};\n\n/**\n * Given two truthy containers `one` and `two`, and a `key`, performs a deep\n * merge on a logical field.\n *\n * @param {!Array|Object} one Container to merge into.\n * @param {!Array|Object} two Container to merge from.\n * @param {!string} key Key of field that should be merged.\n * @param {lEnum=} arrayStrategy One of `arrayStrategies`.\n * @param {!number} level Current level of recursion.\n */\nvar mergeSingleFieldDeep = function(one, two, key, arrayStrategy, level) {\n var twoVal = two[key];\n var twoValIsPresent = two.hasOwnProperty(key);\n var twoValIsTerminal = twoValIsPresent && isTerminal(twoVal);\n var twoValIsArray = twoValIsPresent && Array.isArray(twoVal);\n var twoValIsProperObject =\n twoValIsPresent && !twoValIsArray && !twoValIsArray;\n\n var oneVal = one[key];\n var oneValIsPresent = one.hasOwnProperty(key);\n var oneValIsTerminal = oneValIsPresent && isTerminal(oneVal);\n var oneValIsArray = oneValIsPresent && Array.isArray(oneVal);\n var oneValIsProperObject =\n oneValIsPresent && !oneValIsArray && !oneValIsArray;\n\n if (oneValIsTerminal) {\n if (twoValIsTerminal) { // [A]\n one[key] = twoVal;\n } else if (twoValIsArray) { // [B]\n one[key] = [];\n mergeDeepIntoArrays(one[key], twoVal, arrayStrategy, level + 1);\n } else if (twoValIsProperObject) { // [C]\n one[key] = {};\n mergeDeepIntoObjects(one[key], twoVal, arrayStrategy, level + 1);\n } else if (!twoValIsPresent) { // [D]\n one[key] = oneVal;\n }\n } else if (oneValIsArray) {\n if (twoValIsTerminal) { // [E]\n one[key] = twoVal;\n } else if (twoValIsArray) { // [F]\n invariant(\n ArrayStrategies[arrayStrategy],\n 'mergeDeepInto(...): Attempted to merge two arrays, but a valid ' +\n 'ArrayStrategy was not specified.'\n );\n // Else: At this point, the only other valid option is `IndexByIndex`\n if (arrayStrategy === ArrayStrategies.Clobber) {\n oneVal.length = 0;\n }\n mergeDeepIntoArrays(oneVal, twoVal, arrayStrategy, level + 1);\n } else if (twoValIsProperObject) { // [G]\n one[key] = {};\n mergeDeepIntoObjects(one[key], twoVal, arrayStrategy, level + 1);\n } else if (!twoValIsPresent) { // [H]\n // Leave the left Array alone\n }\n } else if (oneValIsProperObject) {\n if (twoValIsTerminal) { // [I]\n one[key] = twoVal;\n } else if (twoValIsArray) { // [J]\n one[key] = [];\n mergeDeepIntoArrays(one[key], twoVal, arrayStrategy, level + 1);\n } else if (twoValIsProperObject) { // [K]\n mergeDeepIntoObjects(oneVal, twoVal, arrayStrategy, level + 1);\n } else if (!twoValIsPresent) { // [L]\n // Leave the left Object alone\n }\n } else if (!oneValIsPresent) {\n if (twoValIsTerminal) { // [M]\n one[key] = twoVal;\n } else if (twoValIsArray) { // [N]\n one[key] = [];\n mergeDeepIntoArrays(one[key], twoVal, arrayStrategy, level + 1);\n } else if (twoValIsProperObject) { // [O]\n one[key] = {};\n mergeDeepIntoObjects(one[key], twoVal, arrayStrategy, level + 1);\n } else if (!twoValIsPresent) {\n // Could/should never happen\n }\n }\n};\n\n\n\n/**\n * Provides same functionality as mergeInto, but merges by mutating the first\n * argument. Will never mutate the second argument.\n *\n * mergeDeepInto provides two guarantees:\n * 1. In the process of mutating one, will not mutate two.\n * 2. Will not cause any nonTerminal memory to be shared between one and two.\n * This means that no further mutations to one will effect two (unless some\n * other part of your application forms shared memory between one and two).\n *\n * mergeDeepInto does not guarantee that it will *preserve* any shared memory\n * between two and one that existed before invocation. After calling\n * mergeDeepInto, there will be less (or equal) amount of shared memory between\n * one and two.\n *\n * Will tolerate a circular structure as the first parameter, but not the\n * second.\n *\n * Requires that first parameter be a non-Array, non-terminal `Object`, and the\n * second argument either be an `Object` or `null/undefined`. Arrays may exist\n * in the depths of either `Object` as long as an `arrayStrategy` is supplied.\n *\n * The third parameter indicates how merging two `Array`s should be performed.\n *\n * @param {!Object} one Object to be mutated deeply.\n * @param {?Object} two Values from two take precedence over values in one.\n * @param {?Enum=} arrayStrategy One of arrayStrategy\n */\nvar mergeDeepInto = function(one, twoParam, arrayStrategy) {\n var two = normalizeMergeArg(twoParam);\n checkArrayStrategy(arrayStrategy); // Will be checked twice, for now.\n mergeDeepIntoObjects(one, two, arrayStrategy, 0);\n};\n\nmodule.exports = mergeDeepInto;\n\nrequire(\"./mock-modules\").register(\"mergeDeepInto\", module);\n",
"sliceChildren":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule sliceChildren\n */\n\n\"use strict\";\n\nvar flattenChildren = require(\"./flattenChildren\");\n\n/**\n * Slice children that are typically specified as `props.children`. This version\n * of slice children ignores empty child components.\n *\n * @param {*} children The children set to filter.\n * @param {number} start The first zero-based index to include in the subset.\n * @param {?number} end The non-inclusive last index of the subset.\n * @return {object} mirrored array with mapped children\n */\nfunction sliceChildren(children, start, end) {\n if (children == null) {\n return children;\n }\n\n var slicedChildren = {};\n var flattenedMap = flattenChildren(children);\n var ii = 0;\n for (var key in flattenedMap) {\n if (!flattenedMap.hasOwnProperty(key)) {\n continue;\n }\n var child = flattenedMap[key];\n // In this version of slice children we ignore empty children.\n if (child !== null) {\n if (ii >= start) {\n slicedChildren[key] = child;\n }\n ii++;\n if (end != null && ii >= end) {\n break;\n }\n }\n }\n return slicedChildren;\n}\n\nmodule.exports = sliceChildren;\n\nrequire(\"./mock-modules\").register(\"sliceChildren\", module);\n",
"traverseAllChildren":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule traverseAllChildren\n */\n\n\"use strict\";\n\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactTextComponent = require(\"./ReactTextComponent\");\n\nvar invariant = require(\"./invariant\");\n\n/**\n * TODO: Test that:\n * 1. `mapChildren` transforms strings and numbers into `ReactTextComponent`.\n * 2. it('should fail when supplied duplicate key', function() {\n * 3. That a single child and an array with one item have the same key pattern.\n * });\n */\n\n/**\n * @param {?*} children Children tree container.\n * @param {!string} nameSoFar Name of the key path so far.\n * @param {!number} indexSoFar Number of children encountered until this point.\n * @param {!function} callback Callback to invoke with each child found.\n * @param {?*} traverseContext Used to pass information throughout the traversal\n * process.\n * @return {!number} The number of children in this subtree.\n */\nvar traverseAllChildrenImpl =\n function(children, nameSoFar, indexSoFar, callback, traverseContext) {\n var subtreeCount = 0; // Count of children found in the current subtree.\n if (Array.isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n var nextName = nameSoFar + ReactComponent.getKey(child, i);\n var nextIndex = indexSoFar + subtreeCount;\n subtreeCount += traverseAllChildrenImpl(\n child,\n nextName,\n nextIndex,\n callback,\n traverseContext\n );\n }\n } else {\n var type = typeof children;\n var isOnlyChild = nameSoFar === '';\n // If it's the only child, treat the name as if it was wrapped in an array\n // so that it's consistent if the number of children grows\n var storageName = isOnlyChild ?\n ReactComponent.getKey(children, 0):\n nameSoFar;\n if (children === null || children === undefined || type === 'boolean') {\n // All of the above are perceived as null.\n callback(traverseContext, null, storageName, indexSoFar);\n subtreeCount = 1;\n } else if (children.mountComponentIntoNode) {\n callback(traverseContext, children, storageName, indexSoFar);\n subtreeCount = 1;\n } else {\n if (type === 'object') {\n invariant(\n !children || children.nodeType !== 1,\n 'traverseAllChildren(...): Encountered an invalid child; DOM ' +\n 'elements are not valid children of React components.'\n );\n for (var key in children) {\n if (children.hasOwnProperty(key)) {\n subtreeCount += traverseAllChildrenImpl(\n children[key],\n nameSoFar + '{' + key + '}',\n indexSoFar + subtreeCount,\n callback,\n traverseContext\n );\n }\n }\n } else if (type === 'string') {\n var normalizedText = new ReactTextComponent(children);\n callback(traverseContext, normalizedText, storageName, indexSoFar);\n subtreeCount += 1;\n } else if (type === 'number') {\n var normalizedNumber = new ReactTextComponent('' + children);\n callback(traverseContext, normalizedNumber, storageName, indexSoFar);\n subtreeCount += 1;\n }\n }\n }\n return subtreeCount;\n };\n\n/**\n * Traverses children that are typically specified as `props.children`, but\n * might also be specified through attributes:\n *\n * - `traverseAllChildren(this.props.children, ...)`\n * - `traverseAllChildren(this.props.leftPanelChildren, ...)`\n *\n * The `traverseContext` is an optional argument that is passed through the\n * entire traversal. It can be used to store accumulations or anything else that\n * the callback might find relevant.\n *\n * @param {?*} children Children tree object.\n * @param {!function} callback To invoke upon traversing each child.\n * @param {?*} traverseContext Context for traversal.\n */\nfunction traverseAllChildren(children, callback, traverseContext) {\n if (children !== null && children !== undefined) {\n traverseAllChildrenImpl(children, '', 0, callback, traverseContext);\n }\n}\n\nmodule.exports = traverseAllChildren;\n\nrequire(\"./mock-modules\").register(\"traverseAllChildren\", module);\n",
"ex":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ex\n * @typechecks\n * @nostacktrace\n */\n\n/**\n * This function transforms error message with arguments into plain text error\n * message, so that it can be passed to window.onerror without losing anything.\n * It can then be transformed back by `erx()` function.\n *\n * Usage:\n * throw new Error(ex('Error %s from %s', errorCode, userID));\n *\n * @param {string} errorMessage\n */\n\nvar ex = function(errorMessage/*, arg1, arg2, ...*/) {\n var args = Array.prototype.slice.call(arguments).map(function(arg) {\n return String(arg);\n });\n var expectedLength = errorMessage.split('%s').length - 1;\n\n if (expectedLength !== args.length - 1) {\n // something wrong with the formatting string\n return ex('ex args number mismatch: %s', JSON.stringify(args));\n }\n\n return ex._prefix + JSON.stringify(args) + ex._suffix;\n};\n\nex._prefix = '<![EX[';\nex._suffix = ']]>';\n\nmodule.exports = ex;\n\nrequire(\"./mock-modules\").register(\"ex\", module);\n",
"erx":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule erx\n * @typechecks\n * @nostacktrace\n */\n\nvar ex = require(\"./ex\");\n\n/**\n * This function reverse transform done by `ex()`.\n *\n * This function only transforms plain text message back to error message with\n * arguments. If the error message is minified by the server, it has to be\n * looked up on the server.\n *\n * This function is designed to be idempotent, so erx(erx(whatever)) will be\n * the same as erx(whatever).\n *\n * @param {string|array<string>} transformedMessage\n */\n\nvar erx = function(transformedMessage) {\n if (typeof transformedMessage !== 'string') {\n // possibly double `erx`ed and return original value\n return transformedMessage;\n }\n\n var prefixLeft = transformedMessage.indexOf(ex._prefix);\n var suffixLeft = transformedMessage.lastIndexOf(ex._suffix);\n if (prefixLeft < 0 || suffixLeft < 0) {\n // plain error message without any transformation\n return [transformedMessage];\n }\n\n var prefixRight = prefixLeft + ex._prefix.length;\n var suffixRight = suffixLeft + ex._suffix.length;\n if (prefixRight >= suffixLeft) {\n return ['erx slice failure: %s', transformedMessage];\n }\n\n var leftSlice = transformedMessage.substring(0, prefixLeft);\n var rightSlice = transformedMessage.substring(suffixRight);\n transformedMessage = transformedMessage.substring(prefixRight, suffixLeft);\n\n var messageWithParams;\n try {\n messageWithParams = JSON.parse(transformedMessage);\n messageWithParams[0] =\n leftSlice + messageWithParams[0] + rightSlice;\n } catch(err) {\n return ['erx parse failure: %s', transformedMessage];\n }\n\n return messageWithParams;\n};\n\nmodule.exports = erx;\n\nrequire(\"./mock-modules\").register(\"erx\", module);\n",
"ReactTextComponent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactTextComponent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ReactComponent = require(\"./ReactComponent\");\nvar ReactMount = require(\"./ReactMount\");\n\nvar escapeTextForBrowser = require(\"./escapeTextForBrowser\");\nvar mixInto = require(\"./mixInto\");\n\n/**\n * Text nodes violate a couple assumptions that React makes about components:\n *\n * - When mounting text into the DOM, adjacent text nodes are merged.\n * - Text nodes cannot be assigned a React root ID.\n *\n * This component is used to wrap strings in elements so that they can undergo\n * the same reconciliation that is applied to elements.\n *\n * TODO: Investigate representing React components in the DOM with text nodes.\n *\n * @class ReactTextComponent\n * @extends ReactComponent\n * @internal\n */\nvar ReactTextComponent = function(initialText) {\n this.construct({text: initialText});\n};\n\nmixInto(ReactTextComponent, ReactComponent.Mixin);\nmixInto(ReactTextComponent, {\n\n /**\n * Creates the markup for this text node. This node is not intended to have\n * any features besides containing text content.\n *\n * @param {string} rootID DOM ID of the root node.\n * @param {ReactReconcileTransaction} transaction\n * @param {number} mountDepth number of components in the owner hierarchy\n * @return {string} Markup for this text node.\n * @internal\n */\n mountComponent: function(rootID, transaction, mountDepth) {\n ReactComponent.Mixin.mountComponent.call(\n this,\n rootID,\n transaction,\n mountDepth\n );\n return (\n '<span ' + ReactMount.ATTR_NAME + '=\"' + rootID + '\">' +\n escapeTextForBrowser(this.props.text) +\n '</span>'\n );\n },\n\n /**\n * Updates this component by updating the text content.\n *\n * @param {object} nextProps Contains the next text content.\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n receiveProps: function(nextProps, transaction) {\n if (nextProps.text !== this.props.text) {\n this.props.text = nextProps.text;\n ReactComponent.DOMIDOperations.updateTextContentByID(\n this._rootNodeID,\n nextProps.text\n );\n }\n }\n\n});\n\nmodule.exports = ReactTextComponent;\n\nrequire(\"./mock-modules\").register(\"ReactTextComponent\", module);\n",
"invariant":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule invariant\n */\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf style format and arguments to provide information about\n * what broke and what you were expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nfunction invariant(condition) {\n if (!condition) {\n throw new Error('Invariant Violation');\n }\n}\n\nmodule.exports = invariant;\n\nif (true) {\n var invariantDev = function(condition, format, a, b, c, d, e, f) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n\n if (!condition) {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n throw new Error(\n 'Invariant Violation: ' +\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n }\n };\n\n module.exports = invariantDev;\n}\n\nrequire(\"./mock-modules\").register(\"invariant\", module);\n",
"CSSCore":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule CSSCore\n * @typechecks\n */\n\nvar invariant = require(\"./invariant\");\n\n/**\n * The CSSCore module specifies the API (and implements most of the methods)\n * that should be used when dealing with the display of elements (via their\n * CSS classes and visibility on screeni. It is an API focused on mutating the\n * display and not reading it as no logical state should be encoded in the\n * display of elements.\n */\n\n/**\n * Tests whether the element has the class specified.\n *\n * Note: This function is not exported in CSSCore because CSS classNames should\n * not store any logical information about the element. Use DataStore to store\n * information on an element.\n *\n * @param {DOMElement} element the element to set the class on\n * @param {string} className the CSS className\n * @returns {boolean} true if the element has the class, false if not\n */\nfunction hasClass(element, className) {\n if (element.classList) {\n return !!className && element.classList.contains(className);\n }\n return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;\n}\n\nvar CSSCore = {\n\n /**\n * Adds the class passed in to the element if it doesn't already have it.\n *\n * @param {DOMElement} element the element to set the class on\n * @param {string} className the CSS className\n * @return {DOMElement} the element passed in\n */\n addClass: function(element, className) {\n invariant(\n !/\\s/.test(className),\n 'CSSCore.addClass takes only a single class name. \"%s\" contains ' +\n 'multiple classes.', className\n );\n\n if (className) {\n if (element.classList) {\n element.classList.add(className);\n } else if (!hasClass(element, className)) {\n element.className = element.className + ' ' + className;\n }\n }\n return element;\n },\n\n /**\n * Removes the class passed in from the element\n *\n * @param {DOMElement} element the element to set the class on\n * @param {string} className the CSS className\n * @return {DOMElement} the element passed in\n */\n removeClass: function(element, className) {\n invariant(\n !/\\s/.test(className),\n 'CSSCore.removeClass takes only a single class name. \"%s\" contains ' +\n 'multiple classes.', className\n );\n\n if (className) {\n if (element.classList) {\n element.classList.remove(className);\n } else if (hasClass(element, className)) {\n element.className = element.className\n .replace(new RegExp('(^|\\\\s)' + className + '(?:\\\\s|$)', 'g'), '$1')\n .replace(/\\s+/g, ' ') // multiple spaces to one\n .replace(/^\\s*|\\s*$/g, ''); // trim the ends\n }\n }\n return element;\n },\n\n /**\n * Helper to add or remove a class from an element based on a condition.\n *\n * @param {DOMElement} element the element to set the class on\n * @param {string} className the CSS className\n * @param {*} bool condition to whether to add or remove the class\n * @return {DOMElement} the element passed in\n */\n conditionClass: function(element, className, bool) {\n return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);\n }\n};\n\nmodule.exports = CSSCore;\n\nrequire(\"./mock-modules\").register(\"CSSCore\", module);\n",
"ReactPerf":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactPerf\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ReactPerf = {\n /**\n * Boolean to enable/disable measurement. Set to false by default to prevent\n * accidental logging and perf loss.\n */\n enableMeasure: false,\n\n /**\n * Holds onto the measure function in use. By default, don't measure\n * anything, but we'll override this if we inject a measure function.\n */\n storedMeasure: _noMeasure,\n\n /**\n * Use this to wrap methods you want to measure.\n *\n * @param {string} objName\n * @param {string} fnName\n * @param {function} func\n * @return {function}\n */\n measure: function(objName, fnName, func) {\n if (true) {\n var measuredFunc = null;\n return function() {\n if (ReactPerf.enableMeasure) {\n if (!measuredFunc) {\n measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);\n }\n return measuredFunc.apply(this, arguments);\n }\n return func.apply(this, arguments);\n };\n }\n return func;\n },\n\n injection: {\n /**\n * @param {function} measure\n */\n injectMeasure: function(measure) {\n ReactPerf.storedMeasure = measure;\n }\n }\n};\n\nif (true) {\n var ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n var URL = ExecutionEnvironment.canUseDOM ? window.location.href : '';\n ReactPerf.enableMeasure = ReactPerf.enableMeasure ||\n !!URL.match(/[?&]react_perf\\b/);\n}\n\n/**\n * Simply passes through the measured function, without measuring it.\n *\n * @param {string} objName\n * @param {string} fnName\n * @param {function} func\n * @return {function}\n */\nfunction _noMeasure(objName, fnName, func) {\n return func;\n}\n\nmodule.exports = ReactPerf;\n\nrequire(\"./mock-modules\").register(\"ReactPerf\", module);\n",
"ReactTransitionEvents":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactTransitionEvents\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar EVENT_NAME_MAP = {\n transitionend: {\n 'transition': 'transitionend',\n 'WebkitTransition': 'webkitTransitionEnd',\n 'MozTransition': 'mozTransitionEnd',\n 'OTransition': 'oTransitionEnd',\n 'msTransition': 'MSTransitionEnd'\n },\n\n animationend: {\n 'animation': 'animationend',\n 'WebkitAnimation': 'webkitAnimationEnd',\n 'MozAnimation': 'mozAnimationEnd',\n 'OAnimation': 'oAnimationEnd',\n 'msAnimation': 'MSAnimationEnd'\n }\n};\n\nvar endEvents = [];\n\nfunction detectEvents() {\n var testEl = document.createElement('div');\n var style = testEl.style;\n for (var baseEventName in EVENT_NAME_MAP) {\n var baseEvents = EVENT_NAME_MAP[baseEventName];\n for (var styleName in baseEvents) {\n if (styleName in style) {\n endEvents.push(baseEvents[styleName]);\n break;\n }\n }\n }\n}\n\nif (ExecutionEnvironment.canUseDOM) {\n detectEvents();\n}\n\n// We use the raw {add|remove}EventListener() call because EventListener\n// does not know how to remove event listeners and we really should\n// clean up. Also, these events are not triggered in older browsers\n// so we should be A-OK here.\n\nfunction addEventListener(node, eventName, eventListener) {\n node.addEventListener(eventName, eventListener, false);\n}\n\nfunction removeEventListener(node, eventName, eventListener) {\n node.removeEventListener(eventName, eventListener, false);\n}\n\nvar ReactTransitionEvents = {\n addEndEventListener: function(node, eventListener) {\n if (endEvents.length === 0) {\n // If CSS transitions are not supported, trigger an \"end animation\"\n // event immediately.\n window.setTimeout(eventListener, 0);\n return;\n }\n endEvents.forEach(function(endEvent) {\n addEventListener(node, endEvent, eventListener);\n });\n },\n\n removeEndEventListener: function(node, eventListener) {\n if (endEvents.length === 0) {\n return;\n }\n endEvents.forEach(function(endEvent) {\n removeEventListener(node, endEvent, eventListener);\n });\n }\n};\n\nmodule.exports = ReactTransitionEvents;\n\nrequire(\"./mock-modules\").register(\"ReactTransitionEvents\", module);\n",
"ReactOwner":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactOwner\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\n/**\n * ReactOwners are capable of storing references to owned components.\n *\n * All components are capable of //being// referenced by owner components, but\n * only ReactOwner components are capable of //referencing// owned components.\n * The named reference is known as a \"ref\".\n *\n * Refs are available when mounted and updated during reconciliation.\n *\n * var MyComponent = React.createClass({\n * render: function() {\n * return (\n * <div onClick={this.handleClick}>\n * <CustomComponent ref=\"custom\" />\n * </div>\n * );\n * },\n * handleClick: function() {\n * this.refs.custom.handleClick();\n * },\n * componentDidMount: function() {\n * this.refs.custom.initialize();\n * }\n * });\n *\n * Refs should rarely be used. When refs are used, they should only be done to\n * control data that is not handled by React's data flow.\n *\n * @class ReactOwner\n */\nvar ReactOwner = {\n\n /**\n * @param {?object} object\n * @return {boolean} True if `object` is a valid owner.\n * @final\n */\n isValidOwner: function(object) {\n return !!(\n object &&\n typeof object.attachRef === 'function' &&\n typeof object.detachRef === 'function'\n );\n },\n\n /**\n * Adds a component by ref to an owner component.\n *\n * @param {ReactComponent} component Component to reference.\n * @param {string} ref Name by which to refer to the component.\n * @param {ReactOwner} owner Component on which to record the ref.\n * @final\n * @internal\n */\n addComponentAsRefTo: function(component, ref, owner) {\n invariant(\n ReactOwner.isValidOwner(owner),\n 'addComponentAsRefTo(...): Only a ReactOwner can have refs.'\n );\n owner.attachRef(ref, component);\n },\n\n /**\n * Removes a component by ref from an owner component.\n *\n * @param {ReactComponent} component Component to dereference.\n * @param {string} ref Name of the ref to remove.\n * @param {ReactOwner} owner Component on which the ref is recorded.\n * @final\n * @internal\n */\n removeComponentAsRefFrom: function(component, ref, owner) {\n invariant(\n ReactOwner.isValidOwner(owner),\n 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs.'\n );\n // Check that `component` is still the current ref because we do not want to\n // detach the ref if another component stole it.\n if (owner.refs[ref] === component) {\n owner.detachRef(ref);\n }\n },\n\n /**\n * A ReactComponent must mix this in to have refs.\n *\n * @lends {ReactOwner.prototype}\n */\n Mixin: {\n\n /**\n * Lazily allocates the refs object and stores `component` as `ref`.\n *\n * @param {string} ref Reference name.\n * @param {component} component Component to store as `ref`.\n * @final\n * @private\n */\n attachRef: function(ref, component) {\n invariant(\n component.isOwnedBy(this),\n 'attachRef(%s, ...): Only a component\\'s owner can store a ref to it.',\n ref\n );\n var refs = this.refs || (this.refs = {});\n refs[ref] = component;\n },\n\n /**\n * Detaches a reference name.\n *\n * @param {string} ref Name to dereference.\n * @final\n * @private\n */\n detachRef: function(ref) {\n delete this.refs[ref];\n }\n\n }\n\n};\n\nmodule.exports = ReactOwner;\n\nrequire(\"./mock-modules\").register(\"ReactOwner\", module);\n",
"ReactComponentEnvironment":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactComponentEnvironment\n */\n\nvar ReactComponentBrowserEnvironment =\n require(\"./ReactComponentBrowserEnvironment\");\n\nvar ReactComponentEnvironment = ReactComponentBrowserEnvironment;\n\nmodule.exports = ReactComponentEnvironment;\n\nrequire(\"./mock-modules\").register(\"ReactComponentEnvironment\", module);\n",
"ReactPropTransferer":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactPropTransferer\n */\n\n\"use strict\";\n\nvar emptyFunction = require(\"./emptyFunction\");\nvar invariant = require(\"./invariant\");\nvar joinClasses = require(\"./joinClasses\");\nvar merge = require(\"./merge\");\n\n/**\n * Creates a transfer strategy that will merge prop values using the supplied\n * `mergeStrategy`. If a prop was previously unset, this just sets it.\n *\n * @param {function} mergeStrategy\n * @return {function}\n */\nfunction createTransferStrategy(mergeStrategy) {\n return function(props, key, value) {\n if (!props.hasOwnProperty(key)) {\n props[key] = value;\n } else {\n props[key] = mergeStrategy(props[key], value);\n }\n };\n}\n\n/**\n * Transfer strategies dictate how props are transferred by `transferPropsTo`.\n */\nvar TransferStrategies = {\n /**\n * Never transfer `children`.\n */\n children: emptyFunction,\n /**\n * Transfer the `className` prop by merging them.\n */\n className: createTransferStrategy(joinClasses),\n /**\n * Never transfer the `ref` prop.\n */\n ref: emptyFunction,\n /**\n * Transfer the `style` prop (which is an object) by merging them.\n */\n style: createTransferStrategy(merge)\n};\n\n/**\n * ReactPropTransferer are capable of transferring props to another component\n * using a `transferPropsTo` method.\n *\n * @class ReactPropTransferer\n */\nvar ReactPropTransferer = {\n\n TransferStrategies: TransferStrategies,\n\n /**\n * @lends {ReactPropTransferer.prototype}\n */\n Mixin: {\n\n /**\n * Transfer props from this component to a target component.\n *\n * Props that do not have an explicit transfer strategy will be transferred\n * only if the target component does not already have the prop set.\n *\n * This is usually used to pass down props to a returned root component.\n *\n * @param {ReactComponent} component Component receiving the properties.\n * @return {ReactComponent} The supplied `component`.\n * @final\n * @protected\n */\n transferPropsTo: function(component) {\n invariant(\n component.props.__owner__ === this,\n '%s: You can\\'t call transferPropsTo() on a component that you ' +\n 'don\\'t own, %s. This usually means you are calling ' +\n 'transferPropsTo() on a component passed in as props or children.',\n this.constructor.displayName,\n component.constructor.displayName\n );\n\n var props = {};\n for (var thatKey in component.props) {\n if (component.props.hasOwnProperty(thatKey)) {\n props[thatKey] = component.props[thatKey];\n }\n }\n for (var thisKey in this.props) {\n if (!this.props.hasOwnProperty(thisKey)) {\n continue;\n }\n var transferStrategy = TransferStrategies[thisKey];\n if (transferStrategy) {\n transferStrategy(props, thisKey, this.props[thisKey]);\n } else if (!props.hasOwnProperty(thisKey)) {\n props[thisKey] = this.props[thisKey];\n }\n }\n component.props = props;\n return component;\n }\n\n }\n\n};\n\nmodule.exports = ReactPropTransferer;\n\nrequire(\"./mock-modules\").register(\"ReactPropTransferer\", module);\n",
"objMap":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule objMap\n */\n\n\"use strict\";\n\n/**\n * For each key/value pair, invokes callback func and constructs a resulting\n * object which contains, for every key in obj, values that are the result of\n * of invoking the function:\n *\n * func(value, key, iteration)\n *\n * @param {?object} obj Object to map keys over\n * @param {function} func Invoked for each key/val pair.\n * @param {?*} context\n * @return {?object} Result of mapping or null if obj is falsey\n */\nfunction objMap(obj, func, context) {\n if (!obj) {\n return null;\n }\n var i = 0;\n var ret = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n ret[key] = func.call(context, obj[key], key, i++);\n }\n }\n return ret;\n}\n\nmodule.exports = objMap;\n\nrequire(\"./mock-modules\").register(\"objMap\", module);\n",
"createObjectFrom":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule createObjectFrom\n */\n\n/**\n * Construct an object from an array of keys\n * and optionally specified value or list of values.\n *\n * >>> createObjectFrom(['a','b','c']);\n * {a: true, b: true, c: true}\n *\n * >>> createObjectFrom(['a','b','c'], false);\n * {a: false, b: false, c: false}\n *\n * >>> createObjectFrom(['a','b','c'], 'monkey');\n * {c:'monkey', b:'monkey' c:'monkey'}\n *\n * >>> createObjectFrom(['a','b','c'], [1,2,3]);\n * {a: 1, b: 2, c: 3}\n *\n * >>> createObjectFrom(['women', 'men'], [true, false]);\n * {women: true, men: false}\n *\n * @param Array list of keys\n * @param mixed optional value or value array. defaults true.\n * @returns object\n */\nfunction createObjectFrom(keys, values /* = true */) {\n if (true) {\n if (!Array.isArray(keys)) {\n throw new TypeError('Must pass an array of keys.');\n }\n }\n\n var object = {};\n var isArray = Array.isArray(values);\n if (typeof values == 'undefined') {\n values = true;\n }\n\n for (var ii = keys.length; ii--;) {\n object[keys[ii]] = isArray ? values[ii] : values;\n }\n return object;\n}\n\nmodule.exports = createObjectFrom;\n\nrequire(\"./mock-modules\").register(\"createObjectFrom\", module);\n",
"$":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule $\n * @typechecks\n */\n\nvar ge = require(\"./ge\");\nvar ex = require(\"./ex\");\n\n/**\n * Find a node by ID.\n *\n * If your application code depends on the existence of the element, use $,\n * which will throw if the element doesn't exist.\n *\n * If you're not sure whether or not the element exists, use ge instead, and\n * manually check for the element's existence in your application code.\n *\n * @param {string|DOMDocument|DOMElement|DOMTextNode|Comment} id\n * @return {DOMDocument|DOMElement|DOMTextNode|Comment}\n */\nfunction $(id) {\n var element = ge(id);\n if (!element) {\n throw new Error(ex(\n 'Tried to get element with id of \"%s\" but it is not present on the page.',\n id\n ));\n }\n return element;\n}\n\nmodule.exports = $;\n\nrequire(\"./mock-modules\").register(\"$\", module);\n",
"getReactRootElementInContainer":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getReactRootElementInContainer\n */\n\n\"use strict\";\n\n/**\n * @param {DOMElement} container DOM element that may contain a React component\n * @return {?*} DOM element that may have the reactRoot ID, or null.\n */\nfunction getReactRootElementInContainer(container) {\n return container && container.firstChild;\n}\n\nmodule.exports = getReactRootElementInContainer;\n\nrequire(\"./mock-modules\").register(\"getReactRootElementInContainer\", module);\n",
"nodeContains":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule nodeContains\n * @typechecks\n */\n\nvar isTextNode = require(\"./isTextNode\");\n\n/*jslint bitwise:true */\n\n/**\n * Checks if a given DOM node contains or is another DOM node.\n *\n * @param {?DOMNode} outerNode Outer DOM node.\n * @param {?DOMNode} innerNode Inner DOM node.\n * @return {boolean} True if `outerNode` contains or is `innerNode`.\n */\nfunction nodeContains(outerNode, innerNode) {\n if (!outerNode || !innerNode) {\n return false;\n } else if (outerNode === innerNode) {\n return true;\n } else if (isTextNode(outerNode)) {\n return false;\n } else if (isTextNode(innerNode)) {\n return nodeContains(outerNode, innerNode.parentNode);\n } else if (outerNode.contains) {\n return outerNode.contains(innerNode);\n } else if (outerNode.compareDocumentPosition) {\n return !!(outerNode.compareDocumentPosition(innerNode) & 16);\n } else {\n return false;\n }\n}\n\nmodule.exports = nodeContains;\n\nrequire(\"./mock-modules\").register(\"nodeContains\", module);\n",
"PooledClass":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule PooledClass\n */\n\n\"use strict\";\n\n/**\n * Static poolers. Several custom versions for each potential number of\n * arguments. A completely generic pooler is easy to implement, but would\n * require accessing the `arguments` object. In each of these, `this` refers to\n * the Class itself, not an instance. If any others are needed, simply add them\n * here, or in their own files.\n */\nvar oneArgumentPooler = function(copyFieldsFrom) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, copyFieldsFrom);\n return instance;\n } else {\n return new Klass(copyFieldsFrom);\n }\n};\n\nvar twoArgumentPooler = function(a1, a2) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, a1, a2);\n return instance;\n } else {\n return new Klass(a1, a2);\n }\n};\n\nvar threeArgumentPooler = function(a1, a2, a3) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, a1, a2, a3);\n return instance;\n } else {\n return new Klass(a1, a2, a3);\n }\n};\n\nvar fiveArgumentPooler = function(a1, a2, a3, a4, a5) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, a1, a2, a3, a4, a5);\n return instance;\n } else {\n return new Klass(a1, a2, a3, a4, a5);\n }\n};\n\nvar standardReleaser = function(instance) {\n var Klass = this;\n if (instance.destructor) {\n instance.destructor();\n }\n if (Klass.instancePool.length < Klass.poolSize) {\n Klass.instancePool.push(instance);\n }\n};\n\nvar DEFAULT_POOL_SIZE = 10;\nvar DEFAULT_POOLER = oneArgumentPooler;\n\n/**\n * Augments `CopyConstructor` to be a poolable class, augmenting only the class\n * itself (statically) not adding any prototypical fields. Any CopyConstructor\n * you give this may have a `poolSize` property, and will look for a\n * prototypical `destructor` on instances (optional).\n *\n * @param {Function} CopyConstructor Constructor that can be used to reset.\n * @param {Function} pooler Customizable pooler.\n */\nvar addPoolingTo = function(CopyConstructor, pooler) {\n var NewKlass = CopyConstructor;\n NewKlass.instancePool = [];\n NewKlass.getPooled = pooler || DEFAULT_POOLER;\n if (!NewKlass.poolSize) {\n NewKlass.poolSize = DEFAULT_POOL_SIZE;\n }\n NewKlass.release = standardReleaser;\n return NewKlass;\n};\n\nvar PooledClass = {\n addPoolingTo: addPoolingTo,\n oneArgumentPooler: oneArgumentPooler,\n twoArgumentPooler: twoArgumentPooler,\n threeArgumentPooler: threeArgumentPooler,\n fiveArgumentPooler: fiveArgumentPooler\n};\n\nmodule.exports = PooledClass;\n\nrequire(\"./mock-modules\").register(\"PooledClass\", module);\n",
"ReactInputSelection":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactInputSelection\n */\n\n\"use strict\";\n\nvar ReactDOMSelection = require(\"./ReactDOMSelection\");\n\nvar getActiveElement = require(\"./getActiveElement\");\nvar nodeContains = require(\"./nodeContains\");\n\nfunction isInDocument(node) {\n return nodeContains(document.documentElement, node);\n}\n\n/**\n * @ReactInputSelection: React input selection module. Based on Selection.js,\n * but modified to be suitable for react and has a couple of bug fixes (doesn't\n * assume buttons have range selections allowed).\n * Input selection module for React.\n */\nvar ReactInputSelection = {\n\n hasSelectionCapabilities: function(elem) {\n return elem && (\n (elem.nodeName === 'INPUT' && elem.type === 'text') ||\n elem.nodeName === 'TEXTAREA' ||\n elem.contentEditable === 'true'\n );\n },\n\n getSelectionInformation: function() {\n var focusedElem = getActiveElement();\n return {\n focusedElem: focusedElem,\n selectionRange:\n ReactInputSelection.hasSelectionCapabilities(focusedElem) ?\n ReactInputSelection.getSelection(focusedElem) :\n null\n };\n },\n\n /**\n * @restoreSelection: If any selection information was potentially lost,\n * restore it. This is useful when performing operations that could remove dom\n * nodes and place them back in, resulting in focus being lost.\n */\n restoreSelection: function(priorSelectionInformation) {\n var curFocusedElem = getActiveElement();\n var priorFocusedElem = priorSelectionInformation.focusedElem;\n var priorSelectionRange = priorSelectionInformation.selectionRange;\n if (curFocusedElem !== priorFocusedElem &&\n isInDocument(priorFocusedElem)) {\n if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {\n ReactInputSelection.setSelection(\n priorFocusedElem,\n priorSelectionRange\n );\n }\n priorFocusedElem.focus();\n }\n },\n\n /**\n * @getSelection: Gets the selection bounds of a focused textarea, input or\n * contentEditable node.\n * -@input: Look up selection bounds of this input\n * -@return {start: selectionStart, end: selectionEnd}\n */\n getSelection: function(input) {\n var selection;\n\n if ('selectionStart' in input) {\n // Modern browser with input or textarea.\n selection = {\n start: input.selectionStart,\n end: input.selectionEnd\n };\n } else if (document.selection && input.nodeName === 'INPUT') {\n // IE8 input.\n var range = document.selection.createRange();\n // There can only be one selection per document in IE, so it must\n // be in our element.\n if (range.parentElement() === input) {\n selection = {\n start: -range.moveStart('character', -input.value.length),\n end: -range.moveEnd('character', -input.value.length)\n };\n }\n } else {\n // Content editable or old IE textarea.\n selection = ReactDOMSelection.getOffsets(input);\n }\n\n return selection || {start: 0, end: 0};\n },\n\n /**\n * @setSelection: Sets the selection bounds of a textarea or input and focuses\n * the input.\n * -@input Set selection bounds of this input or textarea\n * -@offsets Object of same form that is returned from get*\n */\n setSelection: function(input, offsets) {\n var start = offsets.start;\n var end = offsets.end;\n if (typeof end === 'undefined') {\n end = start;\n }\n\n if ('selectionStart' in input) {\n input.selectionStart = start;\n input.selectionEnd = Math.min(end, input.value.length);\n } else if (document.selection && input.nodeName === 'INPUT') {\n var range = input.createTextRange();\n range.collapse(true);\n range.moveStart('character', start);\n range.moveEnd('character', end - start);\n range.select();\n } else {\n ReactDOMSelection.setOffsets(input, offsets);\n }\n }\n};\n\nmodule.exports = ReactInputSelection;\n\nrequire(\"./mock-modules\").register(\"ReactInputSelection\", module);\n",
"ReactMountReady":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactMountReady\n */\n\n\"use strict\";\n\nvar PooledClass = require(\"./PooledClass\");\n\nvar mixInto = require(\"./mixInto\");\n\n/**\n * A specialized pseudo-event module to help keep track of components waiting to\n * be notified when their DOM representations are available for use.\n *\n * This implements `PooledClass`, so you should never need to instantiate this.\n * Instead, use `ReactMountReady.getPooled()`.\n *\n * @param {?array<function>} initialCollection\n * @class ReactMountReady\n * @implements PooledClass\n * @internal\n */\nfunction ReactMountReady(initialCollection) {\n this._queue = initialCollection || null;\n}\n\nmixInto(ReactMountReady, {\n\n /**\n * Enqueues a callback to be invoked when `notifyAll` is invoked. This is used\n * to enqueue calls to `componentDidMount` and `componentDidUpdate`.\n *\n * @param {ReactComponent} component Component being rendered.\n * @param {function(DOMElement)} callback Invoked when `notifyAll` is invoked.\n * @internal\n */\n enqueue: function(component, callback) {\n this._queue = this._queue || [];\n this._queue.push({component: component, callback: callback});\n },\n\n /**\n * Invokes all enqueued callbacks and clears the queue. This is invoked after\n * the DOM representation of a component has been created or updated.\n *\n * @internal\n */\n notifyAll: function() {\n var queue = this._queue;\n if (queue) {\n this._queue = null;\n for (var i = 0, l = queue.length; i < l; i++) {\n var component = queue[i].component;\n var callback = queue[i].callback;\n callback.call(component, component.getDOMNode());\n }\n queue.length = 0;\n }\n },\n\n /**\n * Resets the internal queue.\n *\n * @internal\n */\n reset: function() {\n this._queue = null;\n },\n\n /**\n * `PooledClass` looks for this.\n */\n destructor: function() {\n this.reset();\n }\n\n});\n\nPooledClass.addPoolingTo(ReactMountReady);\n\nmodule.exports = ReactMountReady;\n\nrequire(\"./mock-modules\").register(\"ReactMountReady\", module);\n",
"ReactDOMForm":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMForm\n */\n\n\"use strict\";\n\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactDOM = require(\"./ReactDOM\");\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar EventConstants = require(\"./EventConstants\");\n\n// Store a reference to the <form> `ReactDOMComponent`.\nvar form = ReactDOM.form;\n\n/**\n * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need\n * to capture it on the <form> element itself. There are lots of hacks we could\n * do to accomplish this, but the most reliable is to make <form> a\n * composite component and use `componentDidMount` to attach the event handlers.\n */\nvar ReactDOMForm = ReactCompositeComponent.createClass({\n render: function() {\n // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,\n // `jshint` fails to parse JSX so in order for linting to work in the open\n // source repo, we need to just use `ReactDOM.form`.\n return this.transferPropsTo(form(null, this.props.children));\n },\n\n componentDidMount: function(node) {\n ReactEventEmitter.trapBubbledEvent(\n EventConstants.topLevelTypes.topSubmit,\n 'submit',\n node\n );\n }\n});\n\nmodule.exports = ReactDOMForm;\n\nrequire(\"./mock-modules\").register(\"ReactDOMForm\", module);\n",
"ReactDOMButton":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMButton\n */\n\n\"use strict\";\n\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactDOM = require(\"./ReactDOM\");\n\nvar keyMirror = require(\"./keyMirror\");\n\n// Store a reference to the <button> `ReactDOMComponent`.\nvar button = ReactDOM.button;\n\nvar mouseListenerNames = keyMirror({\n onClick: true,\n onDoubleClick: true,\n onMouseDown: true,\n onMouseMove: true,\n onMouseUp: true,\n onClickCapture: true,\n onDoubleClickCapture: true,\n onMouseDownCapture: true,\n onMouseMoveCapture: true,\n onMouseUpCapture: true\n});\n\n/**\n * Implements a <button> native component that does not receive mouse events\n * when `disabled` is set.\n */\nvar ReactDOMButton = ReactCompositeComponent.createClass({\n\n render: function() {\n var props = {};\n\n // Copy the props; except the mouse listeners if we're disabled\n for (var key in this.props) {\n if (this.props.hasOwnProperty(key) &&\n (!this.props.disabled || !mouseListenerNames[key])) {\n props[key] = this.props[key];\n }\n }\n\n return button(props, this.props.children);\n }\n\n});\n\nmodule.exports = ReactDOMButton;\n\nrequire(\"./mock-modules\").register(\"ReactDOMButton\", module);\n",
"ReactDOMInput":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMInput\n */\n\n\"use strict\";\n\nvar DOMPropertyOperations = require(\"./DOMPropertyOperations\");\nvar LinkedValueMixin = require(\"./LinkedValueMixin\");\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactDOM = require(\"./ReactDOM\");\nvar ReactMount = require(\"./ReactMount\");\n\nvar invariant = require(\"./invariant\");\nvar merge = require(\"./merge\");\n\n// Store a reference to the <input> `ReactDOMComponent`.\nvar input = ReactDOM.input;\n\nvar instancesByReactID = {};\n\n/**\n * Implements an <input> native component that allows setting these optional\n * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.\n *\n * If `checked` or `value` are not supplied (or null/undefined), user actions\n * that affect the checked state or value will trigger updates to the element.\n *\n * If they are supplied (and not null/undefined), the rendered element will not\n * trigger updates to the element. Instead, the props must change in order for\n * the rendered element to be updated.\n *\n * The rendered element will be initialized as unchecked (or `defaultChecked`)\n * with an empty value (or `defaultValue`).\n *\n * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html\n */\nvar ReactDOMInput = ReactCompositeComponent.createClass({\n mixins: [LinkedValueMixin],\n\n getInitialState: function() {\n var defaultValue = this.props.defaultValue;\n return {\n checked: this.props.defaultChecked || false,\n value: defaultValue != null ? defaultValue : ''\n };\n },\n\n shouldComponentUpdate: function() {\n // Defer any updates to this component during the `onChange` handler.\n return !this._isChanging;\n },\n\n render: function() {\n // Clone `this.props` so we don't mutate the input.\n var props = merge(this.props);\n\n props.defaultChecked = null;\n props.defaultValue = null;\n props.checked =\n this.props.checked != null ? this.props.checked : this.state.checked;\n\n var value = this.getValue();\n props.value = value != null ? value : this.state.value;\n\n props.onChange = this._handleChange;\n\n return input(props, this.props.children);\n },\n\n componentDidMount: function(rootNode) {\n var id = ReactMount.getID(rootNode);\n instancesByReactID[id] = this;\n },\n\n componentWillUnmount: function() {\n var rootNode = this.getDOMNode();\n var id = ReactMount.getID(rootNode);\n delete instancesByReactID[id];\n },\n\n componentDidUpdate: function(prevProps, prevState, rootNode) {\n if (this.props.checked != null) {\n DOMPropertyOperations.setValueForProperty(\n rootNode,\n 'checked',\n this.props.checked || false\n );\n }\n\n var value = this.getValue();\n if (value != null) {\n // Cast `value` to a string to ensure the value is set correctly. While\n // browsers typically do this as necessary, jsdom doesn't.\n DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);\n }\n },\n\n _handleChange: function(event) {\n var returnValue;\n var onChange = this.getOnChange();\n if (onChange) {\n this._isChanging = true;\n returnValue = onChange(event);\n this._isChanging = false;\n }\n this.setState({\n checked: event.target.checked,\n value: event.target.value\n });\n\n var name = this.props.name;\n if (this.props.type === 'radio' && name != null) {\n var rootNode = this.getDOMNode();\n // If `rootNode.form` was non-null, then we could try `form.elements`,\n // but that sometimes behaves strangely in IE8. We could also try using\n // `form.getElementsByName`, but that will only return direct children\n // and won't include inputs that use the HTML5 `form=` attribute. Since\n // the input might not even be in a form, let's just use the global\n // `getElementsByName` to ensure we don't miss anything.\n var group = document.getElementsByName(name);\n for (var i = 0, groupLen = group.length; i < groupLen; i++) {\n var otherNode = group[i];\n if (otherNode === rootNode ||\n otherNode.nodeName !== 'INPUT' || otherNode.type !== 'radio' ||\n otherNode.form !== rootNode.form) {\n continue;\n }\n var otherID = ReactMount.getID(otherNode);\n invariant(\n otherID,\n 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +\n 'same `name` is not supported.'\n );\n var otherInstance = instancesByReactID[otherID];\n invariant(\n otherInstance,\n 'ReactDOMInput: Unknown radio button ID %s.',\n otherID\n );\n // In some cases, this will actually change the `checked` state value.\n // In other cases, there's no change but this forces a reconcile upon\n // which componentDidUpdate will reset the DOM property to whatever it\n // should be.\n otherInstance.setState({\n checked: false\n });\n }\n }\n\n return returnValue;\n }\n\n});\n\nmodule.exports = ReactDOMInput;\n\nrequire(\"./mock-modules\").register(\"ReactDOMInput\", module);\n",
"ReactDOMOption":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMOption\n */\n\n\"use strict\";\n\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactDOM = require(\"./ReactDOM\");\n\n// Store a reference to the <option> `ReactDOMComponent`.\nvar option = ReactDOM.option;\n\n/**\n * Implements an <option> native component that warns when `selected` is set.\n */\nvar ReactDOMOption = ReactCompositeComponent.createClass({\n\n componentWillMount: function() {\n // TODO (yungsters): Remove support for `selected` in <option>.\n if (this.props.selected != null) {\n if (true) {\n console.warn(\n 'Use the `defaultValue` or `value` props on <select> instead of ' +\n 'setting `selected` on <option>.'\n );\n }\n }\n },\n\n render: function() {\n return option(this.props, this.props.children);\n }\n\n});\n\nmodule.exports = ReactDOMOption;\n\nrequire(\"./mock-modules\").register(\"ReactDOMOption\", module);\n",
"ReactDOMSelect":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMSelect\n */\n\n\"use strict\";\n\nvar LinkedValueMixin = require(\"./LinkedValueMixin\");\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactDOM = require(\"./ReactDOM\");\n\nvar invariant = require(\"./invariant\");\nvar merge = require(\"./merge\");\n\n// Store a reference to the <select> `ReactDOMComponent`.\nvar select = ReactDOM.select;\n\n/**\n * Validation function for `value` and `defaultValue`.\n * @private\n */\nfunction selectValueType(props, propName, componentName) {\n if (props[propName] == null) {\n return;\n }\n if (props.multiple) {\n invariant(\n Array.isArray(props[propName]),\n 'The `%s` prop supplied to <select> must be an array if `multiple` is ' +\n 'true.',\n propName\n );\n } else {\n invariant(\n !Array.isArray(props[propName]),\n 'The `%s` prop supplied to <select> must be a scalar value if ' +\n '`multiple` is false.',\n propName\n );\n }\n}\n\n/**\n * If `value` is supplied, updates <option> elements on mount and update.\n * @private\n */\nfunction updateOptions() {\n /*jshint validthis:true */\n var propValue = this.getValue();\n var value = propValue != null ? propValue : this.state.value;\n var options = this.getDOMNode().options;\n var selectedValue = '' + value;\n\n for (var i = 0, l = options.length; i < l; i++) {\n var selected = this.props.multiple ?\n selectedValue.indexOf(options[i].value) >= 0 :\n selected = options[i].value === selectedValue;\n\n if (selected !== options[i].selected) {\n options[i].selected = selected;\n }\n }\n}\n\n/**\n * Implements a <select> native component that allows optionally setting the\n * props `value` and `defaultValue`. If `multiple` is false, the prop must be a\n * string. If `multiple` is true, the prop must be an array of strings.\n *\n * If `value` is not supplied (or null/undefined), user actions that change the\n * selected option will trigger updates to the rendered options.\n *\n * If it is supplied (and not null/undefined), the rendered options will not\n * update in response to user actions. Instead, the `value` prop must change in\n * order for the rendered options to update.\n *\n * If `defaultValue` is provided, any options with the supplied values will be\n * selected.\n */\nvar ReactDOMSelect = ReactCompositeComponent.createClass({\n mixins: [LinkedValueMixin],\n\n propTypes: {\n defaultValue: selectValueType,\n value: selectValueType\n },\n\n getInitialState: function() {\n return {value: this.props.defaultValue || (this.props.multiple ? [] : '')};\n },\n\n componentWillReceiveProps: function(nextProps) {\n if (!this.props.multiple && nextProps.multiple) {\n this.setState({value: [this.state.value]});\n } else if (this.props.multiple && !nextProps.multiple) {\n this.setState({value: this.state.value[0]});\n }\n },\n\n shouldComponentUpdate: function() {\n // Defer any updates to this component during the `onChange` handler.\n return !this._isChanging;\n },\n\n render: function() {\n // Clone `this.props` so we don't mutate the input.\n var props = merge(this.props);\n\n props.onChange = this._handleChange;\n props.value = null;\n\n return select(props, this.props.children);\n },\n\n componentDidMount: updateOptions,\n\n componentDidUpdate: updateOptions,\n\n _handleChange: function(event) {\n var returnValue;\n var onChange = this.getOnChange();\n if (onChange) {\n this._isChanging = true;\n returnValue = onChange(event);\n this._isChanging = false;\n }\n\n var selectedValue;\n if (this.props.multiple) {\n selectedValue = [];\n var options = event.target.options;\n for (var i = 0, l = options.length; i < l; i++) {\n if (options[i].selected) {\n selectedValue.push(options[i].value);\n }\n }\n } else {\n selectedValue = event.target.value;\n }\n\n this.setState({value: selectedValue});\n return returnValue;\n }\n\n});\n\nmodule.exports = ReactDOMSelect;\n\nrequire(\"./mock-modules\").register(\"ReactDOMSelect\", module);\n",
"ReactDOMTextarea":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMTextarea\n */\n\n\"use strict\";\n\nvar DOMPropertyOperations = require(\"./DOMPropertyOperations\");\nvar LinkedValueMixin = require(\"./LinkedValueMixin\");\nvar ReactCompositeComponent = require(\"./ReactCompositeComponent\");\nvar ReactDOM = require(\"./ReactDOM\");\n\nvar invariant = require(\"./invariant\");\nvar merge = require(\"./merge\");\n\n// Store a reference to the <textarea> `ReactDOMComponent`.\nvar textarea = ReactDOM.textarea;\n\n/**\n * Implements a <textarea> native component that allows setting `value`, and\n * `defaultValue`. This differs from the traditional DOM API because value is\n * usually set as PCDATA children.\n *\n * If `value` is not supplied (or null/undefined), user actions that affect the\n * value will trigger updates to the element.\n *\n * If `value` is supplied (and not null/undefined), the rendered element will\n * not trigger updates to the element. Instead, the `value` prop must change in\n * order for the rendered element to be updated.\n *\n * The rendered element will be initialized with an empty value, the prop\n * `defaultValue` if specified, or the children content (deprecated).\n */\nvar ReactDOMTextarea = ReactCompositeComponent.createClass({\n mixins: [LinkedValueMixin],\n\n getInitialState: function() {\n var defaultValue = this.props.defaultValue;\n // TODO (yungsters): Remove support for children content in <textarea>.\n var children = this.props.children;\n if (children != null) {\n if (true) {\n console.warn(\n 'Use the `defaultValue` or `value` props instead of setting ' +\n 'children on <textarea>.'\n );\n }\n invariant(\n defaultValue == null,\n 'If you supply `defaultValue` on a <textarea>, do not pass children.'\n );\n if (Array.isArray(children)) {\n invariant(\n children.length <= 1,\n '<textarea> can only have at most one child.'\n );\n children = children[0];\n }\n\n defaultValue = '' + children;\n }\n if (defaultValue == null) {\n defaultValue = '';\n }\n var value = this.getValue();\n return {\n // We save the initial value so that `ReactDOMComponent` doesn't update\n // `textContent` (unnecessary since we update value).\n // The initial value can be a boolean or object so that's why it's\n // forced to be a string.\n initialValue: '' + (value != null ? value : defaultValue),\n value: defaultValue\n };\n },\n\n shouldComponentUpdate: function() {\n // Defer any updates to this component during the `onChange` handler.\n return !this._isChanging;\n },\n\n render: function() {\n // Clone `this.props` so we don't mutate the input.\n var props = merge(this.props);\n var value = this.getValue();\n\n invariant(\n props.dangerouslySetInnerHTML == null,\n '`dangerouslySetInnerHTML` does not make sense on <textarea>.'\n );\n\n props.defaultValue = null;\n props.value = value != null ? value : this.state.value;\n props.onChange = this._handleChange;\n\n // Always set children to the same thing. In IE9, the selection range will\n // get reset if `textContent` is mutated.\n return textarea(props, this.state.initialValue);\n },\n\n componentDidUpdate: function(prevProps, prevState, rootNode) {\n var value = this.getValue();\n if (value != null) {\n // Cast `value` to a string to ensure the value is set correctly. While\n // browsers typically do this as necessary, jsdom doesn't.\n DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);\n }\n },\n\n _handleChange: function(event) {\n var returnValue;\n var onChange = this.getOnChange();\n if (onChange) {\n this._isChanging = true;\n returnValue = onChange(event);\n this._isChanging = false;\n }\n this.setState({value: event.target.value});\n return returnValue;\n }\n\n});\n\nmodule.exports = ReactDOMTextarea;\n\nrequire(\"./mock-modules\").register(\"ReactDOMTextarea\", module);\n",
"ReactEventTopLevelCallback":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactEventTopLevelCallback\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ReactEventEmitter = require(\"./ReactEventEmitter\");\nvar ReactMount = require(\"./ReactMount\");\n\nvar getEventTarget = require(\"./getEventTarget\");\n\n/**\n * @type {boolean}\n * @private\n */\nvar _topLevelListenersEnabled = true;\n\n/**\n * Top-level callback creator used to implement event handling using delegation.\n * This is used via dependency injection.\n */\nvar ReactEventTopLevelCallback = {\n\n /**\n * Sets whether or not any created callbacks should be enabled.\n *\n * @param {boolean} enabled True if callbacks should be enabled.\n */\n setEnabled: function(enabled) {\n _topLevelListenersEnabled = !!enabled;\n },\n\n /**\n * @return {boolean} True if callbacks are enabled.\n */\n isEnabled: function() {\n return _topLevelListenersEnabled;\n },\n\n /**\n * Creates a callback for the supplied `topLevelType` that could be added as\n * a listener to the document. The callback computes a `topLevelTarget` which\n * should be the root node of a mounted React component where the listener\n * is attached.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @return {function} Callback for handling top-level events.\n */\n createTopLevelCallback: function(topLevelType) {\n return function(nativeEvent) {\n if (!_topLevelListenersEnabled) {\n return;\n }\n // TODO: Remove when synthetic events are ready, this is for IE<9.\n if (nativeEvent.srcElement &&\n nativeEvent.srcElement !== nativeEvent.target) {\n nativeEvent.target = nativeEvent.srcElement;\n }\n var topLevelTarget = ReactMount.getFirstReactDOM(\n getEventTarget(nativeEvent)\n ) || window;\n var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';\n ReactEventEmitter.handleTopLevel(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent\n );\n };\n }\n\n};\n\nmodule.exports = ReactEventTopLevelCallback;\n\nrequire(\"./mock-modules\").register(\"ReactEventTopLevelCallback\", module);\n",
"DefaultDOMPropertyConfig":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule DefaultDOMPropertyConfig\n */\n\n/*jslint bitwise: true*/\n\n\"use strict\";\n\nvar DOMProperty = require(\"./DOMProperty\");\n\nvar MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;\nvar MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;\nvar HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;\nvar HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;\n\nvar DefaultDOMPropertyConfig = {\n isCustomAttribute: RegExp.prototype.test.bind(\n /^(data|aria)-[a-z_][a-z\\d_.\\-]*$/\n ),\n Properties: {\n /**\n * Standard Properties\n */\n accept: null,\n accessKey: null,\n action: null,\n allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n allowTransparency: MUST_USE_ATTRIBUTE,\n alt: null,\n autoComplete: null,\n autoFocus: HAS_BOOLEAN_VALUE,\n autoPlay: HAS_BOOLEAN_VALUE,\n cellPadding: null,\n cellSpacing: null,\n charSet: MUST_USE_ATTRIBUTE,\n checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n className: MUST_USE_PROPERTY,\n colSpan: null,\n content: null,\n contentEditable: null,\n contextMenu: MUST_USE_ATTRIBUTE,\n controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n data: null, // For `<object />` acts as `src`.\n dateTime: MUST_USE_ATTRIBUTE,\n dir: null,\n disabled: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n draggable: null,\n encType: null,\n form: MUST_USE_ATTRIBUTE,\n frameBorder: MUST_USE_ATTRIBUTE,\n height: MUST_USE_ATTRIBUTE,\n hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n href: null,\n htmlFor: null,\n httpEquiv: null,\n icon: null,\n id: MUST_USE_PROPERTY,\n label: null,\n lang: null,\n list: null,\n max: null,\n maxLength: MUST_USE_ATTRIBUTE,\n method: null,\n min: null,\n multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n name: null,\n pattern: null,\n placeholder: null,\n poster: null,\n preload: null,\n radioGroup: null,\n readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n rel: null,\n required: HAS_BOOLEAN_VALUE,\n role: MUST_USE_ATTRIBUTE,\n rowSpan: null,\n scrollLeft: MUST_USE_PROPERTY,\n scrollTop: MUST_USE_PROPERTY,\n selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n size: null,\n spellCheck: null,\n src: null,\n step: null,\n style: null,\n tabIndex: null,\n target: null,\n title: null,\n type: null,\n value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,\n width: MUST_USE_ATTRIBUTE,\n wmode: MUST_USE_ATTRIBUTE,\n\n /**\n * Non-standard Properties\n */\n autoCapitalize: null, // Supported in Mobile Safari for keyboard hints\n\n /**\n * SVG Properties\n */\n cx: MUST_USE_ATTRIBUTE,\n cy: MUST_USE_ATTRIBUTE,\n d: MUST_USE_ATTRIBUTE,\n fill: MUST_USE_ATTRIBUTE,\n fx: MUST_USE_ATTRIBUTE,\n fy: MUST_USE_ATTRIBUTE,\n gradientTransform: MUST_USE_ATTRIBUTE,\n gradientUnits: MUST_USE_ATTRIBUTE,\n offset: MUST_USE_ATTRIBUTE,\n points: MUST_USE_ATTRIBUTE,\n r: MUST_USE_ATTRIBUTE,\n rx: MUST_USE_ATTRIBUTE,\n ry: MUST_USE_ATTRIBUTE,\n spreadMethod: MUST_USE_ATTRIBUTE,\n stopColor: MUST_USE_ATTRIBUTE,\n stopOpacity: MUST_USE_ATTRIBUTE,\n stroke: MUST_USE_ATTRIBUTE,\n strokeLinecap: MUST_USE_ATTRIBUTE,\n strokeWidth: MUST_USE_ATTRIBUTE,\n transform: MUST_USE_ATTRIBUTE,\n version: MUST_USE_ATTRIBUTE,\n viewBox: MUST_USE_ATTRIBUTE,\n x1: MUST_USE_ATTRIBUTE,\n x2: MUST_USE_ATTRIBUTE,\n x: MUST_USE_ATTRIBUTE,\n y1: MUST_USE_ATTRIBUTE,\n y2: MUST_USE_ATTRIBUTE,\n y: MUST_USE_ATTRIBUTE\n },\n DOMAttributeNames: {\n className: 'class',\n gradientTransform: 'gradientTransform',\n gradientUnits: 'gradientUnits',\n htmlFor: 'for',\n spreadMethod: 'spreadMethod',\n stopColor: 'stop-color',\n stopOpacity: 'stop-opacity',\n strokeLinecap: 'stroke-linecap',\n strokeWidth: 'stroke-width',\n viewBox: 'viewBox'\n },\n DOMPropertyNames: {\n autoCapitalize: 'autocapitalize',\n autoComplete: 'autocomplete',\n autoFocus: 'autofocus',\n autoPlay: 'autoplay',\n encType: 'enctype',\n radioGroup: 'radiogroup',\n spellCheck: 'spellcheck'\n },\n DOMMutationMethods: {\n /**\n * Setting `className` to null may cause it to be set to the string \"null\".\n *\n * @param {DOMElement} node\n * @param {*} value\n */\n className: function(node, value) {\n node.className = value || '';\n }\n }\n};\n\nmodule.exports = DefaultDOMPropertyConfig;\n\nrequire(\"./mock-modules\").register(\"DefaultDOMPropertyConfig\", module);\n",
"CompositionEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule CompositionEventPlugin\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\nvar ReactInputSelection = require(\"./ReactInputSelection\");\nvar SyntheticCompositionEvent = require(\"./SyntheticCompositionEvent\");\n\nvar getTextContentAccessor = require(\"./getTextContentAccessor\");\nvar keyOf = require(\"./keyOf\");\n\nvar END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space\nvar START_KEYCODE = 229;\n\nvar useCompositionEvent = ExecutionEnvironment.canUseDOM &&\n 'CompositionEvent' in window;\nvar topLevelTypes = EventConstants.topLevelTypes;\nvar currentComposition = null;\n\n// Events and their corresponding property names.\nvar eventTypes = {\n compositionEnd: {\n phasedRegistrationNames: {\n bubbled: keyOf({onCompositionEnd: null}),\n captured: keyOf({onCompositionEndCapture: null})\n }\n },\n compositionStart: {\n phasedRegistrationNames: {\n bubbled: keyOf({onCompositionStart: null}),\n captured: keyOf({onCompositionStartCapture: null})\n }\n },\n compositionUpdate: {\n phasedRegistrationNames: {\n bubbled: keyOf({onCompositionUpdate: null}),\n captured: keyOf({onCompositionUpdateCapture: null})\n }\n }\n};\n\n/**\n * Translate native top level events into event types.\n *\n * @param {string} topLevelType\n * @return {object}\n */\nfunction getCompositionEventType(topLevelType) {\n switch (topLevelType) {\n case topLevelTypes.topCompositionStart:\n return eventTypes.compositionStart;\n case topLevelTypes.topCompositionEnd:\n return eventTypes.compositionEnd;\n case topLevelTypes.topCompositionUpdate:\n return eventTypes.compositionUpdate;\n }\n}\n\n/**\n * Does our fallback best-guess model think this event signifies that\n * composition has begun?\n *\n * @param {string} topLevelType\n * @param {object} nativeEvent\n * @return {boolean}\n */\nfunction isFallbackStart(topLevelType, nativeEvent) {\n return (\n topLevelType === topLevelTypes.topKeyDown &&\n nativeEvent.keyCode === START_KEYCODE\n );\n}\n\n/**\n * Does our fallback mode think that this event is the end of composition?\n *\n * @param {string} topLevelType\n * @param {object} nativeEvent\n * @return {boolean}\n */\nfunction isFallbackEnd(topLevelType, nativeEvent) {\n switch (topLevelType) {\n case topLevelTypes.topKeyUp:\n // Command keys insert or clear IME input.\n return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);\n case topLevelTypes.topKeyDown:\n // Expect IME keyCode on each keydown. If we get any other\n // code we must have exited earlier.\n return (nativeEvent.keyCode !== START_KEYCODE);\n case topLevelTypes.topKeyPress:\n case topLevelTypes.topMouseDown:\n case topLevelTypes.topBlur:\n // Events are not possible without cancelling IME.\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Helper class stores information about selection and document state\n * so we can figure out what changed at a later date.\n *\n * @param {DOMEventTarget} root\n */\nfunction FallbackCompositionState(root) {\n this.root = root;\n this.startSelection = ReactInputSelection.getSelection(root);\n this.startValue = this.getText();\n}\n\n/**\n * Get current text of input.\n *\n * @return {string}\n */\nFallbackCompositionState.prototype.getText = function() {\n return this.root.value || this.root[getTextContentAccessor()];\n};\n\n/**\n * Text that has changed since the start of composition.\n *\n * @return {string}\n */\nFallbackCompositionState.prototype.getData = function() {\n var endValue = this.getText();\n var prefixLength = this.startSelection.start;\n var suffixLength = this.startValue.length - this.startSelection.end;\n\n return endValue.substr(\n prefixLength,\n endValue.length - suffixLength - prefixLength\n );\n};\n\n/**\n * This plugin creates `onCompositionStart`, `onCompositionUpdate` and\n * `onCompositionEnd` events on inputs, textareas and contentEditable\n * nodes.\n */\nvar CompositionEventPlugin = {\n\n eventTypes: eventTypes,\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n\n var eventType;\n var data;\n\n if (useCompositionEvent) {\n eventType = getCompositionEventType(topLevelType);\n } else if (!currentComposition) {\n if (isFallbackStart(topLevelType, nativeEvent)) {\n eventType = eventTypes.start;\n currentComposition = new FallbackCompositionState(topLevelTarget);\n }\n } else if (isFallbackEnd(topLevelType, nativeEvent)) {\n eventType = eventTypes.compositionEnd;\n data = currentComposition.getData();\n currentComposition = null;\n }\n\n if (eventType) {\n var event = SyntheticCompositionEvent.getPooled(\n eventType,\n topLevelTargetID,\n nativeEvent\n );\n if (data) {\n // Inject data generated from fallback path into the synthetic event.\n // This matches the property of native CompositionEventInterface.\n event.data = data;\n }\n EventPropagators.accumulateTwoPhaseDispatches(event);\n return event;\n }\n }\n};\n\nmodule.exports = CompositionEventPlugin;\n\nrequire(\"./mock-modules\").register(\"CompositionEventPlugin\", module);\n",
"MobileSafariClickEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule MobileSafariClickEventPlugin\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\n\nvar emptyFunction = require(\"./emptyFunction\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\n/**\n * Mobile Safari does not fire properly bubble click events on non-interactive\n * elements, which means delegated click listeners do not fire. The workaround\n * for this bug involves attaching an empty click listener on the target node.\n *\n * This particular plugin works around the bug by attaching an empty click\n * listener on `touchstart` (which does fire on every element).\n */\nvar MobileSafariClickEventPlugin = {\n\n eventTypes: null,\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n if (topLevelType === topLevelTypes.topTouchStart) {\n var target = nativeEvent.target;\n if (target && !target.onclick) {\n target.onclick = emptyFunction;\n }\n }\n }\n\n};\n\nmodule.exports = MobileSafariClickEventPlugin;\n\nrequire(\"./mock-modules\").register(\"MobileSafariClickEventPlugin\", module);\n",
"SelectEventPlugin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SelectEventPlugin\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\nvar EventPluginHub = require(\"./EventPluginHub\");\nvar EventPropagators = require(\"./EventPropagators\");\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\nvar ReactInputSelection = require(\"./ReactInputSelection\");\nvar SyntheticEvent = require(\"./SyntheticEvent\");\n\nvar getActiveElement = require(\"./getActiveElement\");\nvar isEventSupported = require(\"./isEventSupported\");\nvar isTextInputElement = require(\"./isTextInputElement\");\nvar keyOf = require(\"./keyOf\");\nvar shallowEqual = require(\"./shallowEqual\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nvar eventTypes = {\n select: {\n phasedRegistrationNames: {\n bubbled: keyOf({onSelect: null}),\n captured: keyOf({onSelectCapture: null})\n }\n }\n};\n\nvar useSelectionChange = false;\nvar useSelect = false;\n\nif (ExecutionEnvironment.canUseDOM) {\n useSelectionChange = 'onselectionchange' in document;\n useSelect = isEventSupported('select');\n}\n\nvar activeElement = null;\nvar activeElementID = null;\nvar activeNativeEvent = null;\nvar lastSelection = null;\nvar mouseDown = false;\n\n/**\n * Get an object which is a unique representation of the current selection.\n *\n * The return value will not be consistent across nodes or browsers, but\n * two identical selections on the same node will return identical objects.\n *\n * @param {DOMElement} node\n * @param {object}\n */\nfunction getSelection(node) {\n if ('selectionStart' in node &&\n ReactInputSelection.hasSelectionCapabilities(node)) {\n return {\n start: node.selectionStart,\n end: node.selectionEnd\n };\n } else if (document.selection) {\n var range = document.selection.createRange();\n return {\n parentElement: range.parentElement(),\n text: range.text,\n top: range.boundingTop,\n left: range.boundingLeft\n };\n } else {\n var selection = window.getSelection();\n return {\n anchorNode: selection.anchorNode,\n anchorOffset: selection.anchorOffset,\n focusNode: selection.focusNode,\n focusOffset: selection.focusOffset\n };\n }\n}\n\n/**\n * Poll selection to see whether it's changed.\n *\n * @param {object} nativeEvent\n * @return {?SyntheticEvent}\n */\nfunction constructSelectEvent(nativeEvent) {\n // Ensure we have the right element, and that the user is not dragging a\n // selection (this matches native `select` event behavior).\n if (mouseDown || activeElement != getActiveElement()) {\n return;\n }\n\n // Only fire when selection has actually changed.\n var currentSelection = getSelection(activeElement);\n if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {\n lastSelection = currentSelection;\n\n var syntheticEvent = SyntheticEvent.getPooled(\n eventTypes.select,\n activeElementID,\n nativeEvent\n );\n\n syntheticEvent.type = 'select';\n syntheticEvent.target = activeElement;\n\n EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);\n\n return syntheticEvent;\n }\n}\n\n/**\n * Handle deferred event. And manually dispatch synthetic events.\n */\nfunction dispatchDeferredSelectEvent() {\n if (!activeNativeEvent) {\n return;\n }\n\n var syntheticEvent = constructSelectEvent(activeNativeEvent);\n activeNativeEvent = null;\n\n // Enqueue and process the abstract event manually.\n if (syntheticEvent) {\n EventPluginHub.enqueueEvents(syntheticEvent);\n EventPluginHub.processEventQueue();\n }\n}\n\n/**\n * This plugin creates an `onSelect` event that normalizes select events\n * across form elements.\n *\n * Supported elements are:\n * - input (see `isTextInputElement`)\n * - textarea\n * - contentEditable\n *\n * This differs from native browser implementations in the following ways:\n * - Fires on contentEditable fields as well as inputs.\n * - Fires for collapsed selection.\n * - Fires after user input.\n */\nvar SelectEventPlugin = {\n\n eventTypes: eventTypes,\n\n /**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {*} An accumulation of synthetic events.\n * @see {EventPluginHub.extractEvents}\n */\n extractEvents: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n\n switch (topLevelType) {\n // Track the input node that has focus.\n case topLevelTypes.topFocus:\n if (isTextInputElement(topLevelTarget) ||\n topLevelTarget.contentEditable === 'true') {\n activeElement = topLevelTarget;\n activeElementID = topLevelTargetID;\n lastSelection = null;\n }\n break;\n case topLevelTypes.topBlur:\n activeElement = null;\n activeElementID = null;\n lastSelection = null;\n break;\n\n // Don't fire the event while the user is dragging. This matches the\n // semantics of the native select event.\n case topLevelTypes.topMouseDown:\n mouseDown = true;\n break;\n case topLevelTypes.topMouseUp:\n mouseDown = false;\n return constructSelectEvent(nativeEvent);\n\n // Chrome and IE fire non-standard event when selection is changed (and\n // sometimes when it hasn't).\n case topLevelTypes.topSelectionChange:\n return constructSelectEvent(nativeEvent);\n\n // Firefox doesn't support selectionchange, so check selection status\n // after each key entry.\n case topLevelTypes.topKeyDown:\n if (!useSelectionChange) {\n activeNativeEvent = nativeEvent;\n setTimeout(dispatchDeferredSelectEvent, 0);\n }\n break;\n }\n }\n};\n\nmodule.exports = SelectEventPlugin;\n\nrequire(\"./mock-modules\").register(\"SelectEventPlugin\", module);\n",
"ReactDefaultBatchingStrategy":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDefaultBatchingStrategy\n */\n\n\"use strict\";\n\nvar ReactUpdates = require(\"./ReactUpdates\");\nvar Transaction = require(\"./Transaction\");\n\nvar emptyFunction = require(\"./emptyFunction\");\nvar mixInto = require(\"./mixInto\");\n\nvar RESET_BATCHED_UPDATES = {\n initialize: emptyFunction,\n close: function() {\n ReactDefaultBatchingStrategy.isBatchingUpdates = false;\n }\n};\n\nvar FLUSH_BATCHED_UPDATES = {\n initialize: emptyFunction,\n close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)\n};\n\nvar TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];\n\nfunction ReactDefaultBatchingStrategyTransaction() {\n this.reinitializeTransaction();\n}\n\nmixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin);\nmixInto(ReactDefaultBatchingStrategyTransaction, {\n getTransactionWrappers: function() {\n return TRANSACTION_WRAPPERS;\n }\n});\n\nvar transaction = new ReactDefaultBatchingStrategyTransaction();\n\nvar ReactDefaultBatchingStrategy = {\n isBatchingUpdates: false,\n\n /**\n * Call the provided function in a context within which calls to `setState`\n * and friends are batched such that components aren't updated unnecessarily.\n */\n batchedUpdates: function(callback, param) {\n var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;\n\n ReactDefaultBatchingStrategy.isBatchingUpdates = true;\n\n // The code is written this way to avoid extra allocations\n if (alreadyBatchingUpdates) {\n callback(param);\n } else {\n transaction.perform(callback, null, param);\n }\n }\n};\n\nmodule.exports = ReactDefaultBatchingStrategy;\n\nrequire(\"./mock-modules\").register(\"ReactDefaultBatchingStrategy\", module);\n",
"ReactDefaultPerf":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDefaultPerf\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar performanceNow = require(\"./performanceNow\");\n\nvar ReactDefaultPerf = {};\n\nif (true) {\n ReactDefaultPerf = {\n /**\n * Gets the stored information for a given object's function.\n *\n * @param {string} objName\n * @param {string} fnName\n * @return {?object}\n */\n getInfo: function(objName, fnName) {\n if (!this.info[objName] || !this.info[objName][fnName]) {\n return null;\n }\n return this.info[objName][fnName];\n },\n\n /**\n * Gets the logs pertaining to a given object's function.\n *\n * @param {string} objName\n * @param {string} fnName\n * @return {?array<object>}\n */\n getLogs: function(objName, fnName) {\n if (!this.getInfo(objName, fnName)) {\n return null;\n }\n return this.logs.filter(function(log) {\n return log.objName === objName && log.fnName === fnName;\n });\n },\n\n /**\n * Runs through the logs and builds an array of arrays, where each array\n * walks through the mounting/updating of each component underneath.\n *\n * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]'\n * @return {array<array>}\n */\n getRawRenderHistory: function(rootID) {\n var history = [];\n /**\n * Since logs are added after the method returns, the logs are in a sense\n * upside-down: the inner-most elements from mounting/updating are logged\n * first, and the last addition to the log is the top renderComponent.\n * Therefore, we flip the logs upside down for ease of processing, and\n * reverse the history array at the end so the earliest event has index 0.\n */\n var logs = this.logs.filter(function(log) {\n return log.reactID.indexOf(rootID) === 0;\n }).reverse();\n\n var subHistory = [];\n logs.forEach(function(log, i) {\n if (i && log.reactID === rootID && logs[i - 1].reactID !== rootID) {\n subHistory.length && history.push(subHistory);\n subHistory = [];\n }\n subHistory.push(log);\n });\n if (subHistory.length) {\n history.push(subHistory);\n }\n return history.reverse();\n },\n\n /**\n * Runs through the logs and builds an array of strings, where each string\n * is a multiline formatted way of walking through the mounting/updating\n * underneath.\n *\n * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]'\n * @return {array<string>}\n */\n getRenderHistory: function(rootID) {\n var history = this.getRawRenderHistory(rootID);\n\n return history.map(function(subHistory) {\n var headerString = (\n 'log# Component (execution time) [bloat from logging]\\n' +\n '================================================================\\n'\n );\n return headerString + subHistory.map(function(log) {\n // Add two spaces for every layer in the reactID.\n var indents = '\\t' + Array(log.reactID.split('.[').length).join(' ');\n var delta = _microTime(log.timing.delta);\n var bloat = _microTime(log.timing.timeToLog);\n\n return log.index + indents + log.name + ' (' + delta + 'ms)' +\n ' [' + bloat + 'ms]';\n }).join('\\n');\n });\n },\n\n /**\n * Print the render history from `getRenderHistory` using console.log.\n * This is currently the best way to display perf data from\n * any React component; working on that.\n *\n * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]'\n * @param {number} index\n */\n printRenderHistory: function(rootID, index) {\n var history = this.getRenderHistory(rootID);\n if (!history[index]) {\n console.warn(\n 'Index', index, 'isn\\'t available! ' +\n 'The render history is', history.length, 'long.'\n );\n return;\n }\n console.log(\n 'Loading render history #' + (index + 1) +\n ' of ' + history.length + ':\\n' + history[index]\n );\n },\n\n /**\n * Prints the heatmap legend to console, showing how the colors correspond\n * with render times. This relies on console.log styles.\n */\n printHeatmapLegend: function() {\n if (!this.options.heatmap.enabled) {\n return;\n }\n var max = this.info.React\n && this.info.React.renderComponent\n && this.info.React.renderComponent.max;\n if (max) {\n var logStr = 'Heatmap: ';\n for (var ii = 0; ii <= 10 * max; ii += max) {\n logStr += '%c ' + (Math.round(ii) / 10) + 'ms ';\n }\n console.log(\n logStr,\n 'background-color: hsla(100, 100%, 50%, 0.6);',\n 'background-color: hsla( 90, 100%, 50%, 0.6);',\n 'background-color: hsla( 80, 100%, 50%, 0.6);',\n 'background-color: hsla( 70, 100%, 50%, 0.6);',\n 'background-color: hsla( 60, 100%, 50%, 0.6);',\n 'background-color: hsla( 50, 100%, 50%, 0.6);',\n 'background-color: hsla( 40, 100%, 50%, 0.6);',\n 'background-color: hsla( 30, 100%, 50%, 0.6);',\n 'background-color: hsla( 20, 100%, 50%, 0.6);',\n 'background-color: hsla( 10, 100%, 50%, 0.6);',\n 'background-color: hsla( 0, 100%, 50%, 0.6);'\n );\n }\n },\n\n /**\n * Measure a given function with logging information, and calls a callback\n * if there is one.\n *\n * @param {string} objName\n * @param {string} fnName\n * @param {function} func\n * @return {function}\n */\n measure: function(objName, fnName, func) {\n var info = _getNewInfo(objName, fnName);\n\n var fnArgs = _getFnArguments(func);\n\n return function() {\n var timeBeforeFn = performanceNow();\n var fnReturn = func.apply(this, arguments);\n var timeAfterFn = performanceNow();\n\n /**\n * Hold onto arguments in a readable way: args[1] -> args.component.\n * args is also passed to the callback, so if you want to save an\n * argument in the log, do so in the callback.\n */\n var args = {};\n for (var i = 0; i < arguments.length; i++) {\n args[fnArgs[i]] = arguments[i];\n }\n\n var log = {\n index: ReactDefaultPerf.logs.length,\n fnName: fnName,\n objName: objName,\n timing: {\n before: timeBeforeFn,\n after: timeAfterFn,\n delta: timeAfterFn - timeBeforeFn\n }\n };\n\n ReactDefaultPerf.logs.push(log);\n\n /**\n * The callback gets:\n * - this (the component)\n * - the original method's arguments\n * - what the method returned\n * - the log object, and\n * - the wrapped method's info object.\n */\n var callback = _getCallback(objName, fnName);\n callback && callback(this, args, fnReturn, log, info);\n\n log.timing.timeToLog = performanceNow() - timeAfterFn;\n\n return fnReturn;\n };\n },\n\n /**\n * Holds information on wrapped objects/methods.\n * For instance, ReactDefaultPerf.info.React.renderComponent\n */\n info: {},\n\n /**\n * Holds all of the logs. Filter this to pull desired information.\n */\n logs: [],\n\n /**\n * Toggle settings for ReactDefaultPerf\n */\n options: {\n /**\n * The heatmap sets the background color of the React containers\n * according to how much total time has been spent rendering them.\n * The most temporally expensive component is set as pure red,\n * and the others are colored from green to red as a fraction\n * of that max component time.\n */\n heatmap: {\n enabled: true\n }\n }\n };\n\n /**\n * Gets a info area for a given object's function, adding a new one if\n * necessary.\n *\n * @param {string} objName\n * @param {string} fnName\n * @return {object}\n */\n var _getNewInfo = function(objName, fnName) {\n var info = ReactDefaultPerf.getInfo(objName, fnName);\n if (info) {\n return info;\n }\n ReactDefaultPerf.info[objName] = ReactDefaultPerf.info[objName] || {};\n\n return ReactDefaultPerf.info[objName][fnName] = {\n getLogs: function() {\n return ReactDefaultPerf.getLogs(objName, fnName);\n }\n };\n };\n\n /**\n * Gets a list of the argument names from a function's definition.\n * This is useful for storing arguments by their names within wrapFn().\n *\n * @param {function} fn\n * @return {array<string>}\n */\n var _getFnArguments = function(fn) {\n var STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\n var fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n fnStr = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'));\n return fnStr.match(/([^\\s,]+)/g);\n };\n\n /**\n * Store common callbacks within ReactDefaultPerf.\n *\n * @param {string} objName\n * @param {string} fnName\n * @return {?function}\n */\n var _getCallback = function(objName, fnName) {\n switch (objName + '.' + fnName) {\n case 'React.renderComponent':\n return _renderComponentCallback;\n case 'ReactDOMComponent.mountComponent':\n case 'ReactDOMComponent.updateComponent':\n return _nativeComponentCallback;\n case 'ReactCompositeComponent.mountComponent':\n case 'ReactCompositeComponent.updateComponent':\n return _compositeComponentCallback;\n default:\n return null;\n }\n };\n\n /**\n * Callback function for React.renderComponent\n *\n * @param {object} component\n * @param {object} args\n * @param {?object} fnReturn\n * @param {object} log\n * @param {object} info\n */\n var _renderComponentCallback =\n function(component, args, fnReturn, log, info) {\n log.name = args.nextComponent.constructor.displayName || '[unknown]';\n log.reactID = fnReturn._rootNodeID || null;\n\n if (ReactDefaultPerf.options.heatmap.enabled) {\n var container = args.container;\n if (!container.loggedByReactDefaultPerf) {\n container.loggedByReactDefaultPerf = true;\n info.components = info.components || [];\n info.components.push(container);\n }\n\n container.count = container.count || 0;\n container.count += log.timing.delta;\n info.max = info.max || 0;\n if (container.count > info.max) {\n info.max = container.count;\n info.components.forEach(function(component) {\n _setHue(component, 100 - 100 * component.count / info.max);\n });\n } else {\n _setHue(container, 100 - 100 * container.count / info.max);\n }\n }\n };\n\n /**\n * Callback function for ReactDOMComponent\n *\n * @param {object} component\n * @param {object} args\n * @param {?object} fnReturn\n * @param {object} log\n * @param {object} info\n */\n var _nativeComponentCallback =\n function(component, args, fnReturn, log, info) {\n log.name = component.tagName || '[unknown]';\n log.reactID = component._rootNodeID;\n };\n\n /**\n * Callback function for ReactCompositeComponent\n *\n * @param {object} component\n * @param {object} args\n * @param {?object} fnReturn\n * @param {object} log\n * @param {object} info\n */\n var _compositeComponentCallback =\n function(component, args, fnReturn, log, info) {\n log.name = component.constructor.displayName || '[unknown]';\n log.reactID = component._rootNodeID;\n };\n\n /**\n * Using the hsl() background-color attribute, colors an element.\n *\n * @param {DOMElement} el\n * @param {number} hue [0 for red, 120 for green, 240 for blue]\n */\n var _setHue = function(el, hue) {\n el.style.backgroundColor = 'hsla(' + hue + ', 100%, 50%, 0.6)';\n };\n\n /**\n * Round to the thousandth place.\n * @param {number} time\n * @return {number}\n */\n var _microTime = function(time) {\n return Math.round(time * 1000) / 1000;\n };\n}\n\nmodule.exports = ReactDefaultPerf;\n\nrequire(\"./mock-modules\").register(\"ReactDefaultPerf\", module);\n",
"ReactMultiChildUpdateTypes":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactMultiChildUpdateTypes\n */\n\nvar keyMirror = require(\"./keyMirror\");\n\n/**\n * When a component's children are updated, a series of update configuration\n * objects are created in order to batch and serialize the required changes.\n *\n * Enumerates all the possible types of update configurations.\n *\n * @internal\n */\nvar ReactMultiChildUpdateTypes = keyMirror({\n INSERT_MARKUP: null,\n MOVE_EXISTING: null,\n REMOVE_NODE: null,\n TEXT_CONTENT: null\n});\n\nmodule.exports = ReactMultiChildUpdateTypes;\n\nrequire(\"./mock-modules\").register(\"ReactMultiChildUpdateTypes\", module);\n",
"flattenChildren":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule flattenChildren\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\nvar traverseAllChildren = require(\"./traverseAllChildren\");\n\n/**\n * @param {function} traverseContext Context passed through traversal.\n * @param {?ReactComponent} child React child component.\n * @param {!string} name String name of key path to child.\n */\nfunction flattenSingleChildIntoContext(traverseContext, child, name) {\n // We found a component instance.\n var result = traverseContext;\n invariant(\n !result.hasOwnProperty(name),\n 'flattenChildren(...): Encountered two children with the same key, `%s`. ' +\n 'Children keys must be unique.',\n name\n );\n result[name] = child;\n}\n\n/**\n * Flattens children that are typically specified as `props.children`.\n * @return {!object} flattened children keyed by name.\n */\nfunction flattenChildren(children) {\n if (children == null) {\n return children;\n }\n var result = {};\n traverseAllChildren(children, flattenSingleChildIntoContext, result);\n return result;\n}\n\nmodule.exports = flattenChildren;\n\nrequire(\"./mock-modules\").register(\"flattenChildren\", module);\n",
"EventListener":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventListener\n */\n\n/**\n * Upstream version of event listener. Does not take into account specific\n * nature of platform.\n */\nvar EventListener = {\n /**\n * Listens to bubbled events on a DOM node.\n *\n * @param {Element} el DOM element to register listener on.\n * @param {string} handlerBaseName 'click'/'mouseover'\n * @param {Function!} cb Callback function\n */\n listen: function(el, handlerBaseName, cb) {\n if (el.addEventListener) {\n el.addEventListener(handlerBaseName, cb, false);\n } else if (el.attachEvent) {\n el.attachEvent('on' + handlerBaseName, cb);\n }\n },\n\n /**\n * Listens to captured events on a DOM node.\n *\n * @see `EventListener.listen` for params.\n * @throws Exception if addEventListener is not supported.\n */\n capture: function(el, handlerBaseName, cb) {\n if (!el.addEventListener) {\n if (true) {\n console.error(\n 'You are attempting to use addEventlistener ' +\n 'in a browser that does not support it support it.' +\n 'This likely means that you will not receive events that ' +\n 'your application relies on (such as scroll).');\n }\n return;\n } else {\n el.addEventListener(handlerBaseName, cb, true);\n }\n }\n};\n\nmodule.exports = EventListener;\n\nrequire(\"./mock-modules\").register(\"EventListener\", module);\n",
"ReactEventEmitterMixin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactEventEmitterMixin\n */\n\n\"use strict\";\n\nvar EventPluginHub = require(\"./EventPluginHub\");\nvar ReactUpdates = require(\"./ReactUpdates\");\n\nfunction runEventQueueInBatch(events) {\n EventPluginHub.enqueueEvents(events);\n EventPluginHub.processEventQueue();\n}\n\nvar ReactEventEmitterMixin = {\n /**\n * Whether or not `ensureListening` has been invoked.\n * @type {boolean}\n * @private\n */\n _isListening: false,\n\n /**\n * Function, must be implemented. Listens to events on the top level of the\n * application.\n *\n * @abstract\n *\n * listenAtTopLevel: null,\n */\n\n /**\n * Ensures that top-level event delegation listeners are installed.\n *\n * There are issues with listening to both touch events and mouse events on\n * the top-level, so we make the caller choose which one to listen to. (If\n * there's a touch top-level listeners, anchors don't receive clicks for some\n * reason, and only in some cases).\n *\n * @param {*} config Configuration passed through to `listenAtTopLevel`.\n */\n ensureListening: function(config) {\n if (!config.contentDocument._reactIsListening) {\n this.listenAtTopLevel(config.touchNotMouse, config.contentDocument);\n config.contentDocument._reactIsListening = true;\n }\n },\n\n /**\n * Streams a fired top-level event to `EventPluginHub` where plugins have the\n * opportunity to create `ReactEvent`s to be dispatched.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {object} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native environment event.\n */\n handleTopLevel: function(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent) {\n var events = EventPluginHub.extractEvents(\n topLevelType,\n topLevelTarget,\n topLevelTargetID,\n nativeEvent\n );\n\n // Event queue being processed in the same cycle allows `preventDefault`.\n ReactUpdates.batchedUpdates(runEventQueueInBatch, events);\n }\n};\n\nmodule.exports = ReactEventEmitterMixin;\n\nrequire(\"./mock-modules\").register(\"ReactEventEmitterMixin\", module);\n",
"ViewportMetrics":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ViewportMetrics\n */\n\n\"use strict\";\n\nvar ViewportMetrics = {\n\n currentScrollLeft: 0,\n\n currentScrollTop: 0,\n\n refreshScrollValues: function() {\n ViewportMetrics.currentScrollLeft =\n document.body.scrollLeft + document.documentElement.scrollLeft;\n ViewportMetrics.currentScrollTop =\n document.body.scrollTop + document.documentElement.scrollTop;\n }\n\n};\n\nmodule.exports = ViewportMetrics;\n\nrequire(\"./mock-modules\").register(\"ViewportMetrics\", module);\n",
"isEventSupported":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule isEventSupported\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar testNode, useHasFeature;\nif (ExecutionEnvironment.canUseDOM) {\n testNode = document.createElement('div');\n useHasFeature =\n document.implementation &&\n document.implementation.hasFeature &&\n // `hasFeature` always returns true in Firefox 19+.\n document.implementation.hasFeature('', '') !== true;\n}\n\n/**\n * Checks if an event is supported in the current execution environment.\n *\n * NOTE: This will not work correctly for non-generic events such as `change`,\n * `reset`, `load`, `error`, and `select`.\n *\n * Borrows from Modernizr.\n *\n * @param {string} eventNameSuffix Event name, e.g. \"click\".\n * @param {?boolean} capture Check if the capture phase is supported.\n * @return {boolean} True if the event is supported.\n * @internal\n * @license Modernizr 3.0.0pre (Custom Build) | MIT\n */\nfunction isEventSupported(eventNameSuffix, capture) {\n if (!testNode || (capture && !testNode.addEventListener)) {\n return false;\n }\n var element = document.createElement('div');\n\n var eventName = 'on' + eventNameSuffix;\n var isSupported = eventName in element;\n\n if (!isSupported) {\n element.setAttribute(eventName, 'return;');\n isSupported = typeof element[eventName] === 'function';\n if (typeof element[eventName] !== 'undefined') {\n element[eventName] = undefined;\n }\n element.removeAttribute(eventName);\n }\n\n if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {\n // This is the only way to test support for the `wheel` event in IE9+.\n isSupported = document.implementation.hasFeature('Events.wheel', '3.0');\n }\n\n element = null;\n return isSupported;\n}\n\nmodule.exports = isEventSupported;\n\nrequire(\"./mock-modules\").register(\"isEventSupported\", module);\n",
"DOMChildrenOperations":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule DOMChildrenOperations\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar Danger = require(\"./Danger\");\nvar ReactMultiChildUpdateTypes = require(\"./ReactMultiChildUpdateTypes\");\n\nvar getTextContentAccessor = require(\"./getTextContentAccessor\");\n\n/**\n * The DOM property to use when setting text content.\n *\n * @type {string}\n * @private\n */\nvar textContentAccessor = getTextContentAccessor() || 'NA';\n\n/**\n * Inserts `childNode` as a child of `parentNode` at the `index`.\n *\n * @param {DOMElement} parentNode Parent node in which to insert.\n * @param {DOMElement} childNode Child node to insert.\n * @param {number} index Index at which to insert the child.\n * @internal\n */\nfunction insertChildAt(parentNode, childNode, index) {\n var childNodes = parentNode.childNodes;\n if (childNodes[index] === childNode) {\n return;\n }\n // If `childNode` is already a child of `parentNode`, remove it so that\n // computing `childNodes[index]` takes into account the removal.\n if (childNode.parentNode === parentNode) {\n parentNode.removeChild(childNode);\n }\n if (index >= childNodes.length) {\n parentNode.appendChild(childNode);\n } else {\n parentNode.insertBefore(childNode, childNodes[index]);\n }\n}\n\n/**\n * Operations for updating with DOM children.\n */\nvar DOMChildrenOperations = {\n\n dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,\n\n /**\n * Updates a component's children by processing a series of updates. The\n * update configurations are each expected to have a `parentNode` property.\n *\n * @param {array<object>} updates List of update configurations.\n * @param {array<string>} markupList List of markup strings.\n * @internal\n */\n processUpdates: function(updates, markupList) {\n var update;\n // Mapping from parent IDs to initial child orderings.\n var initialChildren = null;\n // List of children that will be moved or removed.\n var updatedChildren = null;\n\n for (var i = 0; update = updates[i]; i++) {\n if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||\n update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {\n var updatedIndex = update.fromIndex;\n var updatedChild = update.parentNode.childNodes[updatedIndex];\n var parentID = update.parentID;\n\n initialChildren = initialChildren || {};\n initialChildren[parentID] = initialChildren[parentID] || [];\n initialChildren[parentID][updatedIndex] = updatedChild;\n\n updatedChildren = updatedChildren || [];\n updatedChildren.push(updatedChild);\n }\n }\n\n var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);\n\n // Remove updated children first so that `toIndex` is consistent.\n if (updatedChildren) {\n for (var j = 0; j < updatedChildren.length; j++) {\n updatedChildren[j].parentNode.removeChild(updatedChildren[j]);\n }\n }\n\n for (var k = 0; update = updates[k]; k++) {\n switch (update.type) {\n case ReactMultiChildUpdateTypes.INSERT_MARKUP:\n insertChildAt(\n update.parentNode,\n renderedMarkup[update.markupIndex],\n update.toIndex\n );\n break;\n case ReactMultiChildUpdateTypes.MOVE_EXISTING:\n insertChildAt(\n update.parentNode,\n initialChildren[update.parentID][update.fromIndex],\n update.toIndex\n );\n break;\n case ReactMultiChildUpdateTypes.TEXT_CONTENT:\n update.parentNode[textContentAccessor] = update.textContent;\n break;\n case ReactMultiChildUpdateTypes.REMOVE_NODE:\n // Already removed by the for-loop above.\n break;\n }\n }\n }\n\n};\n\nmodule.exports = DOMChildrenOperations;\n\nrequire(\"./mock-modules\").register(\"DOMChildrenOperations\", module);\n",
"getTextContentAccessor":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getTextContentAccessor\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar contentKey = null;\n\n/**\n * Gets the key used to access text content on a DOM node.\n *\n * @return {?string} Key used to access text content.\n * @internal\n */\nfunction getTextContentAccessor() {\n if (!contentKey && ExecutionEnvironment.canUseDOM) {\n contentKey = 'innerText' in document.createElement('div') ?\n 'innerText' :\n 'textContent';\n }\n return contentKey;\n}\n\nmodule.exports = getTextContentAccessor;\n\nrequire(\"./mock-modules\").register(\"getTextContentAccessor\", module);\n",
"EventPluginUtils":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventPluginUtils\n */\n\n\"use strict\";\n\nvar EventConstants = require(\"./EventConstants\");\n\nvar invariant = require(\"./invariant\");\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nfunction isEndish(topLevelType) {\n return topLevelType === topLevelTypes.topMouseUp ||\n topLevelType === topLevelTypes.topTouchEnd ||\n topLevelType === topLevelTypes.topTouchCancel;\n}\n\nfunction isMoveish(topLevelType) {\n return topLevelType === topLevelTypes.topMouseMove ||\n topLevelType === topLevelTypes.topTouchMove;\n}\nfunction isStartish(topLevelType) {\n return topLevelType === topLevelTypes.topMouseDown ||\n topLevelType === topLevelTypes.topTouchStart;\n}\n\nvar validateEventDispatches;\nif (true) {\n validateEventDispatches = function(event) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n\n var listenersIsArr = Array.isArray(dispatchListeners);\n var idsIsArr = Array.isArray(dispatchIDs);\n var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;\n var listenersLen = listenersIsArr ?\n dispatchListeners.length :\n dispatchListeners ? 1 : 0;\n\n invariant(\n idsIsArr === listenersIsArr && IDsLen === listenersLen,\n 'EventPluginUtils: Invalid `event`.'\n );\n };\n}\n\n/**\n * Invokes `cb(event, listener, id)`. Avoids using call if no scope is\n * provided. The `(listener,id)` pair effectively forms the \"dispatch\" but are\n * kept separate to conserve memory.\n */\nfunction forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (true) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}\n\n/**\n * Default implementation of PluginModule.executeDispatch().\n * @param {SyntheticEvent} SyntheticEvent to handle\n * @param {function} Application-level callback\n * @param {string} domID DOM id to pass to the callback.\n */\nfunction executeDispatch(event, listener, domID) {\n listener(event, domID);\n}\n\n/**\n * Standard/simple iteration through an event's collected dispatches.\n */\nfunction executeDispatchesInOrder(event, executeDispatch) {\n forEachEventDispatch(event, executeDispatch);\n event._dispatchListeners = null;\n event._dispatchIDs = null;\n}\n\n/**\n * Standard/simple iteration through an event's collected dispatches, but stops\n * at the first dispatch execution returning true, and returns that id.\n *\n * @return id of the first dispatch execution who's listener returns true, or\n * null if no listener returned true.\n */\nfunction executeDispatchesInOrderStopAtTrue(event) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (true) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n if (dispatchListeners[i](event, dispatchIDs[i])) {\n return dispatchIDs[i];\n }\n }\n } else if (dispatchListeners) {\n if (dispatchListeners(event, dispatchIDs)) {\n return dispatchIDs;\n }\n }\n return null;\n}\n\n/**\n * Execution of a \"direct\" dispatch - there must be at most one dispatch\n * accumulated on the event or it is considered an error. It doesn't really make\n * sense for an event with multiple dispatches (bubbled) to keep track of the\n * return values at each dispatch execution, but it does tend to make sense when\n * dealing with \"direct\" dispatches.\n *\n * @return The return value of executing the single dispatch.\n */\nfunction executeDirectDispatch(event) {\n if (true) {\n validateEventDispatches(event);\n }\n var dispatchListener = event._dispatchListeners;\n var dispatchID = event._dispatchIDs;\n invariant(\n !Array.isArray(dispatchListener),\n 'executeDirectDispatch(...): Invalid `event`.'\n );\n var res = dispatchListener ?\n dispatchListener(event, dispatchID) :\n null;\n event._dispatchListeners = null;\n event._dispatchIDs = null;\n return res;\n}\n\n/**\n * @param {SyntheticEvent} event\n * @return {bool} True iff number of dispatches accumulated is greater than 0.\n */\nfunction hasDispatches(event) {\n return !!event._dispatchListeners;\n}\n\n/**\n * General utilities that are useful in creating custom Event Plugins.\n */\nvar EventPluginUtils = {\n isEndish: isEndish,\n isMoveish: isMoveish,\n isStartish: isStartish,\n executeDispatchesInOrder: executeDispatchesInOrder,\n executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,\n executeDirectDispatch: executeDirectDispatch,\n hasDispatches: hasDispatches,\n executeDispatch: executeDispatch\n};\n\nmodule.exports = EventPluginUtils;\n\nrequire(\"./mock-modules\").register(\"EventPluginUtils\", module);\n",
"accumulate":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule accumulate\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\n/**\n * Accumulates items that must not be null or undefined.\n *\n * This is used to conserve memory by avoiding array allocations.\n *\n * @return {*|array<*>} An accumulation of items.\n */\nfunction accumulate(current, next) {\n invariant(\n next != null,\n 'accumulate(...): Accumulated items must be not be null or undefined.'\n );\n if (current == null) {\n return next;\n } else {\n // Both are not empty. Warning: Never call x.concat(y) when you are not\n // certain that x is an Array (x could be a string with concat method).\n var currentIsArray = Array.isArray(current);\n var nextIsArray = Array.isArray(next);\n if (currentIsArray) {\n return current.concat(next);\n } else {\n if (nextIsArray) {\n return [current].concat(next);\n } else {\n return [current, next];\n }\n }\n }\n}\n\nmodule.exports = accumulate;\n\nrequire(\"./mock-modules\").register(\"accumulate\", module);\n",
"forEachAccumulated":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule forEachAccumulated\n */\n\n\"use strict\";\n\n/**\n * @param {array} an \"accumulation\" of items which is either an Array or\n * a single item. Useful when paired with the `accumulate` module. This is a\n * simple utility that allows us to reason about a collection of items, but\n * handling the case when there is exactly one item (and we do not need to\n * allocate an array).\n */\nvar forEachAccumulated = function(arr, cb, scope) {\n if (Array.isArray(arr)) {\n arr.forEach(cb, scope);\n } else if (arr) {\n cb.call(scope, arr);\n }\n};\n\nmodule.exports = forEachAccumulated;\n\nrequire(\"./mock-modules\").register(\"forEachAccumulated\", module);\n",
"TouchEventUtils":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule TouchEventUtils\n */\n\nvar TouchEventUtils = {\n /**\n * Utility function for common case of extracting out the primary touch from a\n * touch event.\n * - `touchEnd` events usually do not have the `touches` property.\n * http://stackoverflow.com/questions/3666929/\n * mobile-sarai-touchend-event-not-firing-when-last-touch-is-removed\n *\n * @param {Event} nativeEvent Native event that may or may not be a touch.\n * @return {TouchesObject?} an object with pageX and pageY or null.\n */\n extractSingleTouch: function(nativeEvent) {\n var touches = nativeEvent.touches;\n var changedTouches = nativeEvent.changedTouches;\n var hasTouches = touches && touches.length > 0;\n var hasChangedTouches = changedTouches && changedTouches.length > 0;\n\n return !hasTouches && hasChangedTouches ? changedTouches[0] :\n hasTouches ? touches[0] :\n nativeEvent;\n }\n};\n\nmodule.exports = TouchEventUtils;\n\nrequire(\"./mock-modules\").register(\"TouchEventUtils\", module);\n",
"SyntheticUIEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticUIEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticEvent = require(\"./SyntheticEvent\");\n\n/**\n * @interface UIEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar UIEventInterface = {\n view: null,\n detail: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticEvent}\n */\nfunction SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);\n\nmodule.exports = SyntheticUIEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticUIEvent\", module);\n",
"CSSProperty":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule CSSProperty\n */\n\n\"use strict\";\n\n/**\n * CSS properties which accept numbers but are not in units of \"px\".\n */\nvar isUnitlessNumber = {\n fillOpacity: true,\n fontWeight: true,\n lineHeight: true,\n opacity: true,\n orphans: true,\n zIndex: true,\n zoom: true\n};\n\n/**\n * Most style properties can be unset by doing .style[prop] = '' but IE8\n * doesn't like doing that with shorthand properties so for the properties that\n * IE8 breaks on, which are listed here, we instead unset each of the\n * individual properties. See http://bugs.jquery.com/ticket/12385.\n * The 4-value 'clock' properties like margin, padding, border-width seem to\n * behave without any problems. Curiously, list-style works too without any\n * special prodding.\n */\nvar shorthandPropertyExpansions = {\n background: {\n backgroundImage: true,\n backgroundPosition: true,\n backgroundRepeat: true,\n backgroundColor: true\n },\n border: {\n borderWidth: true,\n borderStyle: true,\n borderColor: true\n },\n borderBottom: {\n borderBottomWidth: true,\n borderBottomStyle: true,\n borderBottomColor: true\n },\n borderLeft: {\n borderLeftWidth: true,\n borderLeftStyle: true,\n borderLeftColor: true\n },\n borderRight: {\n borderRightWidth: true,\n borderRightStyle: true,\n borderRightColor: true\n },\n borderTop: {\n borderTopWidth: true,\n borderTopStyle: true,\n borderTopColor: true\n },\n font: {\n fontStyle: true,\n fontVariant: true,\n fontWeight: true,\n fontSize: true,\n lineHeight: true,\n fontFamily: true\n }\n};\n\nvar CSSProperty = {\n isUnitlessNumber: isUnitlessNumber,\n shorthandPropertyExpansions: shorthandPropertyExpansions\n};\n\nmodule.exports = CSSProperty;\n\nrequire(\"./mock-modules\").register(\"CSSProperty\", module);\n",
"dangerousStyleValue":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule dangerousStyleValue\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar CSSProperty = require(\"./CSSProperty\");\n\n/**\n * Convert a value into the proper css writable value. The `styleName` name\n * name should be logical (no hyphens), as specified\n * in `CSSProperty.isUnitlessNumber`.\n *\n * @param {string} styleName CSS property name such as `topMargin`.\n * @param {*} value CSS property value such as `10px`.\n * @return {string} Normalized style value with dimensions applied.\n */\nfunction dangerousStyleValue(styleName, value) {\n // Note that we've removed escapeTextForBrowser() calls here since the\n // whole string will be escaped when the attribute is injected into\n // the markup. If you provide unsafe user data here they can inject\n // arbitrary CSS which may be problematic (I couldn't repro this):\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet\n // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/\n // This is not an XSS hole but instead a potential CSS injection issue\n // which has lead to a greater discussion about how we're going to\n // trust URLs moving forward. See #2115901\n\n var isEmpty = value == null || typeof value === 'boolean' || value === '';\n if (isEmpty) {\n return '';\n }\n\n var isNonNumeric = isNaN(value);\n if (isNonNumeric || value === 0 || CSSProperty.isUnitlessNumber[styleName]) {\n return '' + value; // cast to string\n }\n\n return value + 'px';\n}\n\nmodule.exports = dangerousStyleValue;\n\nrequire(\"./mock-modules\").register(\"dangerousStyleValue\", module);\n",
"hyphenate":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule hyphenate\n * @typechecks\n */\n\nvar _uppercasePattern = /([A-Z])/g;\n\n/**\n * Hyphenates a camelcased string, for example:\n *\n * > hyphenate('backgroundColor')\n * < \"background-color\"\n *\n * @param {string} string\n * @return {string}\n */\nfunction hyphenate(string) {\n return string.replace(_uppercasePattern, '-$1').toLowerCase();\n}\n\nmodule.exports = hyphenate;\n\nrequire(\"./mock-modules\").register(\"hyphenate\", module);\n",
"createNodesFromMarkup":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule createNodesFromMarkup\n * @typechecks\n */\n\n/*jslint evil: true, sub: true */\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar createArrayFrom = require(\"./createArrayFrom\");\nvar getMarkupWrap = require(\"./getMarkupWrap\");\nvar invariant = require(\"./invariant\");\n\n/**\n * Dummy container used to render all markup.\n */\nvar dummyNode =\n ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;\n\n/**\n * Pattern used by `getNodeName`.\n */\nvar nodeNamePattern = /^\\s*<(\\w+)/;\n\n/**\n * Extracts the `nodeName` of the first element in a string of markup.\n *\n * @param {string} markup String of markup.\n * @return {?string} Node name of the supplied markup.\n */\nfunction getNodeName(markup) {\n var nodeNameMatch = markup.match(nodeNamePattern);\n return nodeNameMatch && nodeNameMatch[1].toLowerCase();\n}\n\n/**\n * Creates an array containing the nodes rendered from the supplied markup. The\n * optionally supplied `handleScript` function will be invoked once for each\n * <script> element that is rendered. If no `handleScript` function is supplied,\n * an exception is thrown if any <script> elements are rendered.\n *\n * @param {string} markup A string of valid HTML markup.\n * @param {?function} handleScript Invoked once for each rendered <script>.\n * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.\n */\nfunction createNodesFromMarkup(markup, handleScript) {\n var node = dummyNode;\n invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized');\n var nodeName = getNodeName(markup);\n\n var wrap = nodeName && getMarkupWrap(nodeName);\n if (wrap) {\n node.innerHTML = wrap[1] + markup + wrap[2];\n\n var wrapDepth = wrap[0];\n while (wrapDepth--) {\n node = node.lastChild;\n }\n } else {\n node.innerHTML = markup;\n }\n\n var scripts = node.getElementsByTagName('script');\n if (scripts.length) {\n invariant(\n handleScript,\n 'createNodesFromMarkup(...): Unexpected <script> element rendered.'\n );\n createArrayFrom(scripts).forEach(handleScript);\n }\n\n var nodes = createArrayFrom(node.childNodes);\n while (node.lastChild) {\n node.removeChild(node.lastChild);\n }\n return nodes;\n}\n\nmodule.exports = createNodesFromMarkup;\n\nrequire(\"./mock-modules\").register(\"createNodesFromMarkup\", module);\n",
"getMarkupWrap":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getMarkupWrap\n */\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\nvar invariant = require(\"./invariant\");\n\n/**\n * Dummy container used to detect which wraps are necessary.\n */\nvar dummyNode =\n ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;\n\n/**\n * Some browsers cannot use `innerHTML` to render certain elements standalone,\n * so we wrap them, render the wrapped nodes, then extract the desired node.\n *\n * In IE8, certain elements cannot render alone, so wrap all elements ('*').\n */\nvar shouldWrap = {\n // Force wrapping for SVG elements because if they get created inside a <div>,\n // they will be initialized in the wrong namespace (and will not display).\n 'circle': true,\n 'g': true,\n 'line': true,\n 'path': true,\n 'polyline': true,\n 'rect': true,\n 'text': true\n};\n\nvar selectWrap = [1, '<select multiple=\"true\">', '</select>'];\nvar tableWrap = [1, '<table>', '</table>'];\nvar trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];\n\nvar svgWrap = [1, '<svg>', '</svg>'];\n\nvar markupWrap = {\n '*': [1, '?<div>', '</div>'],\n\n 'area': [1, '<map>', '</map>'],\n 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],\n 'legend': [1, '<fieldset>', '</fieldset>'],\n 'param': [1, '<object>', '</object>'],\n 'tr': [2, '<table><tbody>', '</tbody></table>'],\n\n 'optgroup': selectWrap,\n 'option': selectWrap,\n\n 'caption': tableWrap,\n 'colgroup': tableWrap,\n 'tbody': tableWrap,\n 'tfoot': tableWrap,\n 'thead': tableWrap,\n\n 'td': trWrap,\n 'th': trWrap,\n\n 'circle': svgWrap,\n 'g': svgWrap,\n 'line': svgWrap,\n 'path': svgWrap,\n 'polyline': svgWrap,\n 'rect': svgWrap,\n 'text': svgWrap\n};\n\n/**\n * Gets the markup wrap configuration for the supplied `nodeName`.\n *\n * NOTE: This lazily detects which wraps are necessary for the current browser.\n *\n * @param {string} nodeName Lowercase `nodeName`.\n * @return {?array} Markup wrap configuration, if applicable.\n */\nfunction getMarkupWrap(nodeName) {\n invariant(!!dummyNode, 'Markup wrapping node not initialized');\n if (!markupWrap.hasOwnProperty(nodeName)) {\n nodeName = '*';\n }\n if (!shouldWrap.hasOwnProperty(nodeName)) {\n if (nodeName === '*') {\n dummyNode.innerHTML = '<link />';\n } else {\n dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';\n }\n shouldWrap[nodeName] = !dummyNode.firstChild;\n }\n return shouldWrap[nodeName] ? markupWrap[nodeName] : null;\n}\n\n\nmodule.exports = getMarkupWrap;\n\nrequire(\"./mock-modules\").register(\"getMarkupWrap\", module);\n",
"filterAttributes":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule filterAttributes\n * @typechecks static-only\n */\n\n/*jslint evil: true */\n\n'use strict';\n\n/**\n * Like filter(), but for a DOM nodes attributes. Returns an array of\n * the filter DOMAttribute objects. Does some perf related this like\n * caching attributes.length.\n *\n * @param {DOMElement} node Node whose attributes you want to filter\n * @return {array} array of DOM attribute objects.\n */\nfunction filterAttributes(node, func, context) {\n var attributes = node.attributes;\n var numAttributes = attributes.length;\n var accumulator = [];\n for (var i = 0; i < numAttributes; i++) {\n var attr = attributes.item(i);\n if (func.call(context, attr)) {\n accumulator.push(attr);\n }\n }\n return accumulator;\n}\n\nmodule.exports = filterAttributes;\n\nrequire(\"./mock-modules\").register(\"filterAttributes\", module);\n",
"copyProperties":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule copyProperties\n */\n\n/**\n * Copy properties from one or more objects (up to 5) into the first object.\n * This is a shallow copy. It mutates the first object and also returns it.\n *\n * NOTE: `arguments` has a very significant performance penalty, which is why\n * we don't support unlimited arguments.\n */\nfunction copyProperties(obj, a, b, c, d, e, f) {\n obj = obj || {};\n\n if (true) {\n if (f) {\n throw new Error('Too many arguments passed to copyProperties');\n }\n }\n\n var args = [a, b, c, d, e];\n var ii = 0, v;\n while (args[ii]) {\n v = args[ii++];\n for (var k in v) {\n obj[k] = v[k];\n }\n\n // IE ignores toString in object iteration.. See:\n // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html\n if (v.hasOwnProperty && v.hasOwnProperty('toString') &&\n (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) {\n obj.toString = v.toString;\n }\n }\n\n return obj;\n}\n\nmodule.exports = copyProperties;\n\nrequire(\"./mock-modules\").register(\"copyProperties\", module);\n",
"adler32":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule adler32\n */\n\n/* jslint bitwise:true */\n\n\"use strict\";\n\nvar MOD = 65521;\n\n// This is a clean-room implementation of adler32 designed for detecting\n// if markup is not what we expect it to be. It does not need to be\n// cryptographically strong, only reasonable good at detecting if markup\n// generated on the server is different than that on the client.\nfunction adler32(data) {\n var a = 1;\n var b = 0;\n for (var i = 0; i < data.length; i++) {\n a = (a + data.charCodeAt(i)) % MOD;\n b = (b + a) % MOD;\n }\n return a | (b << 16);\n}\n\nmodule.exports = adler32;\n\nrequire(\"./mock-modules\").register(\"adler32\", module);\n",
"getEventTarget":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getEventTarget\n * @typechecks static-only\n */\n\n\"use strict\";\n\n/**\n * Gets the target node from a native browser event by accounting for\n * inconsistencies in browser DOM APIs.\n *\n * @param {object} nativeEvent Native browser event.\n * @return {DOMEventTarget} Target node.\n */\nfunction getEventTarget(nativeEvent) {\n var target = nativeEvent.target || nativeEvent.srcElement || window;\n // Safari may fire events on text nodes (Node.TEXT_NODE is 3).\n // @see http://www.quirksmode.org/js/events_properties.html\n return target.nodeType === 3 ? target.parentNode : target;\n}\n\nmodule.exports = getEventTarget;\n\nrequire(\"./mock-modules\").register(\"getEventTarget\", module);\n",
"SyntheticMouseEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticMouseEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticUIEvent = require(\"./SyntheticUIEvent\");\nvar ViewportMetrics = require(\"./ViewportMetrics\");\n\n/**\n * @interface MouseEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar MouseEventInterface = {\n screenX: null,\n screenY: null,\n clientX: null,\n clientY: null,\n ctrlKey: null,\n shiftKey: null,\n altKey: null,\n metaKey: null,\n button: function(event) {\n // Webkit, Firefox, IE9+\n // which: 1 2 3\n // button: 0 1 2 (standard)\n var button = event.button;\n if ('which' in event) {\n return button;\n }\n // IE<9\n // which: undefined\n // button: 0 0 0\n // button: 1 4 2 (onmouseup)\n return button === 2 ? 2 : button === 4 ? 1 : 0;\n },\n buttons: null,\n relatedTarget: function(event) {\n return event.relatedTarget || (\n event.fromElement === event.srcElement ?\n event.toElement :\n event.fromElement\n );\n },\n // \"Proprietary\" Interface.\n pageX: function(event) {\n return 'pageX' in event ?\n event.pageX :\n event.clientX + ViewportMetrics.currentScrollLeft;\n },\n pageY: function(event) {\n return 'pageY' in event ?\n event.pageY :\n event.clientY + ViewportMetrics.currentScrollTop;\n }\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);\n\nmodule.exports = SyntheticMouseEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticMouseEvent\", module);\n",
"isTextInputElement":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule isTextInputElement\n */\n\n\"use strict\";\n\n/**\n * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n */\nvar supportedInputTypes = {\n 'color': true,\n 'date': true,\n 'datetime': true,\n 'datetime-local': true,\n 'email': true,\n 'month': true,\n 'number': true,\n 'password': true,\n 'range': true,\n 'search': true,\n 'tel': true,\n 'text': true,\n 'time': true,\n 'url': true,\n 'week': true\n};\n\nfunction isTextInputElement(elem) {\n return elem && (\n (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type]) ||\n elem.nodeName === 'TEXTAREA'\n );\n}\n\nmodule.exports = isTextInputElement;\n\nrequire(\"./mock-modules\").register(\"isTextInputElement\", module);\n",
"SyntheticClipboardEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticClipboardEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticEvent = require(\"./SyntheticEvent\");\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/clipboard-apis/\n */\nvar ClipboardEventInterface = {\n clipboardData: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);\n\nmodule.exports = SyntheticClipboardEvent;\n\n\nrequire(\"./mock-modules\").register(\"SyntheticClipboardEvent\", module);\n",
"SyntheticFocusEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticFocusEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticUIEvent = require(\"./SyntheticUIEvent\");\n\n/**\n * @interface FocusEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar FocusEventInterface = {\n relatedTarget: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);\n\nmodule.exports = SyntheticFocusEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticFocusEvent\", module);\n",
"SyntheticKeyboardEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticKeyboardEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticUIEvent = require(\"./SyntheticUIEvent\");\n\n/**\n * @interface KeyboardEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar KeyboardEventInterface = {\n 'char': null,\n key: null,\n location: null,\n ctrlKey: null,\n shiftKey: null,\n altKey: null,\n metaKey: null,\n repeat: null,\n locale: null,\n // Legacy Interface\n charCode: null,\n keyCode: null,\n which: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);\n\nmodule.exports = SyntheticKeyboardEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticKeyboardEvent\", module);\n",
"SyntheticTouchEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticTouchEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticUIEvent = require(\"./SyntheticUIEvent\");\n\n/**\n * @interface TouchEvent\n * @see http://www.w3.org/TR/touch-events/\n */\nvar TouchEventInterface = {\n touches: null,\n targetTouches: null,\n changedTouches: null,\n altKey: null,\n metaKey: null,\n ctrlKey: null,\n shiftKey: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);\n\nmodule.exports = SyntheticTouchEvent;\n\nrequire(\"./mock-modules\").register(\"SyntheticTouchEvent\", module);\n",
"isNode":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule isNode\n * @typechecks\n */\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM node.\n */\nfunction isNode(object) {\n return !!(object && (\n typeof Node !== 'undefined' ? object instanceof Node :\n typeof object === 'object' &&\n typeof object.nodeType === 'number' &&\n typeof object.nodeName === 'string'\n ));\n}\n\nmodule.exports = isNode;\n\nrequire(\"./mock-modules\").register(\"isNode\", module);\n",
"ReactComponentBrowserEnvironment":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactComponentBrowserEnvironment\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar ReactDOMIDOperations = require(\"./ReactDOMIDOperations\");\nvar ReactMarkupChecksum = require(\"./ReactMarkupChecksum\");\nvar ReactMount = require(\"./ReactMount\");\nvar ReactReconcileTransaction = require(\"./ReactReconcileTransaction\");\n\nvar getReactRootElementInContainer = require(\"./getReactRootElementInContainer\");\nvar invariant = require(\"./invariant\");\nvar mutateHTMLNodeWithMarkup = require(\"./mutateHTMLNodeWithMarkup\");\n\n\nvar ELEMENT_NODE_TYPE = 1;\nvar DOC_NODE_TYPE = 9;\n\n\n/**\n * Abstracts away all functionality of `ReactComponent` requires knowledge of\n * the browser context.\n */\nvar ReactComponentBrowserEnvironment = {\n /**\n * Mixed into every component instance.\n */\n Mixin: {\n /**\n * Returns the DOM node rendered by this component.\n *\n * @return {DOMElement} The root node of this component.\n * @final\n * @protected\n */\n getDOMNode: function() {\n invariant(\n this.isMounted(),\n 'getDOMNode(): A component must be mounted to have a DOM node.'\n );\n return ReactMount.getNode(this._rootNodeID);\n }\n },\n\n ReactReconcileTransaction: ReactReconcileTransaction,\n\n DOMIDOperations: ReactDOMIDOperations,\n\n /**\n * If a particular environment requires that some resources be cleaned up,\n * specify this in the injected Mixin. In the DOM, we would likely want to\n * purge any cached node ID lookups.\n *\n * @private\n */\n unmountIDFromEnvironment: function(rootNodeID) {\n ReactMount.purgeID(rootNodeID);\n },\n\n /**\n * @param {string} markup Markup string to place into the DOM Element.\n * @param {DOMElement} container DOM Element to insert markup into.\n * @param {boolean} shouldReuseMarkup Should reuse the existing markup in the\n * container if possible.\n */\n mountImageIntoNode: function(markup, container, shouldReuseMarkup) {\n invariant(\n container && (\n container.nodeType === ELEMENT_NODE_TYPE ||\n container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender\n ),\n 'mountComponentIntoNode(...): Target container is not valid.'\n );\n if (shouldReuseMarkup) {\n if (ReactMarkupChecksum.canReuseMarkup(\n markup,\n getReactRootElementInContainer(container))) {\n return;\n } else {\n if (true) {\n console.warn(\n 'React attempted to use reuse markup in a container but the ' +\n 'checksum was invalid. This generally means that you are using ' +\n 'server rendering and the markup generated on the server was ' +\n 'not what the client was expecting. React injected new markup ' +\n 'to compensate which works but you have lost many of the ' +\n 'benefits of server rendering. Instead, figure out why the ' +\n 'markup being generated is different on the client or server.'\n );\n }\n }\n }\n\n // You can't naively set the innerHTML of the entire document. You need\n // to mutate documentElement which requires doing some crazy tricks. See\n // mutateHTMLNodeWithMarkup()\n if (container.nodeType === DOC_NODE_TYPE) {\n mutateHTMLNodeWithMarkup(container.documentElement, markup);\n return;\n }\n\n // Asynchronously inject markup by ensuring that the container is not in\n // the document when settings its `innerHTML`.\n var parent = container.parentNode;\n if (parent) {\n var next = container.nextSibling;\n parent.removeChild(container);\n container.innerHTML = markup;\n if (next) {\n parent.insertBefore(container, next);\n } else {\n parent.appendChild(container);\n }\n } else {\n container.innerHTML = markup;\n }\n }\n};\n\nmodule.exports = ReactComponentBrowserEnvironment;\n\nrequire(\"./mock-modules\").register(\"ReactComponentBrowserEnvironment\", module);\n",
"ge":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ge\n */\n\n/**\n * Find a node by ID. Optionally search a sub-tree outside of the document\n *\n * Use ge if you're not sure whether or not the element exists. You can test\n * for existence yourself in your application code.\n *\n * If your application code depends on the existence of the element, use $\n * instead, which will throw in DEV if the element doesn't exist.\n */\nfunction ge(arg, root, tag) {\n return typeof arg != 'string' ? arg :\n !root ? document.getElementById(arg) :\n _geFromSubtree(arg, root, tag);\n}\n\nfunction _geFromSubtree(id, root, tag) {\n var elem, children, ii;\n\n if (_getNodeID(root) == id) {\n return root;\n } else if (root.getElementsByTagName) {\n // All Elements implement this, which does an iterative DFS, which is\n // faster than recursion and doesn't run into stack depth issues.\n children = root.getElementsByTagName(tag || '*');\n for (ii = 0; ii < children.length; ii++) {\n if (_getNodeID(children[ii]) == id) {\n return children[ii];\n }\n }\n } else {\n // DocumentFragment does not implement getElementsByTagName, so\n // recurse over its children. Its children must be Elements, so\n // each child will use the getElementsByTagName case instead.\n children = root.childNodes;\n for (ii = 0; ii < children.length; ii++) {\n elem = _geFromSubtree(id, children[ii]);\n if (elem) {\n return elem;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Return the ID value for a given node. This allows us to avoid issues\n * with forms that contain inputs with name=\"id\".\n *\n * @return string (null if attribute not set)\n */\nfunction _getNodeID(node) {\n // #document and #document-fragment do not have getAttributeNode.\n var id = node.getAttributeNode && node.getAttributeNode('id');\n return id ? id.value : null;\n}\n\nmodule.exports = ge;\n\nrequire(\"./mock-modules\").register(\"ge\", module);\n",
"isTextNode":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule isTextNode\n * @typechecks\n */\n\nvar isNode = require(\"./isNode\");\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM text node.\n */\nfunction isTextNode(object) {\n return isNode(object) && object.nodeType == 3;\n}\n\nmodule.exports = isTextNode;\n\nrequire(\"./mock-modules\").register(\"isTextNode\", module);\n",
"ReactDOMSelection":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule ReactDOMSelection\n */\n\n\"use strict\";\n\nvar getNodeForCharacterOffset = require(\"./getNodeForCharacterOffset\");\nvar getTextContentAccessor = require(\"./getTextContentAccessor\");\n\n/**\n * Get the appropriate anchor and focus node/offset pairs for IE.\n *\n * The catch here is that IE's selection API doesn't provide information\n * about whether the selection is forward or backward, so we have to\n * behave as though it's always forward.\n *\n * IE text differs from modern selection in that it behaves as though\n * block elements end with a new line. This means character offsets will\n * differ between the two APIs.\n *\n * @param {DOMElement} node\n * @return {object}\n */\nfunction getIEOffsets(node) {\n var selection = document.selection;\n var selectedRange = selection.createRange();\n var selectedLength = selectedRange.text.length;\n\n // Duplicate selection so we can move range without breaking user selection.\n var fromStart = selectedRange.duplicate();\n fromStart.moveToElementText(node);\n fromStart.setEndPoint('EndToStart', selectedRange);\n\n var startOffset = fromStart.text.length;\n var endOffset = startOffset + selectedLength;\n\n return {\n start: startOffset,\n end: endOffset\n };\n}\n\n/**\n * @param {DOMElement} node\n * @return {?object}\n */\nfunction getModernOffsets(node) {\n var selection = window.getSelection();\n\n if (selection.rangeCount === 0) {\n return null;\n }\n\n var anchorNode = selection.anchorNode;\n var anchorOffset = selection.anchorOffset;\n var focusNode = selection.focusNode;\n var focusOffset = selection.focusOffset;\n\n var currentRange = selection.getRangeAt(0);\n var rangeLength = currentRange.toString().length;\n\n var tempRange = currentRange.cloneRange();\n tempRange.selectNodeContents(node);\n tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);\n\n var start = tempRange.toString().length;\n var end = start + rangeLength;\n\n // Detect whether the selection is backward.\n var detectionRange = document.createRange();\n detectionRange.setStart(anchorNode, anchorOffset);\n detectionRange.setEnd(focusNode, focusOffset);\n var isBackward = detectionRange.collapsed;\n detectionRange.detach();\n\n return {\n start: isBackward ? end : start,\n end: isBackward ? start : end\n };\n}\n\n/**\n * @param {DOMElement|DOMTextNode} node\n * @param {object} offsets\n */\nfunction setIEOffsets(node, offsets) {\n var range = document.selection.createRange().duplicate();\n var start, end;\n\n if (typeof offsets.end === 'undefined') {\n start = offsets.start;\n end = start;\n } else if (offsets.start > offsets.end) {\n start = offsets.end;\n end = offsets.start;\n } else {\n start = offsets.start;\n end = offsets.end;\n }\n\n range.moveToElementText(node);\n range.moveStart('character', start);\n range.setEndPoint('EndToStart', range);\n range.moveEnd('character', end - start);\n range.select();\n}\n\n/**\n * In modern non-IE browsers, we can support both forward and backward\n * selections.\n *\n * Note: IE10+ supports the Selection object, but it does not support\n * the `extend` method, which means that even in modern IE, it's not possible\n * to programatically create a backward selection. Thus, for all IE\n * versions, we use the old IE API to create our selections.\n *\n * @param {DOMElement|DOMTextNode} node\n * @param {object} offsets\n */\nfunction setModernOffsets(node, offsets) {\n var selection = window.getSelection();\n\n var length = node[getTextContentAccessor()].length;\n var start = Math.min(offsets.start, length);\n var end = typeof offsets.end === 'undefined' ?\n start : Math.min(offsets.end, length);\n\n var startMarker = getNodeForCharacterOffset(node, start);\n var endMarker = getNodeForCharacterOffset(node, end);\n\n if (startMarker && endMarker) {\n var range = document.createRange();\n range.setStart(startMarker.node, startMarker.offset);\n selection.removeAllRanges();\n selection.addRange(range);\n selection.extend(endMarker.node, endMarker.offset);\n range.detach();\n }\n}\n\nvar ReactDOMSelection = {\n /**\n * @param {DOMElement} node\n */\n getOffsets: function(node) {\n var getOffsets = document.selection ? getIEOffsets : getModernOffsets;\n return getOffsets(node);\n },\n\n /**\n * @param {DOMElement|DOMTextNode} node\n * @param {object} offsets\n */\n setOffsets: function(node, offsets) {\n var setOffsets = document.selection ? setIEOffsets : setModernOffsets;\n setOffsets(node, offsets);\n }\n};\n\nmodule.exports = ReactDOMSelection;\n\nrequire(\"./mock-modules\").register(\"ReactDOMSelection\", module);\n",
"getActiveElement":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule getActiveElement\n * @typechecks\n */\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n */\nfunction getActiveElement() /*?DOMElement*/ {\n try {\n return document.activeElement;\n } catch (e) {\n return null;\n }\n}\n\nmodule.exports = getActiveElement;\n\n\nrequire(\"./mock-modules\").register(\"getActiveElement\", module);\n",
"LinkedValueMixin":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule LinkedValueMixin\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar invariant = require(\"./invariant\");\n\n/**\n * Provide a linked `value` attribute for controlled forms. You should not use\n * this outside of the ReactDOM controlled form components.\n */\nvar LinkedValueMixin = {\n _assertLink: function() {\n invariant(\n this.props.value == null && this.props.onChange == null,\n 'Cannot provide a valueLink and a value or onChange event. If you ' +\n 'want to use value or onChange, you probably don\\'t want to use ' +\n 'valueLink'\n );\n },\n\n /**\n * @return {*} current value of the input either from value prop or link.\n */\n getValue: function() {\n if (this.props.valueLink) {\n this._assertLink();\n return this.props.valueLink.value;\n }\n return this.props.value;\n },\n\n /**\n * @return {function} change callback either from onChange prop or link.\n */\n getOnChange: function() {\n if (this.props.valueLink) {\n this._assertLink();\n return this._handleLinkedValueChange;\n }\n return this.props.onChange;\n },\n\n /**\n * @param {SyntheticEvent} e change event to handle\n */\n _handleLinkedValueChange: function(e) {\n this.props.valueLink.requestChange(e.target.value);\n }\n};\n\nmodule.exports = LinkedValueMixin;\n\nrequire(\"./mock-modules\").register(\"LinkedValueMixin\", module);\n",
"SyntheticCompositionEvent":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule SyntheticCompositionEvent\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar SyntheticEvent = require(\"./SyntheticEvent\");\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents\n */\nvar CompositionEventInterface = {\n data: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticCompositionEvent(\n dispatchConfig,\n dispatchMarker,\n nativeEvent) {\n SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(\n SyntheticCompositionEvent,\n CompositionEventInterface\n);\n\nmodule.exports = SyntheticCompositionEvent;\n\n\nrequire(\"./mock-modules\").register(\"SyntheticCompositionEvent\", module);\n",
"shallowEqual":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule shallowEqual\n */\n\n\"use strict\";\n\n/**\n * Performs equality by iterating through keys on an object and returning\n * false when any key has values which are not strictly equal between\n * objA and objB. Returns true when the values of all keys are strictly equal.\n *\n * @return {boolean}\n */\nfunction shallowEqual(objA, objB) {\n if (objA === objB) {\n return true;\n }\n var key;\n // Test for A's keys different from B.\n for (key in objA) {\n if (objA.hasOwnProperty(key) &&\n (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {\n return false;\n }\n }\n // Test for B'a keys missing from A.\n for (key in objB) {\n if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = shallowEqual;\n\nrequire(\"./mock-modules\").register(\"shallowEqual\", module);\n",
"performanceNow":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule performanceNow\n * @typechecks static-only\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = require(\"./ExecutionEnvironment\");\n\n/**\n * Detect if we can use window.performance.now() and gracefully\n * fallback to Date.now() if it doesn't exist.\n * We need to support Firefox < 15 for now due to Facebook's webdriver\n * infrastructure.\n */\nvar performance = null;\n\nif (ExecutionEnvironment.canUseDOM) {\n performance = window.performance || window.webkitPerformance;\n}\n\nif (!performance || !performance.now) {\n performance = Date;\n}\n\nvar performanceNow = performance.now.bind(performance);\n\nmodule.exports = performanceNow;\n\nrequire(\"./mock-modules\").register(\"performanceNow\", module);\n",
"createArrayFrom":"/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule createArrayFrom\n * @typechecks\n */\n\n/**\n * NOTE: if you are a previous user of this function, it has been considered\n * unsafe because it's inconsistent across browsers for some inputs.\n * Instead use `Array.isArray()`.\n *\n * Perform a heuristic test to determine if an object is \"array-like\".\n *\n * A monk asked Joshu, a Zen master, \"Has a dog Buddha nature?\"\n * Joshu replied: \"Mu.\"\n *\n * This function determines if its argument has \"array nature\": it returns\n * true if the argument is an actual array, an `arguments' object, or an\n * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).\n *\n * @param {*} obj\n * @return {boolean}\n */\nfunction hasArrayNature(obj) {\n return (\n // not null/false\n !!obj &&\n // arrays are objects, NodeLists are functions in Safari\n (typeof obj == 'object' || typeof obj == 'function') &&\n // quacks like an array\n ('length' in obj) &&\n // not window\n !('setInterval' in obj) &&\n // no DOM node should be considered an array-like\n // a 'select' element has 'length' and 'item' properties on IE8\n (typeof obj.nodeType != 'number') &&\n (\n // a real array\n (// HTMLCollection/NodeList\n (Array.isArray(obj) ||\n // arguments\n ('callee' in obj) || 'item' in obj))\n )\n );\n}\n\n/**\n * Ensure that the argument is an array by wrapping it in an array if it is not.\n * Creates a copy of the argument if it is already an array.\n *\n * This is mostly useful idiomatically:\n *\n * var createArrayFrom = require('createArrayFrom');\n *\n * function takesOneOrMoreThings(things) {\n * things = createArrayFrom(things);\n * ...\n * }\n *\n * This allows you to treat `things' as an array, but accept scalars in the API.\n *\n * This is also good for converting certain pseudo-arrays, like `arguments` or\n * HTMLCollections, into arrays.\n *\n * @param {*} obj\n * @return {array}\n */\nfunction createArrayFrom(obj) {\n if (!hasArrayNature(obj)) {\n return [obj];\n }\n if (obj.item) {\n // IE does not support Array#slice on HTMLCollections\n var l = obj.length, ret = new Array(l);\n while (l--) { ret[l] = obj[l]; }\n return ret;\n }\n return Array.prototype.slice.call(obj);\n}\n\nmodule.exports = createArrayFrom;\n\nrequire(\"./mock-modules\").register(\"createArrayFrom\", module);\n"
});