Skip to content

Commit 954ad4b

Browse files
authored
Merged master into gatsby (#10834)
* Merge branch 'master' into gatsby * Update header comments to remove references to PATENTS file * Fixed author frontmatter for newly-added 15.6.2 post
1 parent 6cac3ad commit 954ad4b

File tree

509 files changed

+2552
-3097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

509 files changed

+2552
-3097
lines changed

CHANGELOG.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
## [Unreleased]
2+
<details>
3+
<summary>
4+
Changes that have landed in master but are not yet released.
5+
Click to see more.
6+
</summary>
7+
8+
### New JS Environment Requirements
9+
10+
* React 16 depends on the collection types [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) and [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set), as well as [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame). If you support older browsers and devices which may not yet provide these natively (e.g. <IE11), [you may want to include a polyfill](https://gist.github.com/gaearon/9a4d54653ae9c50af6c54b4e0e56b583).
11+
12+
### New Features
13+
* Components can now return arrays and strings from `render`. (Docs coming soon!)
14+
* Improved error handling with introduction of "error boundaries". [Error boundaries](https://facebook.github.io/react/blog/2017/07/26/error-handling-in-react-16.html) are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.
15+
* First-class support for declaratively rendering a subtree into another DOM node with `ReactDOM.createPortal()`. (Docs coming soon!)
16+
* Streaming mode for server side rendering is enabled with `ReactDOMServer.renderToNodeStream()` and `ReactDOMServer.renderToStaticNodeStream()`. ([@aickin](https://github.com/aickin) in [#10425](https://github.com/facebook/react/pull/10425), [#10044](https://github.com/facebook/react/pull/10044), [#10039](https://github.com/facebook/react/pull/10039), [#10024](https://github.com/facebook/react/pull/10024), [#9264](https://github.com/facebook/react/pull/9264), and others.)
17+
* [React DOM now allows passing non-standard attributes](https://facebook.github.io/react/blog/2017/09/08/dom-attributes-in-react-16.html). ([@nhunzaker](https://github.com/nhunzaker) in [#10385](https://github.com/facebook/react/pull/10385), [10564](https://github.com/facebook/react/pull/10564), [#10495](https://github.com/facebook/react/pull/10495) and others)
18+
19+
### Breaking Changes
20+
- There are several changes to the behavior of scheduling and lifecycle methods:
21+
* `ReactDOM.render()` and `ReactDOM.unstable_renderIntoContainer()` now return `null` if called from inside a lifecycle method.
22+
* To work around this, you can either use [the new portal API](https://github.com/facebook/react/issues/10309#issuecomment-318433235) or [refs](https://github.com/facebook/react/issues/10309#issuecomment-318434635).
23+
* Minor changes to `setState` behavior:
24+
* Calling `setState` with null no longer triggers an update. This allows you to decide in an updater function if you want to re-render.
25+
* Calling `setState` directly in render always causes an update. This was not previously the case. Regardless, you should not be calling `setState` from render.
26+
* `setState` callback (second argument) now fires immediately after `componentDidMount` / `componentDidUpdate` instead of after all components have rendered.
27+
* When replacing `<A />` with `<B />`, `B.componentWillMount` now always happens before `A.componentWillUnmount`. Previously, `A.componentWillUnmount` could fire first in some cases.
28+
* Previously, changing the `ref` to a component would always detach the ref before that component's render is called. Now, we change the `ref` later, when applying the changes to the DOM.
29+
* It is not safe to re-render into a container that was modified by something other than React. This worked previously in some cases but was never supported. We now emit a warning in this case. Instead you should clean up your component trees using `ReactDOM.unmountComponentAtNode`. [See this example.](https://github.com/facebook/react/issues/10294#issuecomment-318820987)
30+
* `componentDidUpdate` lifecycle no longer receives `prevContext` param. ([@bvaughn](https://github.com/bvaughn) in [#8631](https://github.com/facebook/react/pull/8631))
31+
* Non-unique keys may now cause children to be duplicated and/or omitted. Using non-unique keys is not (and has never been) supported, but previously it was a hard error.
32+
* Shallow renderer no longer calls `componentDidUpdate()` because DOM refs are not available. This also makes it consistent with `componentDidMount()` (which does not get called in previous versions either).
33+
* Shallow renderer does not implement `unstable_batchedUpdates()` anymore.
34+
- The names and paths to the single-file browser builds have changed to emphasize the difference between development and production builds. For example:
35+
- `react/dist/react.js``react/umd/react.development.js`
36+
- `react/dist/react.min.js``react/umd/react.production.min.js`
37+
- `react-dom/dist/react-dom.js``react-dom/umd/react-dom.development.js`
38+
- `react-dom/dist/react-dom.min.js``react-dom/umd/react-dom.production.min.js`
39+
* The server renderer has been completely rewritten, with some improvements:
40+
* Server rendering does not use markup validation anymore, and instead tries its best to attach to existing DOM, warning about inconsistencies. It also doesn't use comments for empty components and data-reactid attributes on each node anymore.
41+
* Hydrating a server rendered container now has an explicit API. Use `ReactDOM.hydrate` instead of `ReactDOM.render` if you're reviving server rendered HTML. Keep using `ReactDOM.render` if you're just doing client-side rendering.
42+
* When "unknown" props are passed to DOM components, for valid values, React will now render them in the DOM. [See this post for more details.](https://facebook.github.io/react/blog/2017/09/08/dom-attributes-in-react-16.html) ([@nhunzaker](https://github.com/nhunzaker) in [#10385](https://github.com/facebook/react/pull/10385), [10564](https://github.com/facebook/react/pull/10564), [#10495](https://github.com/facebook/react/pull/10495) and others)
43+
* Errors in the render and lifecycle methods now unmount the component tree by default. To prevent this, add [error boundaries](https://facebook.github.io/react/blog/2017/07/26/error-handling-in-react-16.html) to the appropriate places in the UI.
44+
45+
### Removed Deprecations
46+
47+
- There is no `react-with-addons.js` build anymore. All compatible addons are published separately on npm, and have single-file browser versions if you need them.
48+
- The deprecations introduced in 15.x have been removed from the core package. `React.createClass` is now available as create-react-class, `React.PropTypes` as prop-types, `React.DOM` as react-dom-factories, react-addons-test-utils as react-dom/test-utils, and shallow renderer as react-test-renderer/shallow. See [15.5.0](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html) and [15.6.0](https://facebook.github.io/react/blog/2017/06/13/react-v15.6.0.html) blog posts for instructions on migrating code and automated codemods.
49+
50+
</details>
51+
52+
## 15.6.2 (September 25, 2017)
53+
54+
### All Packages
55+
* Switch from BSD + Patents to MIT license
56+
57+
### React DOM
58+
59+
* Fix a bug where modifying `document.documentMode` would trigger IE detection in other browsers, breaking change events. ([@aweary](https://github.com/aweary) in [#10032](https://github.com/facebook/react/pull/10032))
60+
* CSS Columns are treated as unitless numbers. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/10115))
61+
* Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011))
62+
* Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363))
63+
* Fix cases where `onChange` would not fire with `defaultChecked` on radio inputs. ([@jquense](https://github.com/jquense) in [#10156](https://github.com/facebook/react/pull/10156))
64+
* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
65+
* Fix a bug where creating an element with a ref in a constructor did not throw an error in development. ([@iansu](https://github.com/iansu) in [#10025](https://github.com/facebook/react/pull/10025))
66+
167
## 15.6.1 (June 14, 2017)
268

369
### React DOM

LICENSE

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
1-
BSD License
2-
3-
For React software
1+
MIT License
42

53
Copyright (c) 2013-present, Facebook, Inc.
6-
All rights reserved.
7-
8-
Redistribution and use in source and binary forms, with or without modification,
9-
are permitted provided that the following conditions are met:
10-
11-
* Redistributions of source code must retain the above copyright notice, this
12-
list of conditions and the following disclaimer.
134

14-
* Redistributions in binary form must reproduce the above copyright notice,
15-
this list of conditions and the following disclaimer in the documentation
16-
and/or other materials provided with the distribution.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
1711

18-
* Neither the name Facebook nor the names of its contributors may be used to
19-
endorse or promote products derived from this software without specific
20-
prior written permission.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
2114

22-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

PATENTS

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To help you get your feet wet and get you familiar with our contribution process
5959

6060
### License
6161

62-
React is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).
62+
React is [MIT licensed](./LICENSE).
6363

6464
React documentation is [Creative Commons licensed](./LICENSE-docs).
6565

docs/_data/authors.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ LoukaN:
4949
matthewjohnston4:
5050
name: Matthew Johnston
5151
url: https://github.com/matthewathome
52+
nhunzaker:
53+
name: Nathan Hunzaker
54+
url: https://github.com/nhunzaker
5255
petehunt:
5356
name: Pete Hunt
5457
url: https://twitter.com/floydophone

docs/_data/nav_docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,5 @@
7575
title: Test Utilities
7676
- id: shallow-renderer
7777
title: Shallow Renderer
78+
- id: test-renderer
79+
title: Test Renderer

docs/_js/ErrorDecoderComponent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
* Copyright (c) 2013-present, Facebook, Inc.
3-
* All rights reserved.
43
*
5-
* This source code is licensed under the BSD-style license found in the
6-
* LICENSE file in the root directory of this source tree. An additional grant
7-
* of patent rights can be found in the PATENTS file in the same directory.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
86
*/
97
/* global React ReactDOM errorMap:true */
108
'use strict';

docs/_posts/2017-09-08-dom-attributes-in-react-16.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ We've made a few other changes to make the behavior more predictable and help en
105105
Below is a detailed list of them.
106106

107107
* **Unknown attributes with string, number, and object values:**
108-
108+
109109
```js
110110
<div mycustomattribute="value" />
111111
<div mycustomattribute={42} />
@@ -118,7 +118,7 @@ Below is a detailed list of them.
118118
*Note: attributes starting with `on` are not passed through as an exception because this could become a potential security hole.*
119119

120120
* **Known attributes with a different canonical React name:**
121-
121+
122122
```js
123123
<div tabindex="-1" />
124124
<div class="hi" />
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: "React v15.6.2"
3+
author: [nhunzaker]
4+
---
5+
6+
Today we're sending out React 15.6.2. In 15.6.1, we shipped a few fixes for change events and inputs that had some unintended consequences. Those regressions have been ironed out, and we've also included a few more fixes to improve the stability of React across all browsers.
7+
8+
Additionally, 15.6.2 adds support for the [`controlList`](https://developers.google.com/web/updates/2017/03/chrome-58-media-updates#controlslist) attribute, and CSS columns are no longer appended with a `px` suffix.
9+
10+
## Installation
11+
12+
We recommend using [Yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/) for managing front-end dependencies. If you're new to package managers, the [Yarn documentation](https://yarnpkg.com/en/docs/getting-started) is a good place to get started.
13+
14+
To install React with Yarn, run:
15+
16+
```bash
17+
yarn add react@^15.6.2 react-dom@^15.6.2
18+
```
19+
20+
To install React with npm, run:
21+
22+
```bash
23+
npm install --save react@^15.6.2 react-dom@^15.6.2
24+
```
25+
26+
We recommend using a bundler like [webpack](https://webpack.js.org/) or [Browserify](http://browserify.org/) so you can write modular code and bundle it together into small packages to optimize load time.
27+
28+
Remember that by default, React runs extra checks and provides helpful warnings in development mode. When deploying your app, make sure to [use the production build](/react/docs/optimizing-performance.html#use-the-production-build).
29+
30+
In case you don't use a bundler, we also provide pre-built bundles in the npm packages which you can [include as script tags](/react/docs/installation.html#using-a-cdn) on your page:
31+
32+
* **React**<br/>
33+
Dev build with warnings: [react/dist/react.js](https://unpkg.com/[email protected]/dist/react.js)<br/>
34+
Minified build for production: [react/dist/react.min.js](https://unpkg.com/[email protected]/dist/react.min.js)<br/>
35+
* **React with Add-Ons**<br/>
36+
Dev build with warnings: [react/dist/react-with-addons.js](https://unpkg.com/[email protected]/dist/react-with-addons.js)<br/>
37+
Minified build for production: [react/dist/react-with-addons.min.js](https://unpkg.com/[email protected]/dist/react-with-addons.min.js)<br/>
38+
* **React DOM** (include React in the page before React DOM)<br/>
39+
Dev build with warnings: [react-dom/dist/react-dom.js](https://unpkg.com/[email protected]/dist/react-dom.js)<br/>
40+
Minified build for production: [react-dom/dist/react-dom.min.js](https://unpkg.com/[email protected]/dist/react-dom.min.js)<br/>
41+
* **React DOM Server** (include React in the page before React DOM Server)<br/>
42+
Dev build with warnings: [react-dom/dist/react-dom-server.js](https://unpkg.com/[email protected]/dist/react-dom-server.js)<br/>
43+
Minified build for production: [react-dom/dist/react-dom-server.min.js](https://unpkg.com/[email protected]/dist/react-dom-server.min.js)<br/>
44+
45+
We've also published version `15.6.2` of `react` and `react-dom` on npm, and the `react` package on bower.
46+
47+
---
48+
49+
## Changelog
50+
51+
## 15.6.2 (September 25, 2017)
52+
53+
### All Packages
54+
* Switch from BSD + Patents to MIT license
55+
56+
### React DOM
57+
58+
* Fix a bug where modifying `document.documentMode` would trigger IE detection in other browsers, breaking change events. ([@aweary](https://github.com/aweary) in [#10032](https://github.com/facebook/react/pull/10032))
59+
* CSS Columns are treated as unitless numbers. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/10115))
60+
* Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011))
61+
* Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363))
62+
* Fix cases where `onChange` would not fire with `defaultChecked` on radio inputs. ([@jquense](https://github.com/jquense) in [#10156](https://github.com/facebook/react/pull/10156))
63+
* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
64+
* Fix a bug where creating an element with a ref in a constructor did not throw an error in development. ([@iansu](https://github.com/iansu) in [#10025](https://github.com/facebook/react/pull/10025))

docs/contributing/how-to-contribute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ React team meets once a week to discuss the development of React, future plans,
156156

157157
### License
158158

159-
By contributing to React, you agree that your contributions will be licensed under its BSD license.
159+
By contributing to React, you agree that your contributions will be licensed under its MIT license.
160160

161161
### What Next?
162162

0 commit comments

Comments
 (0)