diff --git a/Rakefile b/Rakefile index 2b33d7064..72549dd91 100644 --- a/Rakefile +++ b/Rakefile @@ -12,11 +12,17 @@ namespace :react do FileUtils.rm_f('vendor/react/.bower.json') `bower install react` assets_path = Pathname.new(File.dirname(__FILE__)).join('lib/assets/') - copy_react_asset('JSXTransformer.js', assets_path.join('javascripts/JSXTransformer.js')) copy_react_asset('react.js', assets_path.join('react-source/development/react.js')) copy_react_asset('react.min.js', assets_path.join('react-source/production/react.js')) copy_react_asset('react-with-addons.js', assets_path.join('react-source/development-with-addons/react.js')) copy_react_asset('react-with-addons.min.js', assets_path.join('react-source/production-with-addons/react.js')) + + copy_react_asset('react-dom.js', assets_path.join('react-source/development/react-dom.js')) + copy_react_asset('react-dom.min.js', assets_path.join('react-source/production/react-dom.js')) + # Make sure it's also present when addons: true + copy_react_asset('react-dom.js', assets_path.join('react-source/development-with-addons/react-dom.js')) + copy_react_asset('react-dom.min.js', assets_path.join('react-source/production-with-addons/react-dom.js')) + end def copy_react_asset(source, destination) diff --git a/VERSIONS.md b/VERSIONS.md index 396c7b968..57fae1a80 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -9,7 +9,7 @@ You can control what version of React.js (and JSXTransformer) is used by `react- | Gem | React.js | |----------|----------| -| master | 0.13.3 | +| master | 0.14.0 | | 1.3.1 | 0.13.3 | | 1.3.0 | 0.13.3 | | 1.2.0 | 0.13.3 | diff --git a/lib/assets/javascripts/react_ujs.js.erb b/lib/assets/javascripts/react_ujs.js.erb index 91e641565..7e29e50c1 100644 --- a/lib/assets/javascripts/react_ujs.js.erb +++ b/lib/assets/javascripts/react_ujs.js.erb @@ -53,7 +53,7 @@ var propsJson = node.getAttribute(window.ReactRailsUJS.PROPS_ATTR); var props = propsJson && JSON.parse(propsJson); - React.render(React.createElement(constructor, props), node); + ReactDOM.render(React.createElement(constructor, props), node); } }, @@ -63,7 +63,7 @@ for (var i = 0; i < nodes.length; ++i) { var node = nodes[i]; - React.unmountComponentAtNode(node); + ReactDOM.unmountComponentAtNode(node); } } }; diff --git a/lib/assets/react-source/development-with-addons/react-dom.js b/lib/assets/react-source/development-with-addons/react-dom.js new file mode 100644 index 000000000..8b3e85d6b --- /dev/null +++ b/lib/assets/react-source/development-with-addons/react-dom.js @@ -0,0 +1,42 @@ +/** + * ReactDOM v0.14.0 + * + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js +;(function(f) { + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f(require('react')); + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(['react'], f); + + //