Compare commits

...

2857 Commits

Author SHA1 Message Date
Brian Vaughn
1298e15f84 Update bundle sizes for 16.1.0-beta release 2017-11-02 15:34:31 -07:00
Brian Vaughn
8306553301 Update error codes for 16.1.0-beta release 2017-11-02 15:34:31 -07:00
Brian Vaughn
00e27eaf1e Updating package versions for release 16.1.0-beta 2017-11-02 15:32:36 -07:00
Brian Vaughn
c5c48b51b4 Updating yarn.lock file for 16.1.0-beta release 2017-11-02 15:31:08 -07:00
Brian Vaughn
a181ba8707 Auto-install (or update) release script Yarn deps before running (#11434) 2017-11-02 15:21:28 -07:00
Clement Hoang
1e35f2b282 Put createRoot export under a feature flag (#11426) 2017-11-02 15:21:06 -07:00
Dan Abramov
45c1ff348e Remove unnecessary 'use strict' in the source (#11433)
* Remove use strict from ES modules

* Delete unused file

This was unused since Stack.
2017-11-02 20:32:48 +00:00
Dan Abramov
c0ee8df26c Record sizes 2017-11-02 19:54:58 +00:00
Dan Abramov
21d0c11523 Convert the Source to ES Modules (#11389)
* Update transforms to handle ES modules

* Update Jest to handle ES modules

* Convert react package to ES modules

* Convert react-art package to ES Modules

* Convert react-call-return package to ES Modules

* Convert react-test-renderer package to ES Modules

* Convert react-cs-renderer package to ES Modules

* Convert react-rt-renderer package to ES Modules

* Convert react-noop-renderer package to ES Modules

* Convert react-dom/server to ES modules

* Convert react-dom/{client,events,test-utils} to ES modules

* Convert react-dom/shared to ES modules

* Convert react-native-renderer to ES modules

* Convert react-reconciler to ES modules

* Convert events to ES modules

* Convert shared to ES modules

* Remove CommonJS support from transforms

* Move ReactDOMFB entry point code into react-dom/src

This is clearer because we can use ES imports in it.

* Fix Rollup shim configuration to work with ESM

* Fix incorrect comment

* Exclude external imports without side effects

* Fix ReactDOM FB build

* Remove TODOs I don’t intend to fix yet
2017-11-02 19:50:03 +00:00
Dan Abramov
fbf617a263 Update Rollup (#11427)
* Update Rollup

* Strip "use strict" in individual modules

* Record sizes
2017-11-02 16:56:12 +00:00
Dan Abramov
f302a6a334 Record sizes 2017-11-02 16:26:54 +00:00
Dan Abramov
4008f6d37d Validate built bundles with a few ESLint rules (#11432) 2017-11-02 15:50:25 +00:00
Dan Abramov
b98313f176 Fix lint issues 2017-11-02 14:07:20 +00:00
Dan Abramov
c97c92061b Undo fbjs/lib/EventListener inlining (#11431) 2017-11-02 13:43:28 +00:00
Dan Abramov
983ec90764 Always run React.Fragment tests (#11430) 2017-11-02 13:31:17 +00:00
Dean Brophy
787c2ad2d9 Constructor error message (#11395)
* Constructor test and fix complete

* Linters and prettier run

* Remove unnecessary checks

* Update error message

* Updat unit test

* prettier

* Tweak the check to be more specific

* Move tests to ReactCompositeComponent-test

* add error call count and remove line
2017-11-01 21:01:24 +00:00
Dan Abramov
9d75a62d14 Depend on prop-types/checkPropTypes, not prop-types itself (#11420)
* Remove prop-types/checkPropTypes reimplementation

* Remove renderer dependency on top-level PropTypes

This annotation is unnecessary because we already warn for bad event listener types.

* Record sizes
2017-11-01 10:57:24 +00:00
Clement Hoang
0e15ff5669 Put React.Fragment under a feature flag (#11421)
* Put React.Fragment under a feature flag

* Don't export undefined Fragment
2017-10-31 17:43:55 -07:00
Dan Abramov
dd1b7afc14 Use warning() over console.error() direct call (#11418) 2017-11-01 00:41:02 +00:00
Dan Abramov
9f2b15909a Record sizes 2017-10-31 22:14:22 +00:00
Sebastian Markbåge
2c1ac9fe1d Inline fbjs/lib/EventListener dependency (#11402)
* Drop fbjs/lib/EventListener from tests

Assert on the underlying native event listener instead.

This test file still needs to be rewritten in terms of public APIs.

* Inline fbjs/lib/EventListener dependency

We explicitly don't want to shim this and we don't use the return value.

We can probably even drop the IE path now since we don't support it.
Not sure if that'll be a true breaking change though.

* Wrap event listeners and the callback passed to requestIdleCallback

This is a FBism.

This uses the injection model in ReactErrorUtils. This isn't technically
going to used for errors but close enough.

This really wants to be eager but we can't because of dynamic injection.
2017-10-31 11:23:03 -07:00
Matteo Vesprini-Heidrich
0752a63f59 add Portal support to React.Children calls (#11378) 2017-10-31 14:59:27 +00:00
zombieJ
2b3592331e Pass pendingProps as argument in createWorkInProgress (#11296)
* move to pendingProps to args

* update userFiber in ReactChildFiber

* prettier it

* prettier it

* move expirationTime to the last

* move expirationTime to the last on userFiber

* Move assignment
2017-10-31 13:46:17 +00:00
Nic Bonetto
544d5c7208 Fixed invalid prop types error message to be more specific (#11308)
* Modified tests and corrected error message. #3

* Fixed syntax issues. #3

* Modified test. #3

* Prettified. #3

* Changed warning message to handle true and false boolean values. #3

* Changed test to contain undefined instead of value. #3

* Simplified branch structure. #3

* Refactored branching logic. #3

* Refactored falsy warning message and tests. #3

* Changed condition to attribute name. #3

* Refactored falsy and truthy warning messages with tests updated. #3

* Added missing character. #3

* Fixed warning message. #3

* Cleared extra whitespace. #3

* Refactored warning messages to be clear. #3

* Prettified. #3

* Grammar fix

* Tweak unrelated warning

The message didn't make sense because it appears for *any* attributes, not just numeric ones.

* Tweak the message for more clarity

* Add a special message for false event handlers

* Add missing whitespace

* Revert size changes
2017-10-31 13:02:41 +00:00
Anushree Subramani
3f1f3dc12e Deduplicated many warnings (#11140) (#11216)
*  Deduplicated many warnings (#11140)

*  Deduplicated the following warnings:

1.  Can only update a mounted or mounting component.
    This usually means you called setState, replaceState,
    or forceUpdate on an unmounted component. This is a no-op

2.  %s.componentWillReceiveProps(): Assigning directly to
    this.state is deprecated (except inside a component's
    constructor). Use setState instead.'

3.  An update (setState, replaceState, or forceUpdate) was scheduled
    from inside an update function. Update functions should be pure,
    with zero side-effects. Consider using componentDidUpdate or a
    callback.

4.  setState(...): Cannot call setState() inside getChildContext()

* Code review changes made for #11140

* Minor style fix

* Test deduplication for noop updates in server renderer

* Test deduplication for cWRP warning

* Test deduplication for cWM setState warning

* Test deduplication for unnmounted setState warning

* Fix existing Flow typing

* Test deduplication for invalid updates

* Test deduplication of update-in-updater warning
2017-10-31 12:35:28 +00:00
shawn wang
7f10fae4c1 Warn if class has a render() method but doesn't extend React.Component (#11168)
Warn if class has a render() method but doesn't extend React.Component
2017-10-31 12:02:55 +00:00
Neal Wright
4a43cf6eac Changed the error message displayed when a select element has props.multiple set to true and value set to null (#11141)
* Corrects error message for select with props.multiple set to true and a null value.

* Don't bother deduplicating based on type

* Make the code a bit simpler (and more verbose)
2017-10-31 11:47:59 +00:00
Clement Hoang
4ce5da7aee Add Fragment as a named export to React (#10783)
* Add Fragment as a named export to React

* Remove extra tests for Fragment

* Change React.Fragment export to be a string '#fragment'

* Fix fragment special case to work with 1 child

* Add single child test for fragment export

* Move fragment definition to ReactEntry.js and render components for key warning tests

* Inline createFiberFromElementType into createFiberFromElement

* Update reconciliation to special case fragments

* Use same semantics as implicit childsets for ReactFragment

* Add more fragment state preservation tests

* Export symbol instead of string for fragments

* Fix rebase breakages

* Re-apply prettier at 1.2.2

* Merge branches in updateElement

* Remove unnecessary check

* Re-use createFiberFromFragment for fragment case

* Simplyify branches by adding type field to fragment fiber

* Move branching logic for fragments to broader methods when possible.

* Add more tests for fragments

* Address Dan's feedback

* Move REACT_FRAGMENT_TYPE into __DEV__ block for DCE

* Change hex representation of REACT_FRAGMENT_TYPE to follow convention

* Remove unnecessary branching and isArray checks

* Update test for preserving children state when keys are same

* Fix updateSlot bug and add more tests

* Make fragment tests more robust by using ops pattern

* Update jsx element validator to allow numbers and symbols

* Remove type field from fragment fiber

* Fork reconcileChildFibers instead of recursing

* Use ternary if condition

* Revamp fragment test suite:

- Add more coverage to fragment tests
- Use better names
- Remove useless Fragment component inside tests
- Remove useless tests so that tests are more concise

* Check output of renderer in fragment tests to ensure no silly business despite states being preserved

* Finish implementation of fragment reconciliation with desired behavior

* Add reverse render direction for fragment tests

* Remove unneeded fragment branch in updateElement

* Add more test cases for ReactFragment

* Handle childless fragment in reconciler

* Support fragment flattening in SSR

* Clean up ReactPartialRenderer

* Warn when non-key and children props are passed to fragments

* Add non-null key check back to updateSlot's array's case

* Add test for positional reconciliation in fragments

* Add warning for refs in fragments with stack trace
2017-10-30 17:52:40 -07:00
Márcio Vicente
d61af82390 Removing dot to avoid redirect to facebook.com (#11400)
* Removing dot to avoid redirect to facebook.com

* Changing phrase instead of using

* Tweak test

* Reset unrelated file
2017-10-30 14:16:18 +00:00
Dan Abramov
177cd85253 Reorder badges by colors 2017-10-28 18:57:19 +01:00
Aleem
84a2891b14 Added MIT license badge along with other existing badges. (#11391) 2017-10-28 12:36:23 +01:00
Sebastian Markbåge
696908f496 [CS] Implement Some Stuff (#11390)
* Implement CS first take

This is using a pure JS API. This should probably switch to native hooks
at some later point but I'll start ironing out issues at this level first.

* Use async scheduling by default

The scheduled callback gets called immediately in render with infinite
time for now. Later this will be per root and abortable.

* Fix up the type signature of the ReactNativeCSType export

* Add escape hatch for special cased children

Working around the fact that we can't map arbitrary children slots. Just
the "children" prop.

* Readd providesModule for ReactNativeCSTypes

* Fix lint

* Fix ReactNativeTypes providesModule and CI check

* Special case a parent instance that doesn't have a props object

CSCustom can be anything here. Ugly but whatevs.

* Don't forget to store stateUpdater so that we can trigger updates

* Fix test
2017-10-27 20:05:34 -07:00
Dan Abramov
cc54b6f48a Add a shim for React 16.0.0 future compatibility (#11388) 2017-10-27 17:38:59 +01:00
Lucas Lentz
55b3172f1d Rewrite ReactDOMInput-test depending on internal API (#11299) (#11309)
* Rewrite tests depending on internal API

* Remove focus being called when there was no blur event function before

* Remove triggering function and just let ReactTestUtils take care

* Use native events

* Remove duplicate

* Simulate native event when changing value on reentrant

* Change wasn't being called

* Use Simulate only

* Use React event handlers on test

* Move commentary

* Lint commit

* Use native event

* Comment native event dispatching

* Prettier

* add setUntrackedValue

* Prettier-all

* Use dispatchEvent instead of ReactTestUtils Simulates;

* Prettier

* Fix lint

* Remove useless arg

* Wrap event dispatcher into function

* Remove deprecated Event

* Remove unused change event dispatcher

* Fix merge

* Prettier

* Add missing focus/blur calls

They are necessary to cover for the fix in #8240.
2017-10-26 19:22:10 +01:00
Andrew Clark
f751bd8877 Fuzz test across multiple roots (#11376)
While refactoring root scheduler, I noticed we have few tests that
cover updates across multiple roots. To address, I've added multiple
root cases to the fuzz tester.

Includes a hard-coded test case that was failing before #11307 landed.
2017-10-26 11:03:40 -07:00
Dan Abramov
5f6159fa84 Coverage works again 2017-10-26 18:57:30 +01:00
Thiago Galvani
dee4cc2cb3 Documentation on README (#11368)
* Adding the Documentation to the README

* Updating the Documentation to the README

* Tweaks
2017-10-26 18:06:25 +01:00
Dustan Kasten
80849fd1c6 Flow-ify ReactPartialRenderer (#11251)
* flow ReactPartialRenderer

* prettier

* moving flow type around;

* Move anys to DEV-only code path and keep it typechecked

* Increase Flow coverage
2017-10-26 17:59:29 +01:00
Matteo Vesprini-Heidrich
b0bb1b46aa reference yarn instead of npm in dom fixtures README (#11374)
* reference yarn instead of npm in dom fixtures README

* Update README.md
2017-10-26 17:51:58 +01:00
Matteo Vesprini-Heidrich
bd3a00b326 make yarn lock file current (#11375) 2017-10-26 17:51:33 +01:00
Dustan Kasten
399029444f maybe proactively redirect some doc site issues (#11235)
* maybe proactively redirect some doc site issuesg

* Update ISSUE_TEMPLATE.md
2017-10-26 15:27:16 +01:00
Dan Abramov
8f4ccc2bd3 Fix stray absolute imports 2017-10-26 15:18:34 +01:00
Dan Abramov
707ca7f492 Update Jest and remove hacks (#11372)
* Update Jest

* Remove hacks for Jest + Workspace integration

They were fixed by https://github.com/facebook/jest/pull/4761.

* Use relative requires in tests relying on private APIs

I changed them to absolute to work around a Jest bug.
The bug has been fixed so I can revert my past changes now.
2017-10-26 15:15:24 +01:00
Andrew Clark
3addf205bf Remove Task priority (#11307)
* Remove Task priority

The concept of Task priority was originally added as a way to avoid
reentrancy. Sync priority is for work that flushes synchronously, and
Task is for work that flushes at the end of the event loop.

But it turns out that in most cases, it's simpler to model Task and
Sync as the same priority level. For example, it's never correct to
flush Sync work from the update queue without flushing Task. Doing so
can lead to infinite update loops.

And using a separate priority level is not necessary to avoid
reentrancy. We already track when work is being rendered, and exit
before entering the render cycle again. That alone is sufficient.

This commit removes Task priority from the codebase. Now we use the
same level for both truly synchronous work and work that is deferred
until the end of the event loop.

This also enables us to remove DOM-specific legacy cases from the 
reconciler and lift them to the renderer.

* Remove isUnbatched from FiberRoot

Simpler to render unbatched roots immediately.

* Use a cyclic linked list for root schedule

Avoids the need for a separate `isScheduled` field.
2017-10-25 16:51:45 -07:00
Brian Vaughn
c86ae4b46f Added naive scheduleDeferredCallback implementation for RN (#11362)
* Added naive scheduleDeferredCallback implementation for RN

* Fixed ReactNative shim's expected @provideModule
2017-10-25 14:13:34 -07:00
Dan Abramov
396eb8698b Add disclaimer 2017-10-25 20:47:47 +01:00
Dan Abramov
2c0a8fb99e Add react-call-return package (#11364) 2017-10-25 22:23:55 +03:00
Dan Abramov
8e1f7f76fb Temporarily hide broken coverage reporting 2017-10-25 19:12:13 +01:00
Dan Abramov
087c48bb36 Reorder imports (#11359)
* Reorder imports

* Record sizes
2017-10-25 21:07:54 +03:00
Dan Abramov
f1c6488f1b Forbid adding new files with @providesModule (#11361)
* Forbid adding new files with @providesModule

* Turn off Haste mode in Flow config

* chmod a+x

* Try to fix bash

* Try to fix bash again
2017-10-25 19:50:34 +03:00
Brian Vaughn
72ba8db504 Added unit test that would have caught the recent error code transform regression (#11356)
* Added an automated test that would have caught the recent error code transform bug

* Renamed dev-expression-with-codes test to replace-invariant-error-codes

* Formatting nit
2017-10-25 08:21:55 -07:00
Dan Abramov
3ad5bd803f Expose TapEventPlugin on the www bundle (#11360) 2017-10-25 17:37:49 +03:00
Dan Abramov
96ed55ff80 Remove accidental art peerDep from react-art
Probably a rebase issue.
2017-10-25 14:52:06 +01:00
Dan Abramov
1eed302d34 Drop Haste (#11303)
* Use relative paths in packages/react

* Use relative paths in packages/react-art

* Use relative paths in packages/react-cs

* Use relative paths in other packages

* Fix as many issues as I can

This uncovered an interesting problem where ./b from package/src/a would resolve to a different instantiation of package/src/b in Jest.

Either this is a showstopper or we can solve it by completely fobbidding remaining /src/.

* Fix all tests

It seems we can't use relative requires in tests anymore. Otherwise Jest becomes confused between real file and symlink.
https://github.com/facebook/jest/issues/3830

This seems bad... Except that we already *don't* want people to create tests that import individual source files.
All existing cases of us doing so are actually TODOs waiting to be fixed.

So perhaps this requirement isn't too bad because it makes bad code looks bad.

Of course, if we go with this, we'll have to lint against relative requires in tests.
It also makes moving things more painful.

* Prettier

* Remove @providesModule

* Fix remaining Haste imports I missed earlier

* Fix up paths to reflect new flat structure

* Fix Flow

* Fix CJS and UMD builds

* Fix FB bundles

* Fix RN bundles

* Prettier

* Fix lint

* Fix warning printing and error codes

* Fix buggy return

* Fix lint and Flow

* Use Yarn on CI

* Unbreak Jest

* Fix lint

* Fix aliased originals getting included in DEV

Shouldn't affect correctness (they were ignored) but fixes DEV size regression.

* Record sizes

* Fix weird version in package.json

* Tweak bundle labels

* Get rid of output option by introducing react-dom/server.node

* Reconciler should depend on prop-types

* Update sizes last time
2017-10-25 02:55:00 +03:00
Dan Abramov
37baacb096 Update CI environment (Node 8, Yarn 1.2.1) (#11355) 2017-10-24 22:32:26 +03:00
Dan Abramov
d20af23598 Add item to changelog 2017-10-24 19:53:35 +01:00
Dan Abramov
793a28d698 Use simple invariant in case of missing error codes (#11350) 2017-10-24 09:11:03 -07:00
Dan Abramov
d5f26b041e Rename Haste modules (#11349) 2017-10-24 17:26:07 +03:00
Dan Abramov
f6c60dcbcd Expose react-art/{Circle,Rectange/Wedge} on npm (#11343)
* Include ART shapes into npm package

* Fix the fixture

* Prettier oops
2017-10-23 21:18:11 +03:00
Dan Abramov
0ebcbd4f1e Update changelog 2017-10-23 18:35:02 +01:00
Dan Abramov
c148e5415e Make "art" a dependency of "react-art" (#11341)
* Make "art" a dependency of "react-art"

* Add it back to root devDeps
2017-10-23 19:00:41 +03:00
Dan Abramov
faf3697e03 Add "prop-types" to dependencies of "react-test-renderer" (#11340) 2017-10-23 18:14:33 +03:00
Dan Abramov
4ceb5a4aa0 Record sizes 2017-10-23 15:06:36 +01:00
Vladimir Tsibizow
a30d01ad04 [React Children][Flow] Removed useless typechecking, because this file have`t flow comment (#11323) 2017-10-22 14:14:13 +01:00
Brian Vaughn
2d7c754f3b Delete unused code in ReactDOMFrameScheduling (#11301) 2017-10-21 08:54:45 -07:00
Leo Selig
69fcc81ce4 Fix renderer example links in README of react-reconciler (#11312)
Fixes facebook/react/issues/#11310
2017-10-21 15:13:54 +01:00
Dan Abramov
97776fb6d2 Move DOM-specific event files to the right folder (#11305) 2017-10-20 21:36:53 +01:00
Andrew Clark
2e4663f616 Split performWork into renderRoot and commitRoot (#11264)
* Split performWork into renderRoot and commitRoot

It turns out that the scheduler is too coupled to how the DOM renderer
works. Specifically, the requestIdleCallback model, and how roots are
committed immediately after completing. Other renderers have different
constraints for when to yield and when to commit work.

We're moving towards a model where the scheduler only works on a single
root at a time, and the render phase and commit phase are split into
distinct entry points. This gives the renderer more control over when
roots are committed, coordinating multiple roots, deferring the commit
phase, batching updates, when to yield execution, and so on.

In this initial commit, I've left the renderers alone and only changed
the scheduler. Mostly, this involved extracting logic related to
multiple roots and moving it into its own section at the bottom of the
file. The idea is that this section can be lifted pretty much as-is
into the renderers. I'll do that next.

* Remove FiberRoot scheduleAt

Isn't actually used anywhere

* Make the root schedule a linked list again

Since this still lives inside the renderer, let's just use the
FiberRoot type. The FiberRoot concept will likely be lifted out
eventually, anyway.

* commitRoot should accept a HostRoot

This way it's less reliant on the alternate model

* Unify branches

* Remove dead branch

onUncaughtError is only called while we're working on a root.

* remainingWork -> remainingExpirationTime

I was wary of leaking NoWork but mixing numbers and null is worse so
let's just do it until we think of something better.

* Rename stuff
2017-10-20 13:22:29 -07:00
Brian Vaughn
c7d28a0136 Fix build/sync script for RN/CS/RT (#11302)
While testing some changes to RN, I noticed that the '--sync-fbsource' flag had been broken recently by things being moved around and the newly-added CS renderer. Fixed it up.
2017-10-20 12:58:53 -07:00
Dan Abramov
e779c39dfe Flatten everything (#11304)
* Flatten everything

* Fix ReactDOMServerNode build

* Fix native builds
2017-10-20 20:14:52 +01:00
Dan Abramov
cc1ff874e5 Remove outdated TODO 2017-10-20 17:34:16 +01:00
Brian Vaughn
fa5adb3bc4 Release script no longer auto-updates peerDependencies react version (#11292)
* Release script ensures peer dep matches release major version, but otherwise no longer auto-updates them to exactly match the release version.
* f
2017-10-20 08:53:15 -07:00
Brian Vaughn
845b1afdc5 Rollup script can now extract error codes and build in a single pass (#11291)
* Rollup build scripts can now extract error codes while building

* I can't spell ternary
2017-10-20 08:35:33 -07:00
Dan Abramov
2de3702d93 Rename shared/event/eventPlugins -> shared/event/plugins
Forgot this as part of my last PR.
Mirrors new ReactDOM structure.
2017-10-20 13:58:42 +01:00
Dan Abramov
ab853e6f3e Group event code together and forbid cross-client/server imports (#11298)
* react-dom/src/syntheticEvents => events, and put plugins into it

* Flatten react-dom/src/shared

* Split react-dom/src/client/utils into event/ and root client folder

Makes it clearer what is used by what.

* Strictly separate modules that can be imported by client and server
2017-10-20 13:51:50 +01:00
Dan Abramov
c080537a7b Flatten the shared/ folder (#11297)
* shared/src -> shared

It's not a real package and doesn't even have package.json.
This will also make importing less weird if we drop Haste.

* Get rid of shared/utils

Moved event-specific into shared/event.
Moved rest to the root since distinction has always been pretty arbitrary.

* Fix references to old shared/src paths
2017-10-20 12:59:57 +01:00
Dan Abramov
08ff3d749d Move files in react package (#11294)
* Move files in react package

* Move test-only TypeScript definitions into tests subfolder
2017-10-20 11:26:37 +01:00
David Gilbertson
73527237e6 Fix typos in comments (#11295) 2017-10-20 11:15:17 +01:00
Dan Abramov
313611572b Reorganize code structure (#11288)
* Move files and tests to more meaningful places

* Fix the build

Now that we import reconciler via react-reconciler, I needed to make a few tweaks.

* Update sizes

* Move @preventMunge directive to FB header

* Revert unintentional change

* Fix Flow coverage

I forgot to @flow-ify those files. This uncovered some issues.

* Prettier, I love you but you're bringing me down
Prettier, I love you but you're bringing me down

Like a rat in a cage
Pulling minimum wage
Prettier, I love you but you're bringing me down

Prettier, you're safer and you're wasting my time
Our records all show you were filthy but fine
But they shuttered your stores
When you opened the doors
To the cops who were bored once they'd run out of crime

Prettier, you're perfect, oh, please don't change a thing
Your mild billionaire mayor's now convinced he's a king
So the boring collect
I mean all disrespect
In the neighborhood bars I'd once dreamt I would drink

Prettier, I love you but you're freaking me out
There's a ton of the twist but we're fresh out of shout
Like a death in the hall
That you hear through your wall
Prettier, I love you but you're freaking me out

Prettier, I love you but you're bringing me down
Prettier, I love you but you're bringing me down
Like a death of the heart
Jesus, where do I start?
But you're still the one pool where I'd happily drown

And oh! Take me off your mailing list
For kids who think it still exists
Yes, for those who think it still exists
Maybe I'm wrong and maybe you're right
Maybe I'm wrong and maybe you're right
Maybe you're right, maybe I'm wrong
And just maybe you're right

And oh! Maybe mother told you true
And there'll always be somebody there for you
And you'll never be alone
But maybe she's wrong and maybe I'm right
And just maybe she's wrong
Maybe she's wrong and maybe I'm right
And if so, here's this song!
2017-10-19 19:50:24 +01:00
Dan Abramov
1740f30d5c Fix production crash (#11286)
* Fix production crash

* Add regression test
2017-10-19 19:12:07 +01:00
Dan Abramov
1a81be4625 Include component stack in more places, including SSR (#11284)
* Include component stack in more places, including SSR

* Forbid including reconciler code into the server bundle

* Tighten up the Flow annotation

* Fix lint

* Gosh Prettier
2017-10-19 17:43:40 +01:00
Dan Abramov
f56ca479be Add component stack to invalid style warnings (#11282) 2017-10-19 16:46:39 +01:00
Dan Abramov
c625b868f5 Only renderers should depend on reconciler code (#11281)
* Only renderers should depend on reconciler code

* Remove react-art dependency on react-dom modules

They share ReactDOMFrameScheduling so I moved it to shared.
2017-10-19 15:52:45 +01:00
Sebastian Markbåge
b52a5624e9 [CS] Persistent Updates (#11260)
* Update build size

* [CS] Clone container instead of new root concept

The extra "root" concept is kind of unnecessary. Instead of having a
mutable container even in the persistent mode, I'll instead make the
container be immutable too and be cloned. Then the "commit" just becomes
swapping the previous container for the new one.

* Change the signature or persistence again

We may need to clone without any updates, e.g. when the children are changed.

Passing in the previous node is not enough to recycle since it won't have the
up-to-date props and children. It's really only useful to for allocation pooling.

* Implement persistent updates

This forks the update path for host fibers. For mutation mode we mark
them as having an effect. For persistence mode, we clone the stateNode with
new props/children.

Next I'll do HostRoot and HostPortal.

* Refine protocol into a complete and commit phase

finalizeContainerChildren will get called at the complete phase.
replaceContainer will get called at commit.

Also, drop the keepChildren flag. We'll never keep children as we'll never
update a container if none of the children has changed.

* Implement persistent updates of roots and portals

These are both "containers". Normally we rely on placement/deletion effects
to deal with insertions into the containers. In the persistent mode we need
to clone the container and append all the changed children to it.

I needed somewhere to store these new containers before they're committed
so I added another field.

* Commit persistent work at the end by swapping out the container

* Unify cloneOrRecycle

Originally I tried to make the recyclable instance nullable but Flow didn't
like that and it's kind of sketchy since the instance type might not be
nullable.

However, the real difference which one we call is depending on whether they
are equal. We can just offload that to the renderer. Most of them won't
need to know about this at all since they'll always clone or just create
new.

The ones that do know now have to be careful to compare them so they don't
reuse an existing instance but that's probably fine to simplify the
implementation and API.

* Add persistent noop renderer for testing

* Add basic persistent tree test

* Test bail out

This adds a test for bailouts. This revealed a subtle bug. We don't set the
return pointer when stepping into newly created fibers because there
can only be one. However, since I'm reusing this mechanism for persistent
updates, I'll need to set the return pointer because a bailed out tree
won't have the right return pointer.

* Test persistent text nodes

Found another bug.

* Add persistent portal test

This creates a bit of an unfortunate feature testing in the unmount
branch.

That's because we want to trigger nested host deletions in portals in the
mutation mode.

* Don't consider container when determining portal identity

Basically, we can't use the container to determine if we should keep
identity and update an existing portal instead of recreate it. Because
for persistent containers, there is no permanent identity.

This makes it kind of strange to even use portals in this mode. It's
probably more ideal to have another concept that has permanent identity
rather than trying to swap out containers.

* Clear portals when the portal is deleted

When a portal gets deleted we need to create a new empty container and
replace the current one with the empty one.

* Add renderer mode flags for dead code elimination

* Simplify ReactNoop fix

* Add new type to the host config for persistent configs

We need container to stay as the persistent identity of the root atom.
So that we can refer to portals over time.

Instead, I'll introduce a new type just to temporarily hold the children
of a container until they're ready to be committed into the permanent
container. Essentially, this is just a fancy array that is not an array
so that the host can choose data structure/allocation for it.

* Implement new hooks

Now containers are singletons and instead their children swap. That way
portals can use the container as part of their identity again.

* Update build size and error codes

* Address comment

* Move new files to new location
2017-10-18 18:28:23 -07:00
Dan Abramov
4af2a24f00 Update contribution instructions (#11276) 2017-10-19 01:03:55 +01:00
Dan Abramov
338036fa50 Delete unnecessary typing from the website 2017-10-19 00:45:48 +01:00
Dan Abramov
d9c1dbd617 Use Yarn Workspaces (#11252)
* Enable Yarn workspaces for packages/*

* Move src/isomorphic/* into packages/react/src/*

* Create index.js stubs for all packages in packages/*

This makes the test pass again, but breaks the build because npm/ folders aren't used yet.
I'm not sure if we'll keep this structure--I'll just keep working and fix the build after it settles down.

* Put FB entry point for react-dom into packages/*

* Move src/renderers/testing/* into packages/react-test-renderer/src/*

Note that this is currently broken because Jest ignores node_modules,
and so Yarn linking makes Jest skip React source when transforming.

* Remove src/node_modules

It is now unnecessary. Some tests fail though.

* Add a hacky workaround for Jest/Workspaces issue

Jest sees node_modules and thinks it's third party code.

This is a hacky way to teach Jest to still transform anything in node_modules/react*
if it resolves outside of node_modules (such as to our packages/*) folder.

I'm not very happy with this and we should revisit.

* Add a fake react-native package

* Move src/renderers/art/* into packages/react-art/src/*

* Move src/renderers/noop/* into packages/react-noop-renderer/src/*

* Move src/renderers/dom/* into packages/react-dom/src/*

* Move src/renderers/shared/fiber/* into packages/react-reconciler/src/*

* Move DOM/reconciler tests I previously forgot to move

* Move src/renderers/native-*/* into packages/react-native-*/src/*

* Move shared code into packages/shared

It's not super clear how to organize this properly yet.

* Add back files that somehow got lost

* Fix the build

* Prettier

* Add missing license headers

* Fix an issue that caused mocks to get included into build

* Update other references to src/

* Re-run Prettier

* Fix lint

* Fix weird Flow violation

I didn't change this file but Flow started complaining.
Caleb said this annotation was unnecessarily using $Abstract though so I removed it.

* Update sizes

* Fix stats script

* Fix packaging fixtures

Use file: instead of NODE_PATH since NODE_PATH.
NODE_PATH trick only worked because we had no react/react-dom in root node_modules, but now we do.

file: dependency only works as I expect in Yarn, so I moved the packaging fixtures to use Yarn and committed lockfiles.
Verified that the page shows up.

* Fix art fixture

* Fix reconciler fixture

* Fix SSR fixture

* Rename native packages
2017-10-19 00:22:21 +01:00
Andrew Clark
76659c418f Use sigil instead of comparing baseState to null 2017-10-18 15:39:58 -07:00
Andrew Clark
d9647282e6 Better fix for base state bug (#11273) 2017-10-18 15:11:47 -07:00
Andrew Clark
8707755676 Render-phase setState bugfix (#11272)
Fixes a bug surfaced by www unit test.

I'm not yet sure the best way to test this; in the interest of landing
this fix quickly, I'll save the test for a follow-up.
2017-10-18 14:32:31 -07:00
Dan Abramov
dee604dbe2 Add static injection for feature flags (#11269)
* Replace ReactDOMFeatureFlags with ReactFeatureFlags

* Add static injection for feature flags
2017-10-18 18:40:52 +01:00
Flarnie Marchan
101934646f Add note to 'unreleased' CHANGELOG about deprecating Bower (#11262)
* Add note to 'unreleased' CHANGELOG about deprecating Bower

**what is the change?:**
We will no longer release new versions of React to Bower, and we should
announce that as part of our CHANGELOG.

**why make this change?:**
We decided on this as a team.

**test plan:**
Visual inspection and spell check. :)

**issue:**
Just follow-up for https://github.com/facebook/react/pull/11223

* Improve messaging/formatting

* Move bower deprecation notice to top of changelog
2017-10-18 08:42:22 -07:00
243083df
4b7c562bba Remove unnecessary comparison; (#11215) 2017-10-18 15:00:56 +01:00
Dan Abramov
d7c271e5ed Update rolling changelog 2017-10-18 14:58:34 +01:00
Michał Matyas
03a3934e0e Fix forceUpdate in shallow test renderer (#11239) 2017-10-18 14:54:06 +01:00
Dan Abramov
c539be0515 Remove unused bundle flag (#11267) 2017-10-18 14:00:44 +01:00
Ethan Arrowood
a3a10db22c Added component stack to contentEditable warning (#11208)
* Added component stack to contentEditable warning

* Added component stack to contentEditable warning
2017-10-18 13:59:43 +01:00
Dan Abramov
066f02281b Put NativeCS bundles into their own directory (#11266) 2017-10-18 13:56:07 +01:00
Dan Abramov
ce335f7021 Delete .netlify (#11261) 2017-10-17 23:37:11 +01:00
Dan Abramov
daf75f0671 Record sizes 2017-10-17 22:54:11 +01:00
Brian Vaughn
90370f28ff Removed test utils dependency on test renderer from bundle config (#11259) 2017-10-17 14:31:12 -07:00
Dan Abramov
0e5767824f Don't mark portals for updates (#11255) 2017-10-17 20:53:15 +01:00
Dustan Kasten
94e8e9d88e isPortal() is not referenced anywhere (#11256) 2017-10-17 20:27:54 +01:00
Dan Abramov
56e5288b04 Remove broken links from React ART readme 2017-10-17 14:20:48 +01:00
Dan Abramov
1ef250d881 Move Flow environment into scripts/flow (#11249)
* Move flow environment into scripts/flow

* Run Prettier
2017-10-17 14:20:00 +01:00
Dan Abramov
979fce8b72 Delete adler32 implementation (#11250) 2017-10-17 14:19:47 +01:00
Dan Abramov
5be6a1a6d1 Drop name and commonerConfig from package.json (#11244) 2017-10-17 13:34:01 +01:00
Dan Abramov
043d369210 Simplify Jest-specific tests (#11243)
* Delete tests that only mattered during createElement transition

They were added after #2576, but were only important when React.createElement was introduced as a migration path.
Now that elements are used consistently, these tests shouldn't be necessary.

I created a separate test specifically for scryRenderedComponentsWithType() though because that was the only one.

* Simplify mocking test setup

Today, the only remaining special behavior for Jest mocks is we let them render undefined.

We don't plan to introduce any other special behavior for them in the future.
(In fact, we already decided against replicating this special behavior for functional components.)

Therefore, we can remove dependency on Jest automocking mechanism in these tests completely,
and just explicitly mock the render method which is the only one for which we have special behavior.

For clarity, we add an explicit test for mockComponent() API (whose naming is a bit of a lie).
2017-10-17 13:05:44 +01:00
Dan Abramov
49d4381c67 Simplify Jest config a little bit (#11242)
* Inline getTestDocument into test cases

* Remove mention of mock file we do not use

* Remove unused configuration entries

* Move eslint-rules package into the scripts/ folder
2017-10-16 23:17:00 +01:00
Brian Vaughn
9ed78ad277 Tweaked wording of release script README 2017-10-16 15:02:41 -07:00
Brian Vaughn
c371c152ab Release script (#11223)
* First chunk of new release script

* Re-ordered build steps to combine error codes and releases

* Reorganized build files; added stub publish script

* First pass at publis script. Also collect and print dry-run commits/publish commands.

* Deleted old react-release-manager scripts

* Cleaned up release package.json

* Basic README instructions

* Removed unnecessary 'async' keyword from a method

* Wordsmithing

* Tweaked README

* Renamed build -> build-commands and publish -> publish-commands to avoid conflict with .gitignore

* Bump pre-release package versions differently

* Prettier

* Improved CircleCI API token setup instructions message

* Lint fix

* Typofix
2017-10-16 15:01:14 -07:00
Dan Abramov
b5a2a1349d Bump Jest version (#11241) 2017-10-16 21:38:34 +01:00
Dan Abramov
f8134966c9 Record sizes 2017-10-16 20:51:36 +01:00
Clark Du
b623bf43a0 Use value on <select> instead of setting selected on <option> (#11206) 2017-10-16 07:46:24 -04:00
Fatos Morina
17de6a35cf Fix typos (#11204)
* Use an MVP rather than a MVP

* Use the capital letter for React and highlight eslint-plugin

* Fix typos
2017-10-14 16:26:10 -04:00
Andrew Clark
7687962249 ReactDOM.createRoot (#11225)
* ReactDOM.createRoot

Introduce new API for creating roots. Only root.render and root.unmount
are implemented. Later we'll add root.prerender, and support for lazy
roots (roots with DOM containers that resolve lazily).

* Add hydrate option to createRoot
2017-10-13 20:08:36 -07:00
Andrew Clark
3ffb5d0876 Deterministic updates (#10715)
* Deterministic updates

High priority updates typically require less work to render than
low priority ones. It's beneficial to flush those first, in their own
batch, before working on more expensive low priority ones. We do this
even if a high priority is scheduled after a low priority one.

However, we don't want this reordering of updates to affect the terminal
state. State should be deterministic: once all work has been flushed,
the final state should be the same regardless of how they were
scheduled.

To get both properties, we store updates on the queue in insertion
order instead of priority order (always append). Then, when processing
the queue, we skip over updates with insufficient priority. Instead of
removing updates from the queue right after processing them, we only
remove them if there are no unprocessed updates before it in the list.

This means that updates may be processed more than once.

As a bonus, the new implementation is simpler and requires less code.

* Fix ceiling function

Mixed up the operators.

* Remove addUpdate, addReplaceState, et al

These functions don't really do anything. Simpler to use a single
insertUpdateIntoFiber function.

Also splits scheduleUpdate into two functions:

- scheduleWork traverses a fiber's ancestor path and updates their
  expiration times.
- scheduleUpdate inserts an update into a fiber's update queue, then
  calls scheduleWork.

* Remove getExpirationTime

The last remaining use for getExpirationTime was for top-level async
updates. I moved that check to scheduleUpdate instead.

* Move UpdateQueue insertions back to class module

Moves UpdateQueue related functions out of the scheduler and back into
the class component module. It's a bit awkward that now we need to pass
around createUpdateExpirationForFiber, too. But we can still do without
addUpdate, replaceUpdate, et al.

* Store callbacks as an array of Updates

Simpler this way.

Also moves commitCallbacks back to UpdateQueue module.

* beginUpdateQueue -> processUpdateQueue

* Updates should never have an expiration of NoWork

* Rename expiration related functions

* Fix update queue Flow types

Gets rid of an unneccessary null check
2017-10-13 17:21:25 -07:00
Sebastian Markbåge
36a2afccc5 [CS] Split Host Config Out into a Mutable or Immutable Mode (#11213)
* CS renderer

Because we didn't have enough RN experiments. I want to add one more.

* Split out hydration from the host config object

This makes it easier to do feature detection on the configuration.

* Move mutation host config to separate optional object

* Refs and life-cycles should happen even in immutable mode

* Unmount components even in non-mutation mode

This is the same as committing deletions but instead of finding host
components to delete, it only invokes componentWillUnmount and detaching
of refs.

* Add persistent updates API

This mode will use a clone based API instead of mutating host instances.

Needs implementation still.

It's awkward that there can be more than one child inserted into the root.
So we need a new API to create a "root" instance so that we can update it
atomically. Alternatively we could keep the mutable API for containers
and assume that most use cases would only have a single root.

* Package up CS renderer

* Fix reconciler package fixture
2017-10-13 14:29:59 -07:00
Andrew Clark
339d6cb32b Sync setStates inside willUpdate and didUpdate should flush at same time (#11212)
In sync mode, we downgrade sync priority work to task work when we're in
the commit phase, but not in the render phase. That means if you
schedule updates in both phases, the render phase update will flush
first, and the commit phase update will flush after that. What should
really happen is that both updates flush at the same time.

To solve this, updates in the commit phase are now given sync priority.
The distinction between task and sync really only exists to account for
a historical quirk in the behavior of top-level mounts. (Refer to the
test case titled "initial mount is sync inside batchedUpdates".)

Ideally, there would only be one priority for both sync and task. This
gets us closer to that model, while still accounting for
top-level mounts.
2017-10-12 21:05:58 -07:00
Haroen Viaene
0c5a455ecb chore(syntheticEvent): remove IE8 code (#11178)
* chore(syntheticEvent): remove IE8 code

Since IE8 has been deprecated for a while, I thought it might be useful to remove some IE8-only code

If this is not something you want to focus on yet, or is too much work to test, feel free to close this PR

* Update SyntheticUIEvent.js

* Update SyntheticUIEvent.js

* remove unused require

* completely remove UIEvent

* augment with noop

everything breaks otherwise

* comment back

* spacing
2017-10-12 17:30:47 -04:00
Nathan Hunzaker
19043236be Add exception for 16.alpha when loading React in DOM Fixtures (#11200)
The file structure was updated in 16. This wasn't the case for
alphas. We need to load the old module location for anything less than
16 RC.
2017-10-12 17:30:03 -04:00
Andrew Clark
8ac9600574 Remove priority coalescing and PriorityLevel module (#11187)
Coalescing is the only feature that depends on PriorityLevel. Since
we're not sure if coalescing is even valuable, we'll remove it for
now. If it turns out we need it, we can add it back later.
2017-10-11 14:48:44 -07:00
Dustan Kasten
111731dedd React reconciler package (#10758)
* Initial commit of react-reconciler bundle

* I think it’s working 🙀

* React reconciler: slightly better description and README

* Drop react-reconciler version to an unstable release number

* Convert to moduleType enum and fix packaging

* eslint

* s/Renderer/Reconciler in docs

* yarn prettier

* change names of things in the react-reconciler readme

* change predicate

* rollup: flip object-assign shimming check

* copy noop renderer into react-reconciler fixture

* Change reconciler fixture test

* prettier

* Remove a bunch of Noop test renderer

* Delete a bunch of stuff we don’t care about for reconciler teesting. Add flow pragmas for future flow pragma testing

* Remove PATENTS

* Update Reconciler fixture docs

* ReactDOMUnstableNativeDependencies should be ISOMORPHIC

* Inline fixture renderer

* Make it "RENDERER"

* There is no UMD build. It also doesn't need propTypes.

* Tweak how the reconciler is built

* Record sizes

* Update README.md
2017-10-11 19:29:26 +01:00
Dan Abramov
fb0199b73c Add to changelog 2017-10-11 19:08:25 +01:00
Dan Abramov
6c592deac9 Record sizes 2017-10-11 19:06:43 +01:00
Dan Abramov
2228f497f3 Keep autoFocus attribute in the DOM (#11192)
* Keep autoFocus attribute in the DOM

* Don't emit autoFocus attribute on the client

* Test that hydration doesn't call focus

* Add autoFocus to SSR fixture
2017-10-11 18:52:12 +01:00
Dan Abramov
b75be6a363 Move loop init variable assignment (#11182) 2017-10-11 11:46:15 +01:00
Dan Abramov
4a26b90cfa Fix DOM fixture for 16.0.0 2017-10-11 10:50:00 +01:00
Brian Vaughn
8b3ad851fd Update build scripts to put RN-RT files in the right places (#11183) 2017-10-10 13:44:43 -07:00
Dan Abramov
e5db5302ac Fix false positive <noscript> rehydration text difference warning in React 16 (#11157)
* Add <noscript> with HTML in it to SSR fixture

* Wrap <noscript> into a <div> to get its "client HTML"

* Revert "Wrap <noscript> into a <div> to get its "client HTML""

This reverts commit 27a42503e2790a0d5cf0b90451a664fc6ab9d862.

* Always use parent.ownerDocument
2017-10-10 19:35:43 +01:00
Dan Abramov
f42dfcdb94 Fix false positive SVG hydration warning for mixed case tags (#11174)
* Add a failing test for <feMorphology> SSR

It causes a false positive warning on hydration.

* Make hydration tag comparison case insensitive
2017-10-10 19:34:37 +01:00
Dan Abramov
18f408fb6b Update changelog 2017-10-10 17:57:45 +01:00
Dan Abramov
309fa6c871 Don't set empty placeholder to work around IE11 bug (#11177)
* Don't set empty placeholder to work around IE11 bug

* Add fixture for textarea placeholders
2017-10-10 17:49:59 +01:00
Dan Abramov
10320a5331 Update changelog 2017-10-10 16:58:19 +01:00
Dustan Kasten
9b4e4e1759 Fix obscure error message when passing an invalid style value for SSR (#11173)
* Add failing iframe test

* Possible fix by returning null ownerName in SSR

* prettier

* eslolint

* gah c’mon really?

* emptyFunction.thatReturnsNull

* One less property access
2017-10-10 16:57:25 +01:00
Shirshak Bajgain
45c05c7097 Remove broken link from licence (#11176) 2017-10-10 16:57:00 +01:00
Dan Abramov
09cafa6e40 Changelog 2017-10-10 16:56:42 +01:00
Brandon Dail
5c6cb597f9 Fix form reset for uncontrolled select elements (#11057)
* Set defaultSelected on option element from select's defaultValue

* Add form reset fixture for selects

* Pass explicit value for setDefaultSelected
2017-10-10 16:54:59 +01:00
Dan Abramov
b2101cb328 Record sizes 2017-10-10 16:06:05 +01:00
Dan Abramov
20471d693d Update changelog 2017-10-10 12:35:24 +01:00
Filipp Riabchun
2264e3d044 Shallow renderer: support multiple setState invocation (#11167) 2017-10-10 12:33:57 +01:00
Dan Abramov
44c795c45f Update rolling changelog 2017-10-10 11:59:29 +01:00
Ori Riner
6ad6dcd112 Clear previous children when SVG node doesn't have innerHTML (#11108)
* clear previous children when SVG node doesn't have innerHTML

* remove 'get' handler for appendChild in test node proxy
2017-10-10 11:54:47 +01:00
Andrew Clark
3019210df2 Expiration times (#10426)
* [Work-in-progress] Assign expiration times to updates

An expiration time represents a time in the future by which an update
should flush. The priority of the update is related to the difference
between the current clock time and the expiration time. This has the
effect of increasing the priority of updates as time progresses, to
prevent starvation.

This lays the initial groundwork for expiration times without changing
any behavior. Future commits will replace work priority with
expiration times.

* Replace pendingWorkPriority with expiration times

Instead of a priority, a fiber has an expiration time that represents
a point in the future by which it should render.

Pending updates still have priorities so that they can be coalesced.

We use a host config method to read the current time. This commit
implements everything except that method, which currently returns a
constant value. So this just proves that expiration times work the same
as priorities when time is frozen. Subsequent commits will show the
effect of advancing time.

* Triangle Demo should use a class

shouldComponentUpdate was removed from functional components.

Running the demo shows, now that expiration is enabled, the demo does
not starve. (Still won't run smoothly until we add back the ability to
resume interrupted work.)

* Use a magic value for task expiration time

There are a few cases related to sync mode where we need to distinguish
between work that is scheduled as task and work that is treated like
task because it expires. For example, batchedUpdates. We don't want to
perform any work until the end of the batch, regardless of how much
time has elapsed.

* Use current time to calculate expiration time

* Add unit tests for expiration and coalescing

* Delete unnecessary abstraction

* Move performance.now polyfill to ReactDOMFrameScheduling

* Add expiration to fuzz tester

* Expiration nits

- Rename Done -> NoWork
- Use max int32 instead of max safe int
- Use bitwise operations instead of Math functions
2017-10-09 18:39:53 -07:00
Georgios Giannoutsos Barkas
65b16b1c7e Allow custom attribute named on to be passed on to elements (#11153)
* Allow single `on` property for custom elements

* Remove test from ReactDOMComponent-test

* Allow custom attribute named 'on' to be passed

* Check property length instead of comparing strings
2017-10-09 17:31:24 -07:00
Dan Abramov
80596c2c92 Fix incorrect calculation of onMouseEnter/Leave component path (#11164)
* Add a regression test for #10906

* Turn while conditions into breaks without changing the logic

This will be easier to follow when we add more code there.

* var => const/let

So that I can add a block scoped variable.

* Check alternates when comparing to the common ancestor

This is the actual bugfix.
2017-10-09 20:30:03 +01:00
Dustan Kasten
08cbc257bd Bump peer deps of react to ^16.0.0 (#11156) 2017-10-09 16:00:50 +01:00
Sebastian Markbåge
4131af3e4b Ignore SSR warning using explicit suppressHydrationWarning option (#11126)
* Pass parent type and props to insert/delete hydration warning hooks

For this to work, we need to split the API into a container and normal
version. Since the root doesn't have a type nor props.

* Ignore SSR warning using explicit suppressHydrationWarning option

This lets you ignore the warning on a single element and its direct child
content. This is useful for simple fields that you're expecting to fail
such as time stamps.

Note that this still won't patch up such content so it'll remain
inconsistent. It's also not suitable for nested complex content that may
change.

* Suppress warning of inserted/deleted direct children

* Add fixture testing hydration warning

Also fixing the render->hydrate API change in the fixture

* Add hooks when text hydration doesn't match up

The purpose of these hooks is to pass the parent context to them. I don't
want to do that in the normal hydrateTextInstance hooks since this is
only used in DEV. This is also in line with what happens if there is no
text instance at all and we invoke didNotFindHydratableTextInstance.

* Move mismatch text hydration warning to the new hooks

This lets us ignore this call when we have parent props available and
the suppression flag is set.
2017-10-06 19:50:01 -07:00
Sebastian Markbåge
5744571140 [RT] More predictable things (#11139)
* Inject the right event emitter

Previously this was injecting the ReactNativeEventEmitter even though
we want the ReactNativeRTEventEmitter.

RCTEventEmitter is also just an abstraction around BatchedBridge that
registers a single name. We can't register more than one with it. Removed
that abstraction for now so we don't have to add it back into the RN repo.

* Unify appendChildToDetachedParent and appendChild, separate root

Merge appendChildToDetachedParent and appendChild. We don't need the distinction.

We do however need a separate notion for the root container.
Calling this `appendChildToContext` since Context has a meaning here.

* Add a simple shallow comparison so that we don't send updates for equal props

This still sends all props if any differs. Not sure we'll want that but I
think so.

* Add BatchedBridge to bundle externals

* Lint
2017-10-06 19:08:22 -07:00
Dan Abramov
190a1141cc Add an item to changelog 2017-10-06 23:08:25 +01:00
Anushree Subramani
e8629667ab Deduplication of warning messages in nested updates (#11081) (#11113) 2017-10-06 23:04:18 +01:00
Dan Abramov
c75eed29c6 Add more items to the rolling changelog 2017-10-06 21:47:49 +01:00
andreysaleba
12144517f9 Added check to deduplicate function type warning calls on each compon… (#11120)
* Added check to deduplicate function type warning calls on each component type

* Added test to check that 'function type as React child' warning is deduplicated correctly by component type

* Ran prettier on added code

* Modified test checking deduplication of 'Functions are not valid as a React child' warning so it will check against rerendering component now
2017-10-06 21:40:45 +01:00
Brian Vaughn
ebb1d316bd Delete documentation and website source (#11137)
* Deleted docs folder

* Deleted www folder

* Remove Netlify website build command

* Removed refs to docs and www from ESlint config

* Removed refs to www/docs from Flow config

* Removed unnecessary .gitignore config

* Updated license check to remove refs to docs

* Removed gh-pages specific portions of Circle build scripts
There may be more that we can remove (eg set_up_github_keys.sh) but I'm not positive

* Removed docs specific license
2017-10-06 10:18:05 -07:00
Nathan Hunzaker
09ed79a942 Add focus helper to range test, update button styles (#11134)
When testing range input change events, clicking the knob would cause
it to move if the click region wasn't precisely on the center of the
knob.

This is annoying! This commit adds a button to focus the range input
knob and takes a small pass at styling buttons.

A label would work here too, however it does not generate a focus ring
in all browsers.
2017-10-06 12:58:10 -04:00
Nathan Hunzaker
ea507f163b Use indexOf instead of includes in RangeKeyboardFixture (#11133)
Allows the DOM Fixture change test case to work in older browsers.
2017-10-06 10:45:57 -04:00
Sebastian Markbåge
7ec46e0fb0 [RT] Minor clean up (#11122)
* Rename rootNodeID -> tag

* Process RT props before forwarding them along

This is needed because the children prop can't be serialized.

Also, some minor placeholder for events.
2017-10-05 18:32:07 -04:00
Dan Abramov
44c32fc268 Ignore CR/LF differences when warning about markup mismatch (#11119)
* Add regression test for CR-insensitive hydration

* Normalize CR when comparing server HTML to DOM

* Move tests in the file

* Add a failing test for comparing attributes

* Normalize CR for attributes too

* Add a test case for CR in dangerouslySetInnerHTML

* Undo the fix per feedback

* Change the fix to be DEV-only and still patch up LF -> CR

* Remove the dangerouslySetInnerHTML test

It's always going to "pass" because we normalize HTML anyway.

Except that it won't pass because we intentionally don't patch up dangerouslyInnerHTML.

* Fix issue that Flow failed to catch

* Add null character tests

* Normalize both client and server value for the warning

* Fix the bug

* Normalize replacement character away as well

* Fix outdated comment
2017-10-05 20:59:43 +01:00
Dan Abramov
32ec797274 Adjacent text nodes in SSR should have comments between them despite components (#11109)
* Add a failing test for text nodes within components

* Reset the text node flag only when emitting tags

This ensures we don't reset it when we exit components that return strings.

* Add a failing test for a more complex tree

* Also reset text flag when emitting a footer

This fixes the {'a'}</div>{'b'} case and prevents an unnecessary comment before 'b'.
2017-10-05 20:05:00 +01:00
Dan Abramov
7d3b44bf37 Add production bundles for Test and Shallow renderers (#11112)
* Add production bundles for Test and Shallow renderers

* Remove unused/broken file from test renderer

* Add production bundle for TestUtils
2017-10-05 15:26:52 +01:00
Shi Yan
fa7461e25b Fix SyntheticEvent constructor comments (#11011) 2017-10-05 00:45:39 +01:00
Dan Abramov
a2efa51b92 Tweak wording based on @landermkerbey's suggestion in #10433#issuecomment-324488168 2017-10-04 21:44:12 +01:00
Sophie Alpert
dffb206a04 Remove references to PATENTS that crept in (#11091) 2017-10-04 12:40:41 -07:00
Yangshun Tay
2b0ef3c1bb Fix blog issues that resulted from migration (#11089) 2017-10-04 19:35:29 +01:00
Gustavo Gard
81b368cf97 Correct logo url (#11090) 2017-10-04 19:33:39 +01:00
Dominic Gannaway
e0b802fc4e Fixes example in Web Components docs (#11039)
* fixes docs on webcomponent

* Update web-components.md
2017-10-04 17:12:36 +01:00
Sophie Alpert
1ba7dfcf04 Rewrite ReactDOMSelection to use fewer ranges (#9992)
We heard from Chrome engineers that creating too many Range objects slows down Chrome because it needs to keep track of all of them for the case that anchor/focus nodes get removed from the document. We can just implement this calculation without ranges anyway.

jsdom doesn't support Range objects, but I copied the fuzz test code into my browser and manually compared it against our old implementation https://gist.github.com/sophiebits/2e6d571f4f10f33b62ea138a6e9c265c; with 200,000 trials no differences were found.
2017-10-03 18:48:30 -07:00
Sebastian Markbåge
761decb352 Fork React Native render into an "RT" renderer (#11072)
This is an experimental new protocol for some experiments we want to play
with. To make that easier, I'm just going to fork it.

This experiment won't use the event system so I by-pass it and just invoke
functions on the props object for now.

I also fork the UIManager into a new RTManager.
2017-10-03 18:48:23 -04:00
Brian Vaughn
53c1b8b0d7 Live code editor ignores tab key for improved a11y (#10992) 2017-10-03 11:15:00 -07:00
Fernando Poumian
25dbf03e66 [website] Add RSS Feed to website (#11056) 2017-10-03 11:06:30 -07:00
Haroen Viaene
e367a44789 style(docsearch): add cursor + logo (#11032)
* style(docsearch): add cursor + logo

fixes #10965

Not completely convinced about the cursor colour, but I couldn't really find a better one, cc @joecritch

* fix margin

* style(docsearch): add cursor + logo

fixes #10965

Not completely convinced about the cursor colour, but I couldn't really find a better one, cc @joecritch

* padding
2017-10-03 10:39:14 -07:00
Brandon Dail
f6a79d1f16 Only define MyElement when needed (#11069) 2017-10-03 10:23:59 -07:00
Dan Abramov
589c0a25df Update button labels 2017-10-03 17:03:18 +01:00
Yangshun Tay
4d60346fc4 Fix all GitHub issues and PRs query params (#11066) 2017-10-03 16:58:26 +01:00
pyitphyoaung
85b59d2fc9 Replace hyperlink tag with button tag in tic-tac-toe tutorial and update related references in the tutorial document (#11045) 2017-10-03 08:48:06 -07:00
Bernard Lin
07dba67ae0 Update conferences (#10781)
* Update conferences

* Update conferences.md
2017-10-03 15:45:30 +01:00
Brandon Dail
5f93ee6f6c Add test for mounting into a document fragment (#11047) 2017-10-03 14:55:32 +01:00
matej
c32b4cd275 Fixing how to contribute beginner friendly issues GitHub link (#11063)
* Fixing how to contribute beginner friendly issues GitHub link

* Fixing again url for how to contribute beginner friendly issues GitHub link
2017-10-03 13:38:28 +01:00
Brian Vaughn
07b1da8964 Removed PooledClass (and tests) (#11053) 2017-10-02 16:54:40 -07:00
Brandon Dail
ad1709a394 Only run custom element fixture in browsers that support it (#11052) 2017-10-02 16:50:46 -07:00
Flarnie Marchan
96134a0ea1 [Website] Add titles and labels to iframes and images on Community pages (#11041)
* [Website] Add titles and labels to iframes and images on Community pages

**what is the change?:**
- add titles to all iframes
- add alt tags to images
- add `aria-label` to some links which only have images as contents.

**why make this change?:**
Based on warnings thrown by aXe a11y audit of those pages

**test plan:**
Manual testing

**issue:**
None

* remove redundant alt tags
2017-10-02 16:41:05 -07:00
Ricky Reusser
fb7bab6c27 Remove bundle-collapser browserify recommendation (#11051)
* Move bundle-collapser browserify plugin recommendation to a note.

* Remove bundle-collapser note entirely
2017-10-03 00:17:49 +01:00
Brian Vaughn
75ad1a9cd6 Refactored Installation page to no longer use tabs (#11050) 2017-10-02 15:45:48 -07:00
Orjiewuru Kingdom Isaac
4caa888bf9 Update react summit Nigeria title (#11046) 2017-10-02 23:15:07 +01:00
Vicky Chijwani
465ffd10c6 Docs: add link to DOM Level 3 spec for possible values of key prop (#11042) 2017-10-02 23:13:23 +01:00
Brandon Dail
e7a2ac959a Update JSFiddle templates for React 16 (#11040)
These were broken after 16 was tagged as `latest` on npm. This fixes that problem, and also adds two template options: one for React 16 and one for React 15. I figure we should provide both for now, since there's still a lot of 15.x users.
2017-10-02 14:11:29 -07:00
Dan Abramov
d8faa70b64 Add changelog entry 2017-10-02 20:51:13 +01:00
Dan Abramov
8b4ec79d4f Fix rendering into shadow root (#11037)
* Replace skipped unit test with a fixture

* Fix crash for custom elements
2017-10-02 20:50:14 +01:00
Dan Abramov
bbb272f3aa Fix 404 for warning URLs (#11038) 2017-10-02 20:12:32 +01:00
Dan Abramov
4c8d248757 Add note to changelog 2017-10-02 19:01:20 +01:00
Dan Abramov
223396ad0a Whitelist <dialog> from unknown tag warning (#11035) 2017-10-02 18:59:37 +01:00
Dan Abramov
9d4c2dfaac Update the changelog 2017-10-02 18:54:45 +01:00
Dan Abramov
fbd6b9ded6 Fix tabIndex attribute for SVG (#11033)
* Fix tabIndex attribute for SVG

* Update the attribute table
2017-10-02 18:52:26 +01:00
Dan Abramov
fbdd43fd70 Fix lint 2017-10-02 18:51:15 +01:00
Dan Abramov
da681e0699 Add <svg tabIndex> to the attribute table (#11034) 2017-10-02 18:44:48 +01:00
Brian Vaughn
5cb17c421d Fix lint error in master 2017-10-02 10:05:37 -07:00
Yangshun Tay
5e8d124754 Ensure all external links have consistent behavior (#11012) 2017-10-02 09:52:39 -07:00
Cole Turner
bd915caaf7 Clarify implementation of tick() in Lifecycle docs (#11002)
This documentation change clarifies how the method `tick()` relates to the example given in the State and Lifecycle documentation. Why this change is necessary is because it may be confusing for beginners who may mistake `tick()` to be a lifecycle API hook.  To clarify, the verbiage is changed so that it becomes more clear that the method is specific to the component and not the API.
2017-10-02 09:37:05 -07:00
Romello Goodman
a88738d7ae issue 10986. [website] Buttons in Live Code sections have bad styling (#11009) 2017-10-02 09:34:26 -07:00
Nic Bonetto
61a1adbda1 Fixed: [website] Handling Events shows wrong 'current' highlight (#10998) 2017-10-02 08:56:41 -07:00
Dan Abramov
2fdb84d999 Add legacy JSFiddle files (#11030)
* Add legacy JSFiddle files

* Exclude from Prettier
2017-10-02 16:48:59 +01:00
Dan Abramov
641ade94bd Stop exposing DOMProperty for the www build (#11029) 2017-10-02 15:55:48 +01:00
Dan Abramov
12d5231c2a Clarify the IRC channel confusion 2017-10-02 15:30:19 +01:00
Dan Abramov
e3a1c6616f Update sizes 2017-10-02 14:31:39 +01:00
Dan Abramov
c1ea3cda30 Delete DOMProperty www shim
It's unused
2017-10-02 13:49:53 +01:00
John Darryl Pelingo
f444937bd8 Combine rendered Note section (#11026) 2017-10-02 13:47:40 +01:00
Dan Abramov
5c13e2ee58 Remove Stack (part 4: remove Stack-only branches and types) (#10798)
* Remove findDOMNode injection and inline it

* Remove Stack-only code in ReactGenericBatching

* Remove Stack-only code branches
2017-10-02 13:43:45 +01:00
Dan Abramov
df445270a6 Disambiguate #react and #reactjs IRC channels (#11025) 2017-10-02 13:32:25 +01:00
Goffert van Gool
4c855cce0b Update web-component docs to current standard (#11020)
The documentation example for Web Components uses deprecated Custom Element and Shadow DOM APIs [0]. This change updates the example to the v1 APIs, which are the current standard.

[0] https://developers.google.com/web/fundamentals/web-components/customelements#historysupport
2017-10-02 11:44:57 +01:00
Dan Abramov
745c4ab0af Remove Stack-only DEV code (#10797) 2017-10-02 11:42:07 +01:00
Josh Hawkins
18d574a086 Improve docs for select multiple (#9539)
* Readd original select multiple note

* Update forms.md
2017-10-02 00:18:08 +01:00
Fernando Poumian
860190da77 [website] Fix Layout Footer in Contribuiting pages. (#11014)
* Fix layout footer in contribuiting pages.

* Run prettier-all
2017-10-01 22:34:21 +01:00
Greg Myers
766db4d342 Update Reference-readme to remove React.DOM (#10999)
`React.DOM` is now Undefined in React 16 so `React.DOM.div` or `React.DOM.button` are no longer possible.
2017-10-01 11:53:00 +01:00
Jason O'Neil
e3d710e60a Fix createPortal link in API docs (#11000)
The anchor name is lower case
2017-10-01 11:52:22 +01:00
Dan Abramov
c8af9c4645 Fix HTML file download link 2017-09-30 21:10:01 +01:00
Neo
ca77e34436 tweak search style (#10985) 2017-09-30 08:26:52 -07:00
Pooya Parsa
2e2dc6708f fix(examples/todo): don't submit empty values (#10979) 2017-09-30 08:20:01 -07:00
Dave Garwacke
f2568605a7 chore(docs) Remove extra style tag curly braces (#10973)
Removed an extra quoted set of curly braces..
2017-09-30 08:11:55 -07:00
Joe Critchley
7ae5ed0e7b [Gatsby] Darkened line-highlight to increase contrast (#10931)
* Darkened line-highlight to increase contrast

* added current line to line highlight

* removed blue line
2017-09-30 07:54:20 -07:00
Joe Critchley
b43574067e [Gatsby] Installation tabs design (#10989) 2017-09-30 07:53:08 -07:00
Joe Critchley
839b7fb901 [Gatsby] Removed Typekit in favour of system fonts (#10988) 2017-09-30 07:48:04 -07:00
Eugene Zhlobo
81cf21c6d1 Fix anchor links in reference-react documentation (#10975) 2017-09-29 18:44:45 -07:00
skratchdot
0344f7ad55 [Gatsby] "https://facebook.github.io/react/" -> "https://reactjs.org/" (#10970) 2017-09-29 18:43:22 -07:00
Toru Kobayashi
ed4174511a Fix og:url on SSR (#10902) 2017-09-29 18:38:01 -07:00
Dan Abramov
c22e4202d3 Fix note formatting (#10966) 2017-09-29 18:37:35 +01:00
Joe Critchley
03725199cc [Gatsby] Updated og-image location (#10942) 2017-09-29 08:27:41 -07:00
Dan Abramov
7bdf93b17a Add changelog for unreleased commits 2017-09-29 14:04:16 +01:00
watadarkstar
2494a25ee9 Added unstable_batchedUpdates as breaking change to v16 post (#10954)
* Add breaking change

ReactDOM.unstable_batchedUpdates now only takes one argument.

* Reword

* Update CHANGELOG.md
2017-09-29 13:08:20 +01:00
Dan Abramov
366c4bb5cb Don't let UMD create extraneous global variables (#10935) 2017-09-29 12:48:33 +01:00
Joshua
3a4c2a661f Use ES6 module instead of commonJS (#10953)
* Use ES6 module instead of commonJS

As far as I know, we're using ES6 modules throughout the docs. For the sake of consistency :)

* Convert all CommonJS requires to ES6 module
2017-09-29 12:24:10 +01:00
Dan Abramov
29f1aedb08 Don't include warning in production (#10946)
Fixes a size regression I introduced in #10802.
2017-09-29 08:24:06 +01:00
Joe Critchley
e271e13809 [Gatsby] README.md instructions (#10945)
* Padded out README.md instructions

* fixed markdown links and added reloading notes

* added more yarn instructions

* removed html.js instruction
2017-09-29 00:47:06 +01:00
Dan Abramov
d87804abc2 Tweaks to "Introducing JSX" (#10944)
* Tweaks to "Introducing JSX"

* Update introducing-jsx.md

* Update introducing-jsx.md

* Update introducing-jsx.md
2017-09-29 00:32:25 +01:00
BJR Matos
473327a469 remove note about license for example (#10943)
removing the old mention of license for examples. since there is no examples in the repository and also the license for them was deleted [here](#10890)
2017-09-28 23:27:52 +01:00
Orjiewuru Kingdom Isaac
25b48c8b03 Add React Summit Nigeria to the list of conferences. (#10939) 2017-09-28 23:04:59 +01:00
Flarnie Marchan
ca7bea802f [website] a11y fixes (#10927)
* [Gatsby docs a11y] Add `aria-label` to search input

**what is the change?:**
See title.

**why make this change?:**
There was no label on this input, and screen readers might not have been
able to identify it's purpose.
[The `placeholder` doesn't count as a label.](http://a11yproject.com/posts/placeholder-input-elements/)

**test plan:**
Manually inspected the HTML in the devtools, and ran the aXe a11y audit
tool, and the warning generated by aXe was gone.

**issue:**
Checklist item on list of docs a11y issues -
https://github.com/bvaughn/react/wiki/Gatsby-A11y-Fixes

* [Gatsby Docs a11y] Increase contrast of 'installation' page tabs

**what is the change?:**
Change the dark blue used for the text/background of the tabs on the
'installation' page to a slightly darker blue, which we were already
using for the 'focus' style of the tabs. It looked a bit weird before,
imo, when the 'focus' was darker.

Now the 'focus' style just lightens the border to the new signature
blue.

**why make this change?:**

To add enough contrast that folks who see colors differently can still
decipher the writing on the tabs on this page.

We plan to refactor this page and remove the tabs soon, so not too
worried about making this fix perfect.

**test plan:**
Manual testing - loaded the page and it looks ok, and ran aXe a11y
audit, no more warnings about contrast. :)

(Flarnie will insert a screenshot)

**issue:**
checklist item on https://github.com/bvaughn/react/wiki/Gatsby-A11y-Fixes
2017-09-28 13:57:34 -07:00
Dan Abramov
83a536e622 Fix "null" instead of the component stack in a warning (#10915)
* Add a failing test that prints "null" in the warning instead of the stack

* Don't reset the current fiber during reconciliation

It should only be reset when we stop doing work.
Otherwise, any warnings after the reset will lose the component stack.

The reset in getMaskedContext() was completely unnecessary.
It is always called with the same fiber as the current work in progress.
Therefore, I add a DEV-only warning assertion to ensure we don't regress, and remove the reset.

The reset in processChildContext() is necessary because it can be called outside of reconciliation.
Unfortunately, we have to keep this hack in until we can remove unstable_renderSubtreeIntoContainer().
To work around it, I restore the previous fiber instead of resetting.

* Decouple setting the current fiber and phase

These are two distinct actions.
This helps make it clearer when we're actually changing the current pointer.

I'm also removing an overengineered hack I previously added for unstable_renderSubtreeIntoContainer. It's not necessary now that we don't null the pointer all the time.
This makes the code more straightforward.

* Centralize the pointer updates in the scheduler
2017-09-28 20:40:26 +01:00
Brian Vaughn
47a6ac525d Gatsby markdown cleanup (#10926)
* Removed unnecessary <script> tags from index.md

* Added gatsby-plugin-twitter rather than embedding <script> tags to load platform.twitter.com
2017-09-28 12:08:40 -07:00
Joe Critchley
43bab3f537 [Gatsby] Paragraph line-height / margin follow-up (#10928)
* removed old paragraph line-height

* reduced paragraph margins
2017-09-28 19:41:13 +01:00
John Leidegren
857ed18b06 Fix for createHTMLDocument API specific to IE11 (#10921)
* Fix for createHTMLDocument API specific to IE11

The createHTMLDocument API title parameter is not optional in IE while other browsers don't care IE11 will throw if an argument is not passed. This only impacts react.dom.development not react.dom.production.

* Tweak
2017-09-28 18:34:33 +01:00
Brian Vaughn
96fde8a09a Add new docs website (#10896)
Adds a new docs website, built with Gatsby JS, to replace the old Jekyll site. Source code for the new site lives in /www (although markdown and YML data still comes from the legacy /docs folder).

Changes to either markdown or website source code can be previewed on Netlify. The react-js bot should automatically add comments to each PR with preview links. (This preview is generated by running the newly-added yarn build:docs command in the root package.json.)

The majority of the changes in this PR are contained within the new /www directory. However some minor modifications have been made to existing content in the /docs directory:

* Modified frontmatter author block to always be an array
* Small markdown formatting tweaks
2017-09-28 10:18:04 -07:00
Matias Larsson
803b493314 Add ReactEurope 2018 Conference (#10914) 2017-09-28 14:19:58 +01:00
Nathan Hunzaker
4472442708 Remove allow transparency (#10823)
* Remove allowTransparency attribute

`allowtransparency` is an Internet Explorer-only attribute that
controls the background transparency of an iFrame. When set to true,
it respects the background color of the iFrame. When set to false, it
sets the background color to that of the document.

This feature was removed in IE9 - falling out of React's support
commitment.

Developers that have somehow figured out how to get IE8 to work with
React 16.x can still use `allowtransparency="true"`, since React now
supports unrecognized attributes.

* Use correct attribute script location

* Use new UMD bundles in attribute fixtures

* Update attribute snapshot

* Blank for CI
2017-09-28 12:53:59 +01:00
Spencer Miskoviak
a58e99371d Remove apostrophe (#10807)
* Remove apostrophe

* Update printInclusive default documentation
2017-09-27 23:05:52 +01:00
Dan Abramov
18506240c6 Delete LICENSE-examples (#10890)
We don’t have `examples` folder anymore (or any other folder with examples).
I think we can delete this?
2017-09-27 19:29:11 +01:00
Ivan Babak
9f6f7b3520 Fix fragments docs example JSX typo (#10885)
Fixes https://github.com/facebook/react/issues/10883
2017-09-27 19:28:04 +01:00
Dan Abramov
a947d3f92f Remove usage of ReactDOMFeatureFlags.useFiber, assuming true (#10796) 2017-09-27 17:14:27 +01:00
Syed Fazle Rahman
f50ff7e5d1 Add link to React community on Hashnode (#10874)
* Add link to React community on Hashnode

React community on Hashnode has more than 10K followers. It'd be nice if we can point developers to this place.

* Consistency in heading + remove the sales pitch-y bit
2017-09-27 17:06:46 +01:00
Cody Wall
7811677a49 Minor update to portals docs "child" language (#10870)
* Update portals docs "child" language

This commit changes the portals docs so that the language of the Parent
no longer feels like it is missing a word with "is not a child the div
with onClick handler" and replaces that with "is not a direct child of
the div with the onClick handler".

closes #10868

* Update portals.md
2017-09-27 17:04:11 +01:00
Dan Abramov
aad0970192 Remove Stack (part 1, safe: unused files and tests) (#10794)
* Remove Fiber Jest project

* Remove Stack reconciler and ReactDOMStack code

* Fix tests depending on Stack internals

* Fix Flow
2017-09-27 15:15:20 +01:00
Mario Schüttel
6955414465 "Write Code in Your Editor": Split step 5 into 2 steps (#10832)
* "Write Code in Your Editor": Split step 5 into 2 steps

To me it wasn't clear (enough) that I had to copy the file's content from [here](https://codepen.io/gaearon/pen/oWWQNa?editors=0010) *and* add the three lines to the top.

* Update tutorial.md
2017-09-27 13:17:23 +01:00
Dan Abramov
c0a87b2b8d Remove unnecessary event whitelist in production (#10802)
* Remove unnecessary top level event type whitelist

* Record sizes
2017-09-27 13:01:25 +01:00
Dan Abramov
2566b2420b Remove IE8 property expansion workaround (#10803)
* Remove IE8 property expansion workaround

* Edit from a plane ✈️
2017-09-27 12:59:59 +01:00
Leslie
ccb2f82a83 Fix a few typos (#10860) 2017-09-27 11:13:21 +01:00
Toru Kobayashi
7c78a38182 Add a note about deprecating react-addons-perf (#10743)
* Add a note about deprecating react-addons-perf

* Update addons-perf.md
2017-09-27 11:12:39 +01:00
Youngchan Je
1c77d4c0ff Fix typo on docs for React 16 (#10862) 2017-09-27 10:48:20 +01:00
Arthur Gunn
31eb1ba7c6 Update authors for v16 (#10861) 2017-09-27 10:24:16 +01:00
Dan Abramov
9ce135f863 Minor doc edit 2017-09-26 22:23:20 +01:00
Dan Abramov
138634f7da Update docs for React 16 (#10846) 2017-09-26 22:12:40 +01:00
Andrew Clark
706d2f4f9c Fix portal link (#10845) 2017-09-26 21:26:38 +01:00
Karl Horky
8b39991819 Update name of property initializer proposal (#10812)
The proposal for property initializers is called [Public Class Fields](https://tc39.github.io/proposal-class-public-fields/) now (part of the combined [Class Fields](https://github.com/tc39/proposal-class-fields) proposal).
2017-09-26 19:48:23 +01:00
Samuel
04799590fc Update Portals Documentation (#10840)
* Update Portals Documentation

Correct some grammar to be more explicit and clear. Update example CodePen to better match code found in documentation. Update code example styles to match other code examples (ie. 'State and Lifecycle', 'Handling Events').

* Clean up comment to be accurate to example

There was a small comment overlooked when reviewing the documentation. This fixes it to be accurate to the example as well as grammatically correct.

* Update portals.md

* More fixes
2017-09-26 19:45:48 +01:00
Kaylee Knowles
ba1396fb03 React.createPortal is not a function (#10843) 2017-09-26 19:41:30 +01:00
Dan Abramov
26cf268541 Fix note formatting 2017-09-26 19:01:38 +01:00
Samuel Reed
5120bf897c Doc change for prevContext removal in CDU (#10836)
* Doc change for prevContext removal in CDU

Ref: https://github.com/facebook/react/issues/8631

* Minor rewording
2017-09-26 18:29:35 +01:00
Dan Abramov
893919f6a7 Fix React links on the website (#10837)
* Fix React links on the website

* Fix code editor

* Fix code editor, attempt 2
2017-09-26 18:20:41 +01:00
Andrew Clark
5f6326f356 Doc updates for React 16 + blog post (#10824)
* Doc updates for React 16 + blog post

* Add link to Sophie's post
2017-09-26 09:04:14 -07:00
Andrew Clark
5c6ef40446 v16.0.0 2017-09-26 08:50:33 -07:00
Andrew Clark
b62d315950 Update CHANGELOG for React 16 2017-09-26 08:45:53 -07:00
Andrew Clark
7ccfbfc25d Update error codes 2017-09-26 08:44:21 -07:00
Andrew Clark
1fcdc020eb Flow should ignore node_modules/create-react-class 2017-09-26 08:41:07 -07:00
Andrew Clark
ec75ad1488 Bump object-assign patch range to match main package.json 2017-09-26 08:33:29 -07:00
Dan Abramov
4de45cfbec Add Nate to authors on master 2017-09-26 11:41:02 +01:00
Dan Abramov
9f8387a15f Add 15.6.2 blog post to master 2017-09-26 11:40:07 +01:00
Dan Abramov
e858ed5b14 Add changelog for 15.6.2 2017-09-26 11:37:12 +01:00
Toru Kobayashi
b9d55695e1 Add ReactTestRenderer documentations (#10692)
* Add ReactTestRenderer documentations

* Add TestRenderer documentations

* TestRenderer is not experiment

* Add a link for jsdom

* Use ES Modules syntax

* Twaek

* Add a Link component

* Use Jest assertions

* Move a documentation for createNodeMock to Idea section

* Renamed

* Tweak

* Rename

* More explicit

* Add a usecase for createNodeMock
2017-09-26 00:30:56 -07:00
Sophie Alpert
e932ad68be Version bumps to use MIT license 2017-09-25 18:17:44 -07:00
Sophie Alpert
b765fb25eb Change license and remove references to PATENTS
Only remaining references:

```
docs/_posts/2014-10-28-react-v0.12.md
51:You can read the full text of the [LICENSE](https://github.com/facebook/react/blob/master/LICENSE) and [`PATENTS`](https://github.com/facebook/react/blob/master/PATENTS) files on GitHub.

docs/_posts/2015-04-17-react-native-v0.4.md
20:* **Patent Grant**: Many of you had concerns and questions around the PATENTS file. We pushed [a new version of the grant](https://code.facebook.com/posts/1639473982937255/updating-our-open-source-patent-grant/).

src/__mocks__/vendor/third_party/WebComponents.js
8: * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
```
2017-09-25 18:17:44 -07:00
Sophie Alpert
d63249d034 Update license headers BSD+Patents -> MIT
Did find and replace in TextMate.

```
find: (?:( \*)( ))?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+(?:this source tree|the same directory)\.$
replace: $1$2Copyright (c) $3-present, Facebook, Inc.\n$1\n$1$2This source code is licensed under the MIT license found in the\n$1$2LICENSE file in the root directory of this source tree.
```
2017-09-25 18:17:44 -07:00
Dan Abramov
b24d23d3e8 Update DOM warning wording and link (#10819)
* Update DOM warning wording and link

* Consistently use "Invalid" for known misspellings
2017-09-26 00:28:28 +01:00
Dan Abramov
6e8c09c363 Include tag name into the table snapshot (#10818) 2017-09-25 21:03:44 +01:00
Joe Critchley
f9bfd08a02 Markdown fixs on "DOM Attributes in React 16" post (#10816) 2017-09-25 18:57:42 +02:00
Toru Kobayashi
7b2101e352 Add a changelog for elements having the same key (#10811)
*  Add a changelog for elements having the same key

* Reword
2017-09-25 11:57:14 +02:00
Dan Abramov
4c45058355 Record sizes 2017-09-24 17:44:13 +02:00
Kenneth Chau
a160f3ecfa Fixes #9667: Updated createTextInstance to create the text node on correct document (#10723) 2017-09-22 16:08:19 -07:00
Flarnie Marchan
cdfbe6bb04 Update changelog for unreleased 16.0 changes (#10730)
* First shot at updating changelog for 16.0

**what is the change?:**
Added an 'unreleased' section to the changelog with info from https://github.com/facebook/react/issues/10294

**why make this change?:**
To get things set for the 16.0 release.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/8854

* Fix typos and formatting errors in changelog

* Add requestAnimationFrame and remove "New helpful warnings"

**what is the change?:**
In response to helpful code review -
- Add mention of dependency on `requestAnimationFrame` and need to
  polyfill that as well as `Map` and `Set`
- Remove "New helpful warnings" section; it was incomplete, and there
  are so many new and updated warnings that it might not be reasonable
  to cover them in the changelog.

**why make this change?:**
Accuracy

**test plan:**
Visual inspection

**issue:**
issue #8854

* Improve wording

* Improve wording and fix missing links

* Add backticks to file names & code; wording tweak

* Break "Major Changes" into "New Feature" and "Breaking Changes"

* Add server side render changes to 16.0 changelog

* Change gist link from mine to gaearons

* Add note about returning fragments

* fix misc nits

* Misc. formatting/wording fixes to changelog

**what is the change?:**
Thanks to the kind code review comments of @gaearon and @nhunzaker we
have
- removed the non-deterministic bold styling on some bullet points
- improved wording of the bullet points for portals, attribute whitelist
  changes, and server rendering changes
- Add note about error boundaries including a breaking change to error
  handling behavior.
- punctuation and capitalization fixes

**why make this change?:**
Clarity and correctness

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/8854

* fix broken link
2017-09-22 15:22:39 -07:00
Robert Haritonov
dd00b47e1f Add React Amsterdam 2018 Conference (#10734) 2017-09-19 11:23:28 -07:00
Andrew Clark
b5ac963fb7 Push host root context when bailing out on low priority (#10712)
Prevents a push/pop mismatch when bailing out on HostRoots. This is
currently unobservable, because HostRoots never bail out on low
priority, but this does happen with prerendering.

I found this when rebasing #10624 on top of master.
2017-09-14 15:23:55 -07:00
Brian Vaughn
836d1c5d0c ReactNativeBridgeEventPlugin supports lazily-registered event types (#10679)
* ReactNativeBridgeEventPlugin supports lazily-registered event types
This accompanies changes on the native side to now specify which event types each view manager supports as part of its view config. Ultimately the goal is to lazily initialize view managers on the native side as well.
* Bubbling and direct attributes are optional on view config
This should help ease transition for pre-existing JS-only components.
2017-09-14 14:55:32 -07:00
Anuja Ware
3c98b2e0b0 Small typo fixed (#10701) 2017-09-14 14:39:17 -07:00
Clement Hoang
7caa035be5 Fix bug with toTree on rendered array #10616 (#10652)
* Fix bug with toTree on rendered array #10616

* Preserve previous behaviour of rendered being a node unless it's for rendering an array
2017-09-14 22:15:43 +01:00
Dan Abramov
c043c1e7d9 Remove View.propTypes RN deprecation workaround (#10683) 2017-09-14 19:46:24 +01:00
Dan Abramov
03443a2e23 Record sizes 2017-09-14 14:04:11 +01:00
Dan Abramov
b741916d37 16.0.0-rc.3 2017-09-14 13:59:29 +01:00
Dan Abramov
07f129bec2 Update error codes 2017-09-14 13:37:26 +01:00
Dan Abramov
d5d46df270 Update fbjs in lockfile 2017-09-14 13:32:23 +01:00
Dan Abramov
bacaf60e15 Update sizes 2017-09-14 13:27:27 +01:00
Dan Abramov
af36a05d5a Fix FB isomorphic build (#10704)
* Freeze bundle configs before the build

This ensures we don't accidentally mutate it.

* Fix config mutation during the build uncovered by freeze

* Fix FB isomorphic build by marking object-assign as an external

* Bye bye redundant check
2017-09-14 01:24:31 +01:00
Dan Abramov
aebd7f5454 Report bad dead code elimination to React DevTools (#10702)
* Report bad dead code elimination to React DevTools

* Fix lint
2017-09-13 23:51:42 +01:00
Dan Abramov
c99bad9483 Warn against custom non-lowercase attributes (#10699)
* Warn against custom non-lowercase attributes

* Update attribute table

* Grammar tweaks
2017-09-13 18:13:13 +01:00
Dan Abramov
c55ffb37f1 Fix false positive hydration warning for SVG attributes (#10676)
* Fix false positive hydration warning for SVG attributes

* Undo the generic fix

* Pass namespace through and use it to determine sensitivity
2017-09-13 16:31:40 +01:00
Dan Abramov
65b9ad94aa Fix context memory leak (#10680)
* Fix context memory leak

* Fix Flow
2017-09-12 21:47:09 +01:00
Dan Abramov
43dae749aa Stop exposing shallow renderer from TestUtils (#10682)
* Stop exposing ShallowRenderer from TestUtils

* Record sizes

* Lint
2017-09-12 19:29:28 +01:00
Dan Abramov
18d6cb5ebe Remove undocumented TestUtils methods (#10681) 2017-09-12 16:50:41 +01:00
Dan Abramov
89508f20d4 Make ReactDOM.createPortal() official (#10675)
* Validate portal container early

* Add ReactDOM.createPortal but leave unstable_ alias usable
2017-09-11 22:23:54 +01:00
Dan Abramov
f74981beee Share Object.assign polyfill between UMD builds (#10671) 2017-09-11 19:22:59 +01:00
Dan Abramov
61282d38d5 Remove toString-based minification check (#10673) 2017-09-11 19:22:41 +01:00
Dan Abramov
6552519a21 Update sizes 2017-09-11 16:51:58 +01:00
Thibaut Rizzi
af312ce006 Remove react proptypes references (#9759) 2017-09-10 17:37:22 -07:00
Matthew Shotton
b80e3ad1f5 Fix hint wording in tutorial.md (#9867)
The tutorial hints that a change can be made that allows you to go back
in time then click in the board to create a new entry, but the change is
already present in the example code.

This fix removes the hint and re-words the explanation of the change the
example code is making.
2017-09-10 17:28:32 -07:00
François Chalifour
83b63e5ff8 Fix test names in ReactDOMComponent-test (#10113)
* Fix test names in ReactDOMComponent-test

* Run record-tests script for Fiber
2017-09-10 14:52:09 -07:00
Brian Emil Hartz
6d37c05dd7 More explicit class method for ref doc (#10228)
After realizing this was the second time I've visited this exact page within a year and second guessing myself that the `textInput` ref isn't actually the `<input />` element. I decided to attempt to make this a little more explicit; you are actually accessing the method on the child class and not the `focus` method on the dom input element. Having them named the same caused some confusion.
2017-09-10 14:48:39 -07:00
zhangs
0440157608 the order of withRouter and connect is reset (#10658)
per [this link](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/withRouter.md) becasue ` If you are using withRouter to prevent updates from being blocked by shouldComponentUpdate, it is important that withRouter wraps the component that implements shouldComponentUpdate. `
2017-09-10 12:56:22 -07:00
Nikoloz Buligini
c294b0995a adds missing else clause (#10660) 2017-09-10 12:42:53 -07:00
Taegon Kim
f76467e8e5 Add React Seoul 2017 to the conferences list (#10661) 2017-09-10 12:41:03 -07:00
Jane Manchun Wong
1b72ef396e Update Sophie's name on various files (#10655) 2017-09-08 17:10:48 -07:00
Héliton Nordt
617f8810ba Improve displayName documentation (#10451)
* Improve displayName documentation

* displayName docs: higher-order component lowercased to stay consistent with the rest of the docs

* Rephrase displayName reference docs
2017-09-08 16:45:25 -07:00
Clement Hoang
11a1543b9e Reset effectTag to NoEffect instead of NoWork (#10653) 2017-09-08 16:00:35 -07:00
Sophie Alpert
2aa4988379 Update my name in most places 2017-09-08 15:45:55 -07:00
Sophie Alpert
8db2e11d97 Bump versions for 16.0.0-rc.2 (pick)
NOTE: This commit is not exactly what went out as RC2 because I forgot to push. See tag v16.0.0-rc.2 (d06680ea9e) instead. Bumping the version here so we're at the right place though.
2017-09-08 15:44:56 -07:00
Dan Abramov
5b5a0bd36c Blog post: DOM Attributes in React 16 (#10650)
* Blog post: DOM Attributes in React 16

* Testing the RC
2017-09-08 20:25:36 +01:00
Clement Hoang
7d77d795c2 Remove performWithPriority from scheduler (#10638) 2017-09-07 17:35:06 -07:00
guoyong yi
8b7082eced Add license headers on build bundles (#10490)
* Add license headers on build bundles

* Add the filename IMO to header

* Preserve headers in production bundles

* Use ECMASCRIPT5_STRICT to preserve "use strict"
2017-09-07 19:38:16 +01:00
Daniel Liburd
f1d00156df Add comment for renderToStringImpl parameter (#10634) 2017-09-07 10:05:19 -07:00
Robert Haritonov
79074a8059 add React Day Berlin (#10492) 2017-09-07 07:37:04 -04:00
Sophie Alpert
16a39b8f02 Remove "const" in uncompiled code (#10631)
Test Plan: All fixtures/packaging iframes display correctly on Chrome 38.0.2125.0 from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/290001/; previously several were blank with "Use of const in strict mode" errors logged to the console.
2017-09-06 20:32:15 -07:00
Sophie Alpert
d8ecc4c2b5 Update .mailmap 2017-09-06 16:58:21 -07:00
Flarnie Marchan
49c8d717a0 16.0.0-rc.1 (#10630) 2017-09-06 15:43:22 -07:00
Flarnie Marchan
b5a1c2281d Add missing dependencies in art fixture, update yarn.lock (#10628)
* Add missing dependencies in `art` fixture, update `yarn.lock`

**what is the change?:**
See title

**why make this change?:**
We want the `art` fixture to be working so that we can test the latest
version of `react-art`.

**test plan:**
Built and inspected the fixture manually

**issue:**
Prepping for 16.0RC release - https://github.com/facebook/react/issues/10623

* ran prettier
2017-09-06 15:37:09 -07:00
Brian Vaughn
abce30f771 React native event type fixes (#10627)
* Added invariant check for native dispatching an unsupported event type
This prevents a case of a silent failure when native dispatches an event that JavaScript does not know how to handle.

* Added iOS direct event type 'onSnapshotReady'
This is used for snapshot testing.
2017-09-06 15:34:02 -07:00
Sophie Alpert
7ff922cf2a Pull in react-art/lib/{Circle,Rectangle,Wedge}.art (#10629)
* Import react-art/lib/{Circle,Rectangle,Wedge}.art

Copied from react-art@0.15.1 built files.

* Changes to built files to make ART shapes work

Test Plan: Opened the fixture. React logo shows up with its normal dot, now rendered by a `<Circle />`.
2017-09-06 15:10:14 -07:00
Flarnie Marchan
4a351eacdd Update to latest allowed versions of fbjs and prop-types (#10626)
**what is the change?:**
Updates to the latest allowed versions for two dependencies.

`yarn upgrade 'fbjs@^0.8.9'`
and
`yarn upgrade 'prop-types@^15.5.8'`

**why make this change?:**
Prepping for the 16.0 RC, we want to have a reproducible build that is
as close as possible to what new users will get when installing React.

**test plan:**
`yarn && yarn build && yarn test`

**issue:**
https://github.com/facebook/react/issues/10623
2017-09-06 14:29:23 -07:00
Flarnie Marchan
8e4654015a Update error codes and results.json (#10619)
* Update results.json

**what is the change?:**
Ran the build after updating Yarn lockfile and recorded latest build
size results.

**why make this change?:**
Let's get an idea of bundle size at this point, when we are preparing
the 16.0 RC.

**test plan:**
NA

**issue:**
https://github.com/facebook/react/issues/8854

* Update error codes

https://github.com/facebook/react/tree/master/scripts/release-manager#update-the-error-codes
2017-09-06 11:11:19 -07:00
Dan Abramov
faf186b235 Generate Markdown table from attribute fixture (#10595)
* Generate Markdown table

* Check in generated table

* Add fast mode

* Fix lint
2017-09-06 16:00:52 +01:00
Daniel Rotter
5f12867824 Add AgentConf 2018 (#10614)
* Add AgentConf 2018

We are having another edition of the AgentConf in 2018, which has again a strong focus on react, and we'll be skiing again 😎 Last year's PR for reference: https://github.com/facebook/react/pull/8196

* Update conferences.md
2017-09-06 08:56:36 -04:00
Andrew Clark
47d87028a7 Moar attribute tests (#10509)
* WIP

* WIP Add the rest of the tests for what we expect re: unknown attributes

**what is the change?:**
Adds tests for the following behavior -

- Numbers and booleans should be converted to strings, and not warn
- NaN, Symbols, functions, and objects should be converted to strings,
  and *should* warn

Going to add tests for the not-warning behavior in a follow-up.

These tests are not entirely passing - we either need to change what we
expect or change the behavior.

**why make this change?:**
Gets everyone on the same page about expected behavior, and codifies it
in a maintainable way

**test plan:**
`yarn test src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js`

**issue:**
https://github.com/facebook/react/issues/10399

* WIP Add check that we *don't* warn when handling some unknown attributes

**what is the change?:**
We are testing the behavior of unknown attributes, which has changed
since React 15.

We want to *not* warn for the following cases -
- null
- undefined
- missing
- strings
- numbers
- booleans

**why make this change?:**
We want to verify that warnings don't get fired at the wrong time.

**test plan:**
`yarn test src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js`

**issue:**
https://github.com/facebook/react/issues/10399

* ran prettier

* Symbols and functions passed to unknown attributes should remove and warn

* Abstract tests a bit to make them easier to read

* Remove Markdown from test names

I don't think we use this convention anywhere.

* Add an assertion for NaN warning message

* Update ReactDOMAttribute test based on attribute fixture

**what is the change?:**
- booleans don't get stringified
- some warnings have changed since we originally wrote this

**why make this change?:**
The attribute behavior is finalized and now we can test it :D

I also found it handy to have a row with a truly unknown attribute, so
added "imaginaryFriend".

**test plan:**
`yarn test src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js`
and comparing the tests to the attribute table

**issue:**
https://github.com/facebook/react/issues/10399

* remove imaginaryFriend to resolve conflict

* ran prettier
2017-09-05 11:25:23 -07:00
David Beitey
89edcf2388 Fix minor typo in Firefox name (#10605) 2017-09-05 10:28:54 -07:00
Nikita Lebedev
a8845587a3 Fix typo in script function name (#10611) 2017-09-05 10:28:34 -07:00
Dan Abramov
3f6e8d2803 Fix warning deduplication in attribute table (#10594)
* Fix warning deduplication by eval-ing React

* Move checkbox to the left

* Fix alphabetical sort

* Fix the pooling logic

* Avoid false positive warning due to controlled/uncontrolled switch

* Naming: 15 => Stable, 16 => Next

* Prettier

* Add "Save" button
2017-09-01 18:37:45 -07:00
Brandon Dail
80411ea9b4 Default to first non-disabled option for select elements (#10456)
* Default to first non-disabled option for select

Instead of defaulting to the first option for a select element, which could be a disabled option, we find the first non-disabled option available while we looping through the options. If no option matches, set the first non-disabled option as selected.

* Add ReactDOMSelect test for defaulting to non-disabled options

* Add test fixtures to cover disabled selected options

* Fix bad merge
2017-09-01 13:34:28 -07:00
Eric Nakagawa
f6ceacdd44 Adding Crowdin config file to master repo (#10579)
* Adding Crowdin config file to master repo

* Updated to include additional files while ignoring localized community files stored on github

* Additional files ignored

* Included additional files in root docs directory
2017-09-01 11:33:18 -07:00
Dan Abramov
9f772abdc6 Update sizes 2017-08-31 22:35:42 -07:00
Dan Abramov
fdf9d32a2e Ensure attribute table server-renders SVG inside SVG container (#10588) 2017-08-31 18:41:50 -07:00
Dan Abramov
55209c8cc9 Don't treat dashed SVG tags as custom elements (#10586) 2017-08-31 18:24:23 -07:00
Dan Abramov
de05d2eded Remove disableNewFiberFeatures flag (#10585) 2017-08-31 18:23:08 -07:00
Andrew Clark
edc9c2fc70 [attribute-behavior] Canonicalize values immediately after reading them (#10584)
In case they are mutated
2017-08-31 16:46:44 -07:00
Brian Vaughn
e34ac7c066 Embed ReactNative event types in JavaScript (#10567)
* ReactNative doesn't query UIManager for native event types
This is a pre-req to unblock Prepack optimiations for ReactNative apps
* Replaced mock ReactNativeEventTypes with mock Platform
* Added Platform.OS to RN host hooks Flow types
2017-08-31 15:27:54 -07:00
Brian Vaughn
8bd5b489b4 Defer reading native view config from UIManager until view is used (#10569)
* ReactNative supports lazy view registration
Don't react viewConfig from UIManager when a view is registered, but only when it is used for the first time. This will help unblock Prepack optimizations for RN views.

* Added new lazy-creation method for native views
Also exposed the native view config registry to allow invalid/unsupported host components to fall back to RCTView

* Removed ReactNativeViewConfigRegistry from RN __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
After discussion with Spencer Ahrens and Andy Street, it seems the early fallback behavior was mostly for the early days of Ads Manager when Android didn't yet support a lot of the view types. It should be okay now to use an invarient/redbox instead for unsupported views.

* Removed non-lazy createReactNativeComponentClass impl
There are only a handful of components with JavaScript-defined view configs. It's probably worth making them use the new lazy/async interface as well to be more consistent.
2017-08-31 13:42:27 -07:00
Nathan Hunzaker
c1dbc8e470 Changes to attribute whitelist logic (#10564)
* Remove HTMLPropertyConfig entries for non-boolean values

When we originally removed attributes from the whitelist, we assumed a
few attributes were string booleans, but they are not:

Autocomplete ("on", "off")
https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html#autocomplete

Autocapitalize ("none", "sentence", "words", ...)
https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html#autocapitalize

Autocorrect ("on", "off")
https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html#autocorrect

Autosave (string)
https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html#autosave

* Only HAS_BOOLEAN_VALUE attribute flag can assign booleans

* Use a non-boolean attribute in object assignment tests

* Add HAS_STRING_BOOLEAN_VALUE attribute flag

* Fix boolean tests, add boolean warning.

* Reserved props should allow booleans

* Remove outdated comments

* Style tweaks

* Don't treat dashed SVG tags as custom elements

* SVG elements like font-face are not custom attributes

- Adds exceptions to isCustomAttribute for dashed SVG elements
- Use consistent custom element check across all modules

* Move namespace check to isCustomAttribute. Add caveat for stack.

* Remove unused namespace variable assignment

* Fix the DEV-only whitelist

* Don't read property twice

* Ignore and warn about non-string `is` attribute

* Blacklist "aria" and "data" attributes

* Don't pass unknown on* attributes through

* Remove dead code

* Avoid accessing namespace when possible

* Drop .only in ReactDOMComponent-test

* Make isCustomComponent logic more solid

* Do attribute name check earlier

* Fix fbjs import

* Revert unintentional edit

* Re-allow "data" attribute

We intentionally allowed it.

* Use stricter check when attaching events

* Pass SVG boolean attributes with correct casing

* Fix the test

* Undo the SVG dashed-name fix

Per conversation with @sebmarkbage we decided that the fix is too complicated, and it's unfortunate it depends on the DOM element.
It's only relevant for super rare tags that aren't even working consistently across browsers so we'll leave it unfixed for now.

* Prettier

* Fix lint

* Fix flow

* Pass "aria" through but still warn

* Remove special cases for onfocusin, onfocusout

They're covered by event handler code now.

* Add a more specific warning for unknown events

* Pass badly cased React attributes through with warning
2017-08-30 18:28:55 -07:00
Andrew Clark
a6e34cc25f Track nested updates per root (#10574)
We track nested updates to simulate a stack overflow error and prevent
infinite loops. Every time we commit a tree, we increment a counter.
This works if you only have one tree, but if you update many separate
trees, it creates a false negative.

The fix is to reset the counter whenever we switch trees.
2017-08-30 18:17:48 -07:00
Andrew Clark
88a079d5c2 [attribute-behavior] Track differences between DOM and server renderer (#10575)
* Load ReactDOMServer into attribute table

* Highlight differences between DOM and server renderer

* Use SSR behavior when comparing behavior across renderers

* Use less severe color if SSR differences are only due to warnings

* Ensure result node's tagName matches what's expected

* Throw on unexpected HTMLUnknownElement
2017-08-30 18:17:31 -07:00
Jason Quense
1924c28a54 Update issue template with PropTypes package (#10578)
Adds `prop-types` to the template
2017-08-30 16:35:29 -04:00
Brian Vaughn
5ee72dcd82 Add --sync-www flag to build script (#10571) 2017-08-30 09:38:14 -07:00
Brian Vaughn
99171321c3 Lint command fails if there are any warnings (#10572)
You get a lint failure! You get a lint failure! Eeeeverybody gets a lint failure!
2017-08-30 08:03:17 -07:00
Brian Vaughn
cd52f7ed80 Fixed lint error in ReactErrorUtils-test (#10570) 2017-08-29 17:54:36 -07:00
Tyler Deitz
f5547ee372 Update reference-events.md (#10554) 2017-08-29 08:11:45 -07:00
Andrew Clark
dd9db8b9d2 Add ability to "complete" rows and store state in localStorage (#10562)
* Add ability to "complete" rows and store state in localStorage

* Sort groups based on size

Also: include tagName and containerTagName in info object.

* Tweak sort order
2017-08-28 19:44:26 -06:00
Dan Abramov
2add1ed1b9 Fix {false} test in attribute table 2017-08-28 16:31:08 -07:00
Dan Abramov
c813c82e45 More consistent hashing (#10561) 2017-08-28 16:39:19 -06:00
Dan Abramov
ed0ceb4f07 Disable hasOwnProperty test in attribute table (#10560) 2017-08-28 15:46:38 -06:00
Brian Vaughn
d8d7edde5d Upgrade flow-bin to 0.53.1 (#10510)
* Update flow-bin to 0.53.1

* Ran flow-upgrade utility
Manually corrected a few over-eager cases where it tried to replace our ReactElement sub-type.

* Replaced a couple of React.Element types with React

* Removed temporary ReactComponent/ReactComponent Flow types

* Prettier

* Replaced React with React based on Dan's PR feedback
2017-08-28 14:39:58 -07:00
Dan Abramov
ebb5a33ec2 Tweak attribute whitelist table (#10559)
* Move null and undefined to the end

* Highlight attributes with changes
2017-08-28 15:13:35 -06:00
Sebastian Markbåge
575cfadf3e Read SVG properties instead of attributes where applicable (#10549)
Also canonicalize object results (since these SVG properties are objects).

The canonicalized format is what we compare against.

(This will cause unknown objects to show up as unchanged.)
2017-08-28 14:11:32 -07:00
Mitermayer Reis
7f78749ee3 Updating param flow type definition (#10558) 2017-08-28 11:06:56 -07:00
zombieJ
c282a8ef4f Refactor ensureUpdateQueues to avoid returning a tuple (#10437)
* remove tuple

* clean up

* prettier code

* Use module-level varibles
2017-08-28 11:04:28 -07:00
Mitermayer Reis
a7c479b3e9 Fixing incorrect documentation tags (#10530) 2017-08-26 16:53:37 -07:00
Flarnie Marchan
c0a41196e6 [attribute-behavior] Add alphabetical and rev-alphabetical sorting (#10546)
* Add alphabetical and rev-alphabetical sorting

This is just an initial convenient way to jump to the top or bottom of
the list.

Next we will add a sorting which groups rows together if their behavior
pattern is the same.

* Add sorting to group the rows by behavior pattern

**what is the change?:**
Another sorting option - if the content of a row is the same, it takes
those rows and groups them together.

**why make this change?:**
This will help us find groups of attributes that behave similarly.

**test plan:**
manual testing

* rename variable to be more clear
2017-08-25 18:03:25 -07:00
Sebastian Markbåge
d7fcdd9c7a Use proper SVG tags for all SVG attributes and read using a special function (#10545) 2017-08-25 17:27:07 -07:00
Andrew Clark
b9c8e4e9df Remove UMD builds from fixture directory (#10547) 2017-08-25 17:17:31 -07:00
Andrew Clark
be9d982e8f [attribute-behavior] Use development builds of React and ReactDOM (#10544)
Enables warning detection.

Start-up is noticeably slower, but after that the perf is about the same.
2017-08-25 15:44:37 -07:00
Andrew Clark
2d5c4542df Update eslintignore and prettier config to ignore UMD builds of React 2017-08-25 11:35:43 -07:00
Andrew Clark
e421df8151 Add basic popover with additional information 2017-08-25 11:35:43 -07:00
Andrew Clark
87a32314ae Delete vestigial CRA files 2017-08-25 10:43:47 -07:00
Andrew Clark
5fd942a03c Move attribite-behavior to fixtures 2017-08-25 10:40:09 -07:00
Andrew Clark
b775e74e4e Use monospace font-family 2017-08-25 10:37:46 -07:00
Andrew Clark
888c537121 Wrap string values in quotes
All other types are formatted as as <type: param>
2017-08-25 10:37:46 -07:00
Andrew Clark
5f71165486 Add table of attribute behavior (#10536)
* [WIP] Table of attribute behavior

* getAttribute helper

* add getters for attributes V-Z

* More special cases

* Add getters for more attributes

* Add tagName to attribute config

* Switch default accessor to getProperty instead of getAttribute

* Add containerTagName and tagName config

* Compare result to default value

* Add overrideStringValue config option

* add section for Sebastian and update a couple more attributes

* 'array with string' should use string override, too

* Add additional value types

Strings on, off, true, false

* more attribute updates

* More attributes

* Remove old directory

* add more attribute configs

* More attributes

* just a couple more attribute updates

* More attributes

* Fix the seb parts

* Fix the seb parts

# Conflicts:
#	scripts/attribute-behavior/src/App.js

* More attributes

* Prettier

* More attributes

* More attributes

* Fix some bugs in seb's set

* Fix the rest of flarnie's section

* More attributes

* Prettier

* Finish my section (Andrew)

* Compare against UMD build of master

Once we get past MVP stage we can hook this up to the build system so
these files are automatically copied over.

* Fix attributes that don't have compatible properties

Avoid all undefined reads.

* Test multiple input types

Tests different input types and valueAsNumber property. This value is often
NaN. To compare that we also need to switch to Object.is.

* Ignore checked in copies of React 15 bundles in attribute fixture

**what is the change?:**
We checked in bundles of React v15 to run comparisons of attribute
behavior on DOM elements between 15 and 16.

This commit tells prettier and eslint to ignore those files, and fixes a
prettier lint in one other file from that fixture.

**why make this change?:**
To get CI passing.

**test plan:**
`yarn prettier` doesn't change anything, eslint passes

**issue:**

* update README for attribute table fixture

* run prettier again
2017-08-25 10:03:30 -07:00
Mitermayer Reis
0e556fef24 Adding the correct argument name to documentation tag (#10529) 2017-08-25 09:15:47 -07:00
Mitermayer Reis
c39a976be7 Removing unecessary assignment (#10528) 2017-08-25 07:58:49 -07:00
Andrew Clark
83393bc2be Enable opt-in to async mode (#10535)
When the feature flag enableAsyncSubtreeAPI is true,
React.unstable_AsyncComponent creates an async subtree. When it's false,
it behaves like a normal, sync React component. We use this flag in www
as a fail safe so that if we ship an async bug, we can set the flag to
false and revert back to sync mode.

For open source, we should enable the feature flag.
2017-08-24 10:54:03 -07:00
Brandon Dail
1f55e2dcf8 Put warnForInvalidEventListener call behind nextProp check (#10527) 2017-08-23 23:34:12 -05:00
Brian Vaughn
2fa38ac1cc Delete ReactNativeStack 🎉 🎉 🎉 (#10511)
* Removed createReactNativeComponentClassStack and renamed createReactNativeComponentClassFiber => createReactNativeComponentClass

* Removed findNumericNodeHandleStack and renamed findNumericNodeHandleFiber => findNumericNodeHandle

* Renamed ReactNativeFiberEntry => ReactNativeEntry

* Removed all references to ReactNativeFeatureFlags and RN stack

* Removed severl RN modules that are no longer used

* Renamed ReactNativeEntry => ReactNativeFiberEntry for now. We'll probably remove 'fiber' references later

* Update build results json

* Deleted snapshot

* Re-add accidentally deleted test

* Remove now-unnecessary hack in test

* Fix lint

* RN findNodeHandle no longer adds props directly to read-only owner (#10520)

* Added ReactNativeMount-test snapshot for 'renders and reorders children' test
2017-08-23 15:53:55 -07:00
Brandon Dail
34780da5c8 Warn early for non-functional event listeners (#10453)
* Add early warning for non-functional event listeners

* Use functional listeners in ReactDOMComponent test

To avoid triggering the non-functional event listener component

* spy on console.error in non-function EventPluginHub test

This should warn from ReactDOMFiberComponent, but we just ignore it here

* Remove redundant check for listener

* Add expectation for non-functional listener warning in EventPluginHub

* Hoist listener typeof check in hot paths

* Include stack addendum in non-functional listener warning

* Make it pretty

* Remove it.onnly from ReactDOMFiber test

* Fix message

* Update expected message

* Change invariant message to match the new style

* Fix remaining warning
2017-08-23 13:38:48 +01:00
Brian Vaughn
6ab2869a20 RN (fiber) avoids the overhead of bridge calls if there's no update. (#10505)
This is an expensive no-op for Android, and causes an unnecessary view invalidation for certain components (eg RCTTextInput) on iOS.
2017-08-22 13:31:46 -07:00
Ben Alpert
640eb70446 Revert "Use the virtual target for change events to avoid restoring controlled state on the real target (#10444)" (#10504)
This reverts the meaningful (src, non-test) part of commit 3bc64327f0 since we've reverted the commit it depended on in 18083a8a73. I don't fully understand the negative implications of leaving this unreverted but it sounds like consensus is that it's safer to revert.

I left the new fixture and verified it works correctly in Chrome 62 Mac, as well as the jest tests passing.
2017-08-21 17:51:26 -07:00
Nathan Hunzaker
35859df941 Add missing single-word attributes to property warning list (#10495)
* Add missing single-word attributes to property warning list

* Alphabetize svg and html configs in possible names

* Add basic test coverage for known single word attributes

* Add note about including whitelist properites in `possibleStandardNames

* Also add attribute sync comment to possibleStandardNames
2017-08-21 12:27:09 -04:00
Alexander
ec77740ac3 Add renderer id to react-devtools injection (#10475)
* add renderer id to react-devtools injection

* rename renderer id to rendererPackageName in react-dom injection

* add rendererPackageName to react-native entries
2017-08-21 12:10:44 +02:00
Brian Vaughn
e464cf2def Removed ReactNativeFeatureFlag shim from RN bundle (#10472) 2017-08-18 08:26:11 -07:00
Flarnie Marchan
18083a8a73 Revert "Remove old IE polyfill code" (#10483)
**what is the change?:**
This reverts 0b220d0f04
Which was part of https://github.com/facebook/react/pull/10238

**why make this change?:**
When trying to sync the latest React with FB's codebase, we had failing
integration tests.

It looks like they are running with an old version of Chrome and there
is something related to file upload that fails when these polyfills are
missing.

For now we'd like to revert this to unblock syncing, but it's worth
revisiting this change to try and add some polyfill for FB and remove it
from React, or to fix whatever the specific issue was with our file
upload error.

**test plan:**
`yarn test` and also built and played with the `dom` and `packaging`
fixtures
2017-08-17 16:19:41 -07:00
Andrew Clark
caaa0b047d Reset instance vars before calling commit phase lifecycles (#10481) 2017-08-17 13:52:38 -07:00
Jack Ford
072b1d9860 Add invariant check for composite components to event simulation test utils (#10414)
* Add invariant check for composite components to event simulation test utils

* Change simulate variable names from domComponentOrNode to domNode, language for new simulate invariant, and add space in existing invariant

* Update test name

* Update test for invariant with shallow rendering

* Update text for existing invariant and change comments to reflect change to only domNode usage

* Update text for existing invariant to reflect syntax with new invariant

* Update ReactTestUtilsEntry.js

* Update React element invariant to reflect usage with shallow rendering

* Move Simulate-related tests into Simulate block

* Run prettier
2017-08-17 20:23:36 +02:00
Flarnie Marchan
149860bada Replace object getter with Object.defineProperty in TestRenderer (#10473)
* Add babel transform for object getters

**what is the change?:**
We were not transforming object getters[1], and our new TestRenderer
uses one.[2]

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get
[2]: https://github.com/facebook/react/blob/master/src/renderers/testing/ReactTestRendererFiberEntry.js#L569

**why make this change?:**
Our internal build system was not supporting object getters.

**test plan:**
`yarn build && yarn test`
Also built and opened the 'packaging' fixture.

Honestly I'm not sure what else to test, this seems pretty low risk.

**issue:**
None opened yet

* Replace object getter with `Object.defineProperty` in TestRenderer

**what is the change?:**
Replaces an Object Getter [1] with `Object.defineProperty`.

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get

**why make this change?:**
Our internal build system does not support object getters.

**test plan:**
We should do follow-up work to ensure that this doesn't come up again -
we can't commit code which uses object getters.

**issue:**
No issue opened yet

* Tweak the Object.defineProperty call in test renderer to make flow pass

**what is the change?:**
- switched from `Object.defineProperties` to `Object.defineProperty`
- set some undefined properties to get flow to pass

**why make this change?:**
- Flow doesn't seem to play nicely with `Object.defineProperty/ies`
  calls, specifically when you implement `get` and `set` methods.
  See https://github.com/facebook/flow/issues/1336
- Switched from `properties` to `property` because it seems more
  conventional in our codebase to use `property`, and I'm only setting
  one anyway.

**test plan:**
`flow`

**issue:**
no issue

* More flow type tweaking

**what is the change?:**
Forced the typing of an argument to 'Object.defineProperty' to be
'Object' to avoid an issue with Flow.

**why make this change?:**
To get tests passing and flow passing.

**test plan:**
`flow && yarn test`

**issue:**
2017-08-17 07:23:16 -07:00
Flarnie Marchan
34092a0f24 Throw error to warn of mistaken loading of prod + dev React bundles (#10446)
* Throw error to warn of mistaken loading of prod + dev React bundles

**what is the change?:**
Credit to @gaearon for coming up with a clever way to check for this. :)

I mainly just did the manual testing and fixed a couple of typos in his
idea.

I'd like to do a follow-up PR to add a link and a page explaining this
issue more and suggesting how to fix it.

**why make this change?:**

We want to warn for an unfortunate gotcha for
the following situation -
1. Wanting to shrink their JS bundle, an engineer runs it through
   'uglifyjs' or some other minifier. They assume this will also do
   dead-code-elimination, but the 'prod' and 'dev' checks are not
   envified yet and dev-only code does not get removed.
2. Then they run it through browserify's 'envify' or some other tool to
   change all calls to 'process.env.NODE_ENV' to "production". This
   makes their code ready to ship, except the 'dev' only dead code is
   still in the bundle. Their bundle is twice as large as it needs to
   be, due to the dead code.

This was a problem with the old build system before, but with our new
build system output it's possible to detect and throw an informative
error in this case.

**test plan:**
1. run the build in react as usual; `yarn build`
2. manually run 'uglifyjs -mt' on 'build/packages/react/index.js' to
   simulate mistakenly minifying React before env variables are
   resolved, which skips dead code elimination.
3. run the fixtures build - `cd fixtures/packaging && node
   ./build-all.js && serve ../..`
4. Visit just the production browserify fixture -
   http://localhost:5000/fixtures/packaging/browserify/prod/
5. You should see the error thrown indicating this problem has occurred.
(Flarnie will insert a screenshot)
6. Do the above steps with NO uglifyjs step, and verify that no error is
   thrown. When there is no minification applied, we don't assume that
   this mix-up has occurred.
(Flarnie will insert a screenshot)

**issue:**
fixes #9589

* Remove extra 'prod' env. check and add link to docs in error message

**what is the change?:**
Based on helpful feedback from @gaearon
- removed outer check that `process.env.NODE_ENV` is "production" since
  we are only calling the `testMinification` method inside of another
  check for "production" environment.
- Added an fburl that points to [our current docs on using the production version of React](https://facebook.github.io/react/docs/optimizing-performance.html#use-the-production-build)

**why make this change?:**
To save an extra layer of conditionals and to make the error message
more clear.

**test plan:**
Same test plan as earlier -

1. run the build in react as usual; yarn build
2. manually run 'uglifyjs -mt' on 'build/packages/react/index.js' to
   simulate mistakenly minifying React before env variables are
   resolved, which skips dead code elimination.
3. run the fixtures build - cd fixtures/packaging && node ./build-all.js && serve ../..
4. Visit just the production browserify fixture -
   http://localhost:5000/fixtures/packaging/browserify/prod/
   You should see the error thrown indicating this problem has occurred.
   (Flarnie will insert a screenshot in comments on the PR)
6. Do the above steps with NO uglifyjs step, and verify that no error is thrown. When there is no minification applied, we don't assume that this mix-up has occurred.
(Flarnie will insert a screenshot in the comments on the PR.)

**issue:**
https://github.com/facebook/react/issues/9589

* WIP fix and test 'testMinificationUsedDCE' method

**what is the change?:**
- Instead of looking for one match when having the method inspect it's
  own source, we look for two matches, because the search itself will be
  a match.
- WIP moving this method into another file and testing it.

Next steps:
- Figure out why the babel.transform call is not actually minifying the
  code
- Add tests for uglifyjs
- Update build process so that this file can be accessed from
  `packages/react/index.js`

**why make this change?:**
- We had a bug in the 'testMinification' method, and I thought the name
  could be more clear. I fixed the code and also changed the name.
- In order to avoid other bugs and keep this code working in the future
  we'd like to add a unit test for this method. Using the npm modules
  for 'uglifyjs' and 'babel'/'babili' we should be able to actually test
  how this method will work when minified with different configurations.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/9589

* Add babeli and uglifyjs as dev-only dependencies

**what is the change?:**
See commit title

**why make this change?:**
In order to test that we are correctly detecting different minification
situations, we are using these modules in a test.

**test plan:**
NA

**issue:**
https://github.com/facebook/react/issues/9589

* Fix typo and add 'uglifyjs' tests

**what is the change?:**
There was a mix-up in the conditional in 'testMinificationUsedDCE' and
this fixes it.

The great new tests we added caught the typo. :)

Next steps:
- get the tests for 'babili' working
- update build scripts so that this the 'testMinificationUsedDCE'
  module is available from 'packages/react/index.js'

**why make this change?:**
We want to modularize 'testMinificationUsedDCE' and test it.

This verifies that the method warns when `uglifyjs` is used to minify
but dead code elimination is not done, in a production environment.
Generally this is a 'gotcha' which we want to warn folks aboug.

**test plan:**
`yarn test src/shared/utils/__tests__/testMinificationUsedDCE-test.js`

**issue:**
https://github.com/facebook/react/issues/9589

* Run prettier

* var -> const/let

* Require specific version of `uglify-js`

**what is the change?:**
Removed the '^' from the npm package requirement

**why make this change?:**
I am seeing failures in CI that show `uglify-js` is returning different
output there from my local environment. To further debug this I'd like
to run CI with the exact same version of `uglify-js` that I am using
locally.

**test plan:**
push and see what CI does

**issue:**
https://github.com/facebook/react/issues/9589

* Add build step copying testMinificationUsedDCE into build/packages/react/cj

**what is the change?:**
This is a first step - we still need (I think) to process this file to
get it's contents wrapped in an 'iffe'.

Added a step to the build script which copies the source file for the
'testMinificationUsedDCE' module into the 'cjs' directory of our react
package build.

**why make this change?:**
We want this module to be available to the 'index.js' module in this
build.

**test plan:**
Will do manual testing once the build stuff is fully set up.

**issue:**

* Inline 'testMinificationUsedDCE' and remove unit test for now

What:
- Inlines the 'testMinificationUsedDCE' method into
  'packages/react/index.js'
- Removes unit test for 'testMinififcationUsedDCE'
- Puts dependencies back the way that they were; should remove extra
  dependencies that were added for the unit test.

Why:
- It would add complexity to the build process to add another file to
  the 'build/packages/react/cjs' folder, and that is the only way to
  pull this out and test it. So instead we are inlining this.

* Revert unintentional changes to dependency versions, variable placing

**what is the change?:**
- We had updated and added some dependencies, but ended up reverting
  this in a previous commit. The `yarn.lock` and `package.json` needed
  updated still though.
- There is a call to `Function.toString` which we wanted to wrap in a
  `try/catch` block.

**why make this change?:**
To remove unrelated dependency changes and increase the safety of the
`Function.toString` call.

**test plan:**
Manual testing again

**issue:**
https://github.com/facebook/react/issues/9589
2017-08-16 11:44:31 -07:00
Nathan Hunzaker
5ba1803ba2 Custom attribute follow up (#10470)
* Wrap ARIA prop warnings in backticks.

* Use accurate test names after updating custom attribute logic
2017-08-16 16:07:08 +02:00
Karthik Balakrishnan
7e297e9b20 Add ReactFoo 2017 to list of upcoming conferences (#10467) 2017-08-16 08:10:28 -04:00
ksvitkovsky
488e7413ca Use only public API in CSSProperty-test (#10429)
* Use only public API in CSSProperty-test

* Move test to ReactDOMServerIntegration

* Add explanation
2017-08-16 10:09:03 +02:00
Nathan Hunzaker
2999811b07 Custom Attributes Scenario 2: Write badly cased attributes. Remove most of whitelist. (#10385)
* Allow custom attributes. Add flag to toggle custom attribute behavior

* Update custom attribute logic

- Only allow string attributes
- Remove custom attribute feature flag
- Add additional tests for data, aria, and custom attributes

* Allow numbers and booleans custom attributes. Cut isCustomAttribute

* Cover objects with custom attributes in warning test

* Rename DOMProperty.isWriteable to shouldSetAttribute

* Rework conditions in shouldSetProperty to avoid edge cases

* Update unknown property warning to include custom attribute information

* Remove ref and key from reserved props

* Ensure SSR test coverage for DOMProperty injections

* Add ajaxify attribute for internal FB support

* Ajaxify is a stringifiable object attribute

* Remove non-case sensitive standard attributes. Make ARIA hook dev only.

* Update test name for custom attributes on custom elements

* Remove SSR custom injection test

* Remove case sensitive props

* Remove onAfterResetModules hooks in SSR render tests

* Add back a few attributes and explain why they are needed

* Remove possibleStandardNames from DOMProperty.js

* Fix typo in HTMLPropertyConfig comment

* Remove duplicative comment

* Add back loop boolean property

* Do not allow assignment of attributes that are aliased

* Update custom attribute test to check value, not just presence

* Address case where class is assigned as an attribute on custom elements. Improve SSR tests

* Cover cases where className and for are given to custom elements

* Remove unnecessary spys on console.error. Reduce extra space in tests

* Cover cased custom attributes in SSR tests

* Custom attributes are case sensitive

* Allow uppercase letters in custom attributes. Address associated edge cases

* Allow improperly cased aliased attributes. Add additional tests

* Handle special properties like onFocusOut

* Add some comments to document where casing matters. Remove DOMPropertyNames

* Fix spelling mistake in ajaxify HTML property comment

* Make ARIA enforcement dev-only

* Remove alias test that covers multiple aliases for one property

* Fix typo in comment

* Build SVG aliases dynamically

* Remove unused DOMPropertyNames reference

* Do not translate bad casings of aliased attributes

- classname writes to the DOM as classname
- class does not write to the DOM
- cLASS does not write to the DOM
- arabic-form does not write to the DOM

* Revise the way custom booleans are treated

- Custom attributes can not have boolean values unless they are aria
  or data attributes
- Attributes with boolean values have been added back to the whitelist
- Warnings now exclude booleans from supported types
- Associated test coverage

* Add developer warnings for NaN and ARIA hooks

* Use string comparison instead of regex to check for data and aria attributes.

* Warn about unsupported properties without case sensitivity

* Remove attributes that are updated to invalid values

* Support object property values with toString methods. Allow boolean props to coerce objects

* Add back ajaxify test

* Address bad references in ReactDOMComponent-test. Format.

* Revert changes to the docs

We'll update them separately

* Allow all objects and pass incorrect aliases
2017-08-15 09:00:44 -07:00
Ian Sutherland
7f6b940919 Added unit tests for creating an element with a ref in a constructor. Only set ReactCurrentOwner.current in dev mode when the component has no constructor. (#10025) 2017-08-15 11:21:49 +02:00
Brian Vaughn
b4a3e3b345 Added "Advanced Guides" page about cross-origin Errros (#10457) 2017-08-14 13:43:24 -07:00
Brian Vaughn
6c6ff8c4b6 Better messaging for componentDidCatch cross-origin errors (#10447)
The prior message was a bit wordy and didn't cover all cases (like the one we discovered while researching #10441).

We can use the new URL to explain background info on the DEV-mode technique we're using in addition to common fixes (eg crossorigin attribute for CDN scripts and Webpack devtools settings). Putting this information behind a link will allow us to more easily edit it in the future as common causes for this issue change.

Resolves #10441
2017-08-14 11:05:29 -07:00
Ben Alpert
5e85f0065b Don't warn about casing in SSR for non-HTML NS (#10452)
Fixes #10415.
2017-08-13 16:17:45 -07:00
Ben Alpert
9921e57272 Warn when nesting 15 subtree inside 16 (#10434) 2017-08-13 16:03:31 -07:00
Brandon Dail
5ff5700625 Add explicit invariant when ReactDOM is loaded w/o React (#10449) 2017-08-13 13:16:13 -05:00
Sebastian Markbåge
3bc64327f0 Use the virtual target for change events to avoid restoring controlled state on the real target (#10444)
* Add test for nested controlled selects

The failure repros only when two events are fired sequentially, where the second
event is what updates the value.

* Add failure case to DOM select fixture

* Use virtual event target for change event instead of native target

Ensures that we use the same node to make decisions instead of two like
we do now.

This will cause restore to be called or not called consistently.

* Pass native event target to the event

We normally pass the native event target to the event object. This ensures
that we do the same thing here.

We still want to schedule a "restore" on the virtual target though since
those are the only nodes known to React.
2017-08-11 19:02:10 -07:00
Edgar (Algebr)
2cd0ecdaac Fixes #10443 (#10448) 2017-08-11 18:08:00 -07:00
Sebastian Markbåge
abc0efa6cc Update version on dom fixtures (#10445)
And yarn lock file.

Avoids a dependency that my proxy won't let me install.
2017-08-11 17:01:37 -07:00
Dan Abramov
58e6edeef6 Find callsites that would call toString() if we pass attributes through (#10416)
* Find callsites that would call toString() if we pass attributes through

* Warn for all object unknown props, not just 'toString' ones

fixing this as per Sebastian's feedback, because we want to find all
objects and not just ones with 'toString' defined. Because there may be
other corner cases and issues that are revealed.
2017-08-11 11:07:41 -07:00
Sasha Aickin
4d08914985 Fix for #10388. Renames renderToStream to renderToNodeStream. (#10425) 2017-08-10 12:23:00 -07:00
Brian Vaughn
8b1b0720cc Wrap warning() calls in a DEV check for RN_* builds too (#10428)
* Wrap warning() calls in a DEV check for RN_* builds too.
* Wrapped several warning() imports and calls in if-DEV checks.
* Removed a useless variable (allTypesByEventName) and loop from ReactNativeBridgeEventPlugin.
2017-08-10 08:41:51 -07:00
Dominic Gannaway
e97143cca5 Use Closure Compiler for UMD/Node bundles instead of Uglify (#10236)
* Use GCC instead of Uglify for UMD/NODE bundles

* Prettier run

* Fixes fixtures that were alterated by Pretter and trailing function commas

* prettier on prettier

* updated prettier config

* altered prettier config slightly

* Reverted prettier changes

* updated results.json
2017-08-10 11:12:29 +01:00
Dominic Gannaway
5caa65c3c5 Make createFiber use a constructor object rather than an object literal object (#9369)
* made createFiber create a constructed FiberNode object

* updated comment

* satisfying flow and prettier

* better comments :)

* fixes flow error

* updates comment

* converted function constructor to a ES2015 class

* Revert "converted function constructor to a ES2015 class"

This reverts commit c020982c5fe62446667f6f933c834366c3f009b3.

* fixed some merge conflict issues

* Flow....

* removed exact types to make flow pass

* opted for $FlowFixMe instead

* removed exact types to make flow pass

* opted for $FlowFixMe instead

* run prettier
2017-08-09 23:40:35 +01:00
Dominic Gannaway
b9e92c6747 Moved around package dependencies fixes #10335 (#10424) 2017-08-09 18:47:52 +01:00
Brandon Dail
64287af8d1 Set date to initial value when reset (#10412) 2017-08-09 10:52:26 -05:00
Mateusz Burzyński
9166cf9b8d Add test for duplicate events with nested dispatch 2017-08-09 09:30:08 -05:00
Andrew Clark
32c9f7e827 Update Flow to 0.52 (#10417)
For opaque types
2017-08-08 19:02:10 -07:00
Brian Vaughn
c3718c48f0 16 beta 5 version bump and results JSON 2017-08-08 10:25:25 -07:00
Brian Vaughn
1724b116cd Enable new fiber ReactTestRenderer API methods (#10410)
Enable new fiber ReactTestRenderer API methods
2017-08-08 10:17:59 -07:00
Andrew Clark
5cdd744e06 Fix bugs related to unmounting error boundaries (#10403)
* Don't warn about setState on unmounted when scheduling error recovery

We shouldn't schedule an update on unmounted error boundaries, but we
don't know if a boundary is unmounted until we traverse its parents.
Added an additional argument to scheduleUpdate so we know not to warn
about setState on unmounted components.

* Should be able to unmount an error boundary before it is handled

Fixes the case where an error boundary captures an error, but its
parent is unmounted before we can re-render it. componentDidCatch is
never called, and we don't remove the boundary from our set of
unhandled error boundaries.

We should not assume that if capturedErrors is non-null that we still
have unhandled errors.
2017-08-08 10:09:43 -07:00
Brian Vaughn
9ebd0c9e9a Updated packages and results JSON for 16 beta 4 2017-08-08 09:08:17 -07:00
Rodrigo Pombo
fc3fb4bd72 Fiber debugger enhancements (#10393)
* Add effect tag

* Add graph settings (direction and trackActive)

* Support multiple effect tags
2017-08-08 11:31:48 +01:00
Ben Alpert
a6e20d0bd8 Add traversal for Fiber test renderer (#10377)
Not clear the path to shipping this but this gives us a migration path internally that we need right now (replaces https://fburl.com/udq9ksvk).
2017-08-07 16:47:22 -07:00
Dan Abramov
efcac24af2 Remove data-reactid and data-reactchecksum from whitelist (#10402) 2017-08-07 21:28:26 +01:00
Dan Abramov
4e4653da9b Rewrite DOMPropertyOperations-test in terms of public API (#10281)
* Rewrite DOMPropertyOperations-test in terms of public API

* Add more assertions

I don't understand what the jsdom comments are about since they pass.

* Address review feedback
2017-08-07 20:12:13 +01:00
Ben Alpert
7aec5f8f49 Update installation.md 2017-08-04 17:10:50 -07:00
Rodrigo Pombo
07acd7db81 [fiber-debugger] Support undefined progressedPriority (#10375)
[fiber-debugger] Fix the debugger to match changes to Fiber
2017-08-04 19:45:20 +01:00
Dan Abramov
145986ec17 Compile spread to Object.assign calls (#10387) 2017-08-04 19:12:12 +01:00
Dan Abramov
327d126392 Move PooledClass to Stack folder (#10386) 2017-08-04 19:10:07 +01:00
Brandon Dail
755724a24c Implement event-specific pooling for SyntheticEvent (#10237)
* Remove PooledClass from FallbackCompositionState

The only module that uses FallbackCompositonState is BeforeInputEventPlugin. The way its structured means there can only be a single instance of FallbackCompositionState at any given time (stored in a local variable at the top-level) so we don't really need pooling here at all. Instead, a single object is now stored in FallbackCompositionState, and access (initializing, reseting, getting data) is gaurded by the exported helper object.

* Use new FallbackCompositionState API in BeforeInputEventPlugin

* Implement event-specific pooling in SyntheticEvent

* Remove PooledClass from TopLevelCallbackBookKeeping

* Update results.json

* Add pooled event test fixtures (#1)

* Fix fixture lint
2017-08-04 18:24:48 +01:00
Dan Abramov
efa71484b3 Warn about unresolved function as a child (#10376)
* Warn about unresolved function as a child

* Oops
2017-08-04 15:51:47 +01:00
Nathan Hunzaker
6f28ecf0cb Fix incorrect reference to undefined diffValueForAttribute (#10235)
* Fix incorrect reference to undefined diffValueForAttribute

* Remove custom attribute branch in getValueForProperty
2017-08-04 14:47:28 +01:00
Devedse
25894e82c2 Wop optimized this repository (#10374)
The Web Optimization Project optimized this repository. This commit contains the optimized files in this repository.
2017-08-04 14:41:38 +01:00
Brian Vaughn
230d41218e Built 16.0.0 beta 3. Updated versions, results.json, and error codes 2017-08-03 16:05:28 -07:00
Brian Vaughn
6188832c5e Log captured errors sooner (#10373)
This prevents the captured error from becoming separated from the component stack if other errors (or console.error calls) are made between them, eg a component errors during unmount.
2017-08-03 15:51:09 -07:00
Dan Abramov
80577eb649 Don't call componentDidUpdate() in shallow renderer (#10372)
* Don't call componentDidUpdate() in shallow renderer

* Lint

Sent from my iPhone haha

* Consistent comments
2017-08-03 22:49:29 +01:00
Dan Abramov
a130757cd3 Remove hidden functional shouldComponentUpdate API (#10371) 2017-08-03 20:24:09 +01:00
Andrew Clark
a650699d2f Cross-origin error handling in DEV (#10353)
* Add DOM fixture for cross-origin errors

* Use a custom error object in place of cross-origin errors

Cross-origin errors aren't accessible by React in DEV mode because we
catch errors using a global error handler, in order to preserve the
"Pause on exceptions" behavior of the DevTools. When this happens, we
should use a custom error object that explains what happened.

For uncaught errors, the actual error message is logged to the console
by the browser, so React should skip logging the message again.

* Add test case that demonstrates errors are logged even if they're caught

* Don't double log error messages in DEV

In DEV, the browser always logs errors thrown inside React components,
even if the originating update is wrapped in a try-catch, because of the
dispatchEvent trick used by invokeGuardedCallback. So the error logger
should not log the message again.

* Fix tests

* Change how error is printed in DEV and PROD

In DEV, we don't want to print the stack trace because the browser already always prints it.
We'll just print the component stack now.

In PROD, we used to omit the JS error message. However we *do* want to show it because
if the application swallows the error, the browser will *not* print it. In DEV it works
only because of the fake event trick. So in PROD we will always print the underlying error
by logging the error object directly. This will show both the message and the JS stack.

* Make the wording tighter and emphasize the real error is above

There's a few goals in the rewording:

* Make it tighter using line breaks between sentences.
* Make it slightly less patronizing ("You should fix it" => "You can find its details in an earlier log")
* ^^ This also helps highlight that the real error message and stack is above
* Group subsections: intro (there's an error), component stack, and final addendum about error boundaries
* ^^ Otherwise people might think error boundaries are part of the reason they have an error
* Make it clear "located at" is not the stacktrace. Otherwise it feels confusing. This makes it clearer you should still look for stack trace (with other details) above and introduces the concept of component stack.

* Make the message shorter

* Unused variables

* Fix an error caused by fixing lint

* One more bikeshed

* Fix fixture

* Remove unused file

* Concise wording

* Unused variables
2017-08-03 18:25:53 +01:00
Brian Vaughn
028e0ea937 Fix lint error in DOM fixtures (#10369) 2017-08-03 17:32:04 +01:00
Dan Abramov
03ca99d9ba Add documentation about <script crossorigin> for React CDN usage (#10368) 2017-08-03 16:13:13 +01:00
Jason Quense
0b220d0f04 Remove old IE polyfill code (#10238)
* Upgrade DOM Fixtures

Upgrade to react-scripts v1 and include required polyfills for older
browsers

* Remove ChangeEvent polyfills for unsupported browsers
2017-08-03 13:45:41 +01:00
Dan Abramov
c1833b4b7e Fix CI maybe 2017-08-03 00:59:40 +01:00
Dan Abramov
fc86ef0f3d Use single entry point for SSR via browser field (#10362)
* Use single entry point for SSR via browser field

* Add server.browser entry point and smoke tests

* Tweak bundle naming

* Fix import

* Re-record

* Fix the robot nits

* Add resetModules for some extra isolation
2017-08-03 00:41:09 +01:00
Brian Vaughn
630afb3186 Wrap contents of if-DEV condition in an IIFE (#10361)
This avoids strict mode conflicts for certain browsers wrt functions being defined within an if-block.
Also re-added the if-DEV condition for the ReactNative renderer since it was removed for this reason.
2017-08-02 14:24:43 -07:00
Brian Vaughn
f3e502c613 FB bundles wrap warning() calls in __DEV__ (#10314)
FB bundles wrap warning() calls in __DEV__

Split dev-mode transforms into separate parts:
1) umd+cjs+fb: Wrap warning calls with process.env checks
2) umd+cjs: Replace error messages with minified codes

Also updated transforms to use __DEV__ since it transforms to smaller code after stripEnvVariables is run.

Also renamed 'scripts/error-codes/dev-expression-with-codes.js' -> 'scripts/error-codes/replace-invariant-error-codes.js'
2017-08-02 14:14:26 -07:00
Dan Abramov
8890db707b Don't suggest downloading React DevTools inside Chrome extension (#10359) 2017-08-02 20:04:49 +01:00
Dan Abramov
9823808632 Upsell React DevTools in 16 (#10351)
* Upsell React DevTools

* Fix Flow

* Upsell message nits

* Avoid extra checks in onCommitRoot and onCommitUnmount
2017-08-02 18:56:24 +01:00
Dan Abramov
4e6cc2f495 Warn on missing Set/Map polyfills (#10356)
* Crash on missing Set/Map polyfills

* Change Map/Set to emit warnings instead

* Change rAF polyfill check to also be a warning

* Liiiiiint
2017-08-02 18:55:18 +01:00
Toru Kobayashi
ffec3be560 Remove an unnecessary __DEV__ condition (#10350) 2017-08-02 17:57:41 +01:00
Brian Vaughn
2da37a8a44 Shallow renderer passes context to componentWillReceiveProps (#10342)
This parameter was accidentally omitted before. Leland reported it because it impacts Enzyme.
I also added a basic lifecycle parameter test for shallow renderer.
2017-08-02 08:18:46 -07:00
Andrew Clark
372445735e Remove rAF export from ReactDOMFrameScheduling (#10337)
Fiber doesn't schedule animation callbacks anymore (though it does use
the browser's requestAnimationFrame to polyfill requestIdleCallback).

This removes the rAF export from ReactDOMFrameScheduling, since it's not
being used.
2017-08-02 19:56:37 +05:30
Nathan Hunzaker
81706eeb7a Remove event namespace check from react-partial-renderer (#10344) 2017-08-02 11:30:44 +01:00
Toru Kobayashi
7917709782 Fix a typo (#10349) 2017-08-02 11:09:09 +01:00
Michał Pierzchała
73217a74a0 Fix error-codes not updating correctly (#10348)
* Fix error-codes not updating correctly

* Revert changes to codes.json
2017-08-02 10:38:27 +01:00
Greg Hurrell
c5d1558a5b Grammar fixes for a code comment (#10343) 2017-08-02 01:20:53 +01:00
Dan Abramov
35e3133610 Remove hydrate() warning about empty container (#10345)
* Remove hydrate() warning about empty container

It used to have false positives for cases where we legitimately don't render anything.

* Use existing constant

* Test empty string case using its parent
2017-08-02 01:05:56 +01:00
Dan Abramov
a43ba2625b Add an extra test for arrays and strings from composites (#10346) 2017-08-02 01:05:42 +01:00
Dan Abramov
f8062df1d6 Add ReactDOM.hydrate() as explicit SSR hydration API (#10339)
* Add ReactDOM.hydrate()

* Deprecate ReactDOM.render() hydration in favor of ReactDOM.hydrate()

* Downgrade the warning level to console.warn()

* Warn when hydrate() is called with empty container
2017-08-01 21:17:24 +01:00
Dan Abramov
a2ed7a6d96 Make unexpected console.warn() calls fail tests (#10341)
* Make console.warn() calls fail tests

* Replace matchers with a more straightforward cleanup
2017-08-01 19:53:37 +01:00
Brian Vaughn
d947654913 Context improvements (#10334)
Refactored fiber context to fix a nested updates bug
2017-08-01 08:38:54 -07:00
Dan Abramov
78165276c7 Test for specific SSR warning (#10340)
* Test for specific SSR warning

* Same in another place
2017-08-01 14:38:17 +01:00
Jack Ford
04db3511fe Remove trapBubbledEventsLocal (#10258)
* Inline trapBubbledEventsLocal

* Revert "Inline trapBubbledEventsLocal"

This reverts commit 0ee65ff491deeec70223c2e39d04ef0aeda95d73.

* Merge remove-local-trap-bubbled-events branch
2017-08-01 08:37:26 +01:00
Toru Kobayashi
73038840ef Move ShallowRenderer tests (#10184) 2017-08-01 08:27:28 +01:00
Toru Kobayashi
56cd54f0ad Add tests that ShallowRenderer supports string and fragment (#10241) 2017-08-01 00:39:43 +01:00
Dan Abramov
1454f9c10c Fix invariant parity for SSR (#10333) 2017-07-31 21:13:50 +01:00
Dan Abramov
67347a6459 Fix SSR integration test swallowing lack of expected error (#10331)
* Don't catch the assertion about missing errors

Previously, even if an error was not thrown, the assertion about this was ignored.

This fix exposes two failing cases in new SSR that weren't failing in Stack.

* Add child context validation to new SSR

This fixes the error cases that were silently failing before but are now exposed.
2017-07-31 17:57:05 +01:00
guoyong yi
f732fc677b fix renderToString fails with array type children when react-dom/server render (#10221)
* fix(*): fix renderToString fails with array type children when react-dom/server render

* Add an integration test that verify renderToString with array type children

* Add integration test to renderToString with array type child

* Update integration test to renderToString with array type child

* fix renderToString fails with array type children when react-dom/server render

* Update integration test to renderToString with array type child

* Add to iterate that are not arrays

* Add the validation react element

* Improve an integration test of server renderToString with array type

* prettier

* prettier

* Make SSR can handle a single array element and nested array

* prettier

* Change integeration test description

* 	modified:   src/renderers/dom/ReactDOMNodeStreamRenderer.js

* Make invariants consistent

* Gate outdated test itself by feature flag

* Change test to make sense both with old and new code

* Test more cases
2017-07-31 16:59:14 +01:00
Dominic Gannaway
ca46c5278f Move line to within DEV block (#10316)
* move line to within DEV block

* addressed code review feedback
2017-07-27 17:31:34 -07:00
Dan Abramov
c7e9044c51 Make it more specific 2017-07-27 23:44:43 +01:00
Fernando Montoya
95cec9927c Add Babel plugin note to Error boundaries post (#10313)
* Add Babel plugin note to Error boundaries post

* Added section with screenshots

* Add context to Component stack traces

* Update 2017-07-26-error-handling-in-react-16.md

* Move section, more minor changes

* Change pics
2017-07-27 23:25:59 +01:00
Dominic Gannaway
6b3b9b5563 Wraps two warnings that should be removed from PROD (#10315) 2017-07-27 11:24:34 -07:00
Nathan Hunzaker
083cc5f4f9 Add date time test fixtures (#10154)
* Add date time test fixtures

This commit adds a new section for the DOM test fixtures specifically
for date inputs. Additionally, it adds a test case to verify that
correct transference of dates between the `"date"` and
`"datetime-locale"` input types.

* Adjust date parsing to be clearer
2017-07-27 13:24:04 -04:00
Dan Abramov
138224f6b3 16.0.0-beta.2 2017-07-27 18:06:26 +01:00
Dan Abramov
7a60a80921 Make server hydration warnings more obviously about server (#10312) 2017-07-27 18:02:16 +01:00
Sebastian Markbåge
e1cfd6c082 Remove Error event listener eagerly instead of using depth count (#10296)
A little simpler.
2017-07-27 09:45:07 -07:00
Dan Abramov
44c74c7b12 Add smoke tests for styles (including SSR) (#10308)
* Add style to ReactDOM smoke test

* Add production smoke test for ReactDOMServer
2017-07-27 14:58:03 +01:00
Toru Kobayashi
69d07612c5 Add a link for the error boundaries codemod into the blog post (#10305)
* Add a link for the error boundaries codemod into the blog post

* Update 2017-07-26-error-handling-in-react-16.md
2017-07-27 14:57:33 +01:00
Dan Abramov
bc0d241be1 Reword further 2017-07-27 10:48:37 +01:00
Daniel Lo Nigro
759690f7b2 Replace "children (and grandchildren)" with "descendants" (#10297) 2017-07-27 10:23:36 +01:00
Keyan Zhang
3abbcc48a5 Fix ReactPartialRenderer in production (#10300) 2017-07-27 10:19:05 +01:00
Dominic Gannaway
f92343159d Wrap "warning" call in DEV block to prevent PROD error (#10295)
* re-adds warning module to FB PROD bundle

* Wrap the warning call too
2017-07-26 14:59:44 -07:00
Dan Abramov
1f3de403bc Link to React 16 beta 2017-07-26 21:20:12 +01:00
Dan Abramov
4ac21f2a5f Blog post: Error Handling in React 16 (#10267)
* Blog post: Error Handling in React 16

* Change the date
2017-07-26 21:15:19 +01:00
Brian Vaughn
834d2c6954 Updated package versions and Rollup results 2017-07-26 12:55:31 -07:00
Dan Abramov
f3b4aaf388 Fix process override in ErrorUtils test (#10293) 2017-07-26 20:40:09 +01:00
Brian Vaughn
36a7d5b326 Fix error utils test failure caused by updating error codes (#10291) 2017-07-26 12:39:58 -07:00
Brian Vaughn
52849c94a7 Updated error codes (after merging in missing code from 15 stable) (#10290) 2017-07-26 12:18:02 -07:00
Dan Abramov
9a290fb1a7 Link warning to error boundary post (#10289) 2017-07-26 19:59:07 +01:00
Brian Vaughn
8d5f2c4324 Regenerate error codes and update bundle size stats (#10287) 2017-07-26 11:21:43 -07:00
Brian Vaughn
e2d1bc8a71 Update pre-release instructions for generating error-codes (#10286) 2017-07-26 11:18:32 -07:00
Dan Abramov
ac76c95fbc Add a disclaimer to internal invariants (#10285) 2017-07-26 19:08:22 +01:00
Andrew Clark
6c66d38d25 Remove feature test from invokeGuardedCallbackDev (#10283)
The critical semantics are resilient to browser flakiness, so we don't
need this feature test.

Also added comments explaining how invokeGuardedCallback dev works.
2017-07-26 10:01:31 -07:00
Dan Abramov
77e1129628 Delete react-dom-factories package (#10279) 2017-07-26 13:00:58 +01:00
Dan Abramov
66065115dc Update sizes 2017-07-26 12:27:29 +01:00
Dan Abramov
dea43046ef Dedupe unknown tag name warning and ignore <time> (#10275)
* Deduplicate unknown DOM tag warning

* Don't warn about <time> because it is widely used

Other browsers implement it, and Chrome will ship it soon too.

* Use hasOwnProperty

* Fix corner case: hasOwnProperty as a tag

* Update comments to be more correct factually
2017-07-26 11:57:29 +01:00
Dan Abramov
5495a7f24a Fix event name check to be more exact (#10274) 2017-07-26 11:56:38 +01:00
Andrew Clark
812cf1c6a3 [invokeGuardedCallback] Handle nested errors across separate renderers (#10270)
invokeGuardedCallback is a function we use in place of try-catch
statement. It accepts a function, and if the function throws, it
captures the error. In production, the implementation is a normal try-
catch. In development, we swap out the prod implementation for a special
version designed to preserve "Pause on all exceptions" behavior of the
browser DevTools.

invokeGuardedCallbackDev works by dispatching an event to a dummy DOM
node and calling the provided function inside a handler for that event.
We also attach an error event handler to the window object. If the
function throws, the global event handler is called and we can access
the error.

The global event handler is added and removed right before and after the
fake event is dispatched. But if invokeGuardedCallbackDev is nested --
 that is, if it's invoked inside the body of another
invokeGuardedCallbackDev -- multiple error event handlers will attached
simultaneously. We only want the handler that corresponds to the deepest
level to handle the error. So we keep track of a depth counter, and
within the event handler, we only handle the error if the current depth
matches the depth at the time the function was invoked.

The problem that we discovered, and that this PR fixes, is that the
depth counter is local to each renderer. So if you nest separate copies
of invokeGuardedCallback from separate renderers, each renderer will
have its own depth counter, and multiple error handlers will fire for a
single, nested error.
2017-07-25 09:44:43 -07:00
Dan Abramov
4c46b6c98a Fix false "unknown property" warnings for events in SSR (#10272)
* Reset modules between importing client and server modules in the test

Client and server renderers still share some modules, including injections.
This means they have shared state in this test, potentially missing issues that would occur in real world.

After this change, the client and server modules are completely isolated in the test.
This makes the tests fail due to https://github.com/facebook/react/issues/10265 (a real issue that was missed).

* Don't validate events if no plugins are injected
2017-07-25 17:01:48 +01:00
Brian Vaughn
171149a4b0 Fix failing Prettier command (#10268)
* Ran prettier over non-modified files to change them
* Fixed output of failing Prettier message to show invalid files
* Failing Prettier command now suggests 'yarn prettier-all'
2017-07-24 13:59:16 -07:00
Brian Vaughn
8d2fdc8e76 Don't add dangling commas to functions for packaging fixtures (#10264) 2017-07-24 09:09:40 -07:00
Andrew Clark
4fcc25a229 Support throwing null (#10213)
* Support throwing null

In JavaScript, you can throw values of any type, not just errors. That
includes null. We currently rely on null checks to determine if a user-
provided function has thrown. This refactors our error handling code to
keep track of an explicit boolean flag instead.

* Add DOM fixture test case for break on exception behavior

* preventDefault error events during feature test

We call invokeGuardedCallbackDev at startup as part of a feature test.
But we don't want those errors to log to the console.

* Add throwing null test case

* Use ReactFeatureFlags instead of ReactDOMFeatureFlags

React ART uses this, too.

* Non-errors in error logger

If a non-error is thrown, we'll coerce the value to a string and use
that as the message.
2017-07-21 15:34:41 -07:00
Andrew Clark
b3943497c2 Upgrade to Flow v0.50.0 (#10249)
No particular reason, just hoping memory usage is maybe better.
2017-07-21 15:30:32 -07:00
Andrew Clark
0a24255475 ReactDOM.activeUpdates (#10225)
ReactDOM.flushSync(batch)
2017-07-21 13:22:11 -07:00
Flarnie Marchan
1f74eca993 Add warning for rendering into container that was updated manually (#10210)
* RFC Add warning for rendering into container that was updated manually

RFC because we still need to tidy this up and verify that all tests
pass.

**what is the change?:**
We want to warn when users render into a container which was manually
emptied or updated outside of React. This can lead to the cryptic error
about not being able to remove a node, or just lead to silent failures
of render. This warning should make things more clear.

Note that this covers the case where the contents of the root container
are manually updated, but does not cover the case where something was
manually updated deeper in the tree.

**why make this change?:**
To maintain parity and increase clarity before releasing v16.0 beta.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

last item under the '16 beta' checklist.

* Add test and tweak check for rendering into manually updated container

STILL TODO: figure out how to skip this warning when the component
renders to a portal.

Unfortunately 'ReactPortal.isPortal(children)' returns false, even in
the failing test where we are rendering to a portal.

**what is the change?:**
- added a test for the case where we call 'ReactDOM.render' with a new
  container, using a key or a different type, after the contents of the
  first container were messed with outside of React. This case throws,
  and now at least there will be an informative warning along with the
  error.
- We updated the check to compare the parent of the 'hostInstance' to
  the container; this seems less fragile
- tweaked some comments

**why make this change?:**
Continue improving this to make it more final.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Stub our `console.error` in one of the portal tests

**what is the change?:**
See title

**why make this change?:**
See comment in the code

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Skip warning in 'ReactDOMFiberEntry' when mounting to Comment node

**what is the change?:**
We have a warning for cases when the container doesn't match the parent
which we remembered the previously rendered content being rendered into.

We are skipping that warning when you render into a 'comment' node.

**why make this change?:**
Basically, if you render into a 'comment' node, then the parent of the
comment node is the container for your rendered content. We could check
for similarity there but rendering into a comment node seems like a
corner case and I'd rather skip the warning without knowing more about
what could happen in that case.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Improve warning message, remove dedup check, and unmock console.error

**what is the change?:**
Various changes to get this closer to being finished;
- Improved warning message (thanks @spicyj!!!)
- Removed dedup check on warning
- Remove mocking of 'console.error' in portals test

**why make this change?:**
- warning message improvement: communicates better with users
- Remove dedup check: it wasn't important in this case
- Remove mocking of 'console.error'; we don't want to ignore an
  inaccurate warning, even for an "unstable" feature.

**test plan:**
`yarn test` -> follow-up commits will fix the remaining tests

**issue:**
issue #8854

* Possible fix for issue of incorrect warning for portal re-render

**what is the change?:**
Add a property to a container which was rendered into using
`ReactDOM.unstable_createPortal`.

**why make this change?:**
We don't want to warn for mismatching container nodes in this case - the
user intentionally rendered into the portal container instead of the
original container.

concerns;
- will this affect React Native badly?
- will this add bloat to the portal code? seems small enough but not
  sure.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Fix logic for checking if the host instance container is a portal

**what is the change?:**
When focusing on fixing the warning to not check when we are using
portals, I missed checking for the existence of the host instance parent
before checking if it was a portal. This adds the missing null checks.

**why make this change?:**
To fix a bug that the previous commit introduced.

**test plan:**
`yarn test`
-> follow-up commits fix more of the test failures

**issue:**
https://github.com/facebook/react/issues/8854

* Clean up new tests in ReactDOMFiber-test

**what is the change?:**
- removed extra single quotes, downgrade double quotes to single
- update expected warning message to match latest warning message
- fix indentation

**why make this change?:**
- get tests passing
- code maintainability/readability

**test plan:**
`yarn test`
follow up commits will fix the remaining tests

**issue:**
https://github.com/facebook/react/issues/8854

* Add 'unmountComponentAtNode' call in test for reconciling pre-rendered markup

**what is the change?:**
We have a test that verifies React can reconcile text from pre-rendered
mark-up. It tests React doing this for three strings and three empty
strings.

This adds a call to 'unmountComponentAtNode' between the two
expectations for strings and empty strings.

**why make this change?:**
We now warn when someone messes with the DOM inside of a node in such a
way that removes the React-rendered content. This test was doing that. I
can't think of a situation where this would happen with server-side
rendering without the need to call 'unmountComponentAtNode' before
inserting the server-side rendered content.

**test plan:**
`yarn test`

Only one more failing test, will fix that in the next commit.

**issue:**
https://github.com/facebook/react/issues/8854

* ran prettier

* remove unused variable

* run scripts/fiber/record-tests

* Fix type error and improve name of portal container flag

**NOTE:** I am still looking for a good place to move this flag
assignment to, or a better approach. This does some intermediate fixes.

**what is the change?:**
- fixed flow error by allowing optional flag on a DOMContainer that
  indicates it was used as a portal container.
- renamed the flag to something which makes more sense

**why make this change?:**
- get Flow passing
- make this change make more sense

We are still not sure about adding this flag; a follow-up diff may move
it or take a different approach.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Add flag to portalContainer on mount instead of in `createPortal`

**what is the change?:**
We add a flag to the container of a 'portal' in the 'commit work' phase
in Fiber. This is right before we call `appendChildToContainer`.

**why make this change?:**
- Sometimes people call `ReactDOM.render(... container)`, then manually
clear the content of the `container`, and then try to call another
`ReactDOM.render(... container)`.
- This leads to cryptic errors or silent failure because we hold a
  reference to the node that was rendered the first time, and expect it
  to still be inside the container.
- We added a warning for this issue in `renderSubtreeIntoContainer`, but
  when a component renders something returned by
  `ReactDOM.unstable_createPortal(<Component />, portalContainer);`,
  then the child is inside the `portalContainer` and not the `container,
  but that is valid and we want to skip warning in that case.

Inside `renderSubtreeIntoContainer` we don't have the info to determine
if a child was rendered into a `portalContainer` or a `container`, and
adding this flag lets us figure that out and skip the warning.

We originally added the flag in the call to
`ReactDOM.unstable_createPortal` but that seemed like a method that
should be "pure" and free of side-effects. This commit moves the
flag-adding to happen when we mount the portal component.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Force an 'any' type for the `hostInstance.parentNode` in warning check

**what is the change?:**
This is awful. :(
I'm not sure how else to let Flow know that we expect that this might be
a sort of `DOMContainer` type and not just a normal `Node` type.

To at least make the type information clear we added a comment.

**why make this change?:**
To get `flow` passing. Looks like we have `any` types sprinkled
throughout this file. phooey. :(

**test plan:**
`yarn flow`

**issue:**
https://github.com/facebook/react/issues/8854

* Ignore portals in `DOMRenderer.findHostInstance`

**what is the change?:**
We want to ignore portals when firing a certain warning.

This allows us to get the host instance and ignore portals.

Also added a new snapshot recording while fixing things.

**why make this change?:**
Originally we had added a flag to the DOM node which was used for

rendering the portal, and then could notice and ignore children rendered
into those nodes.

However, it's better to just ignore portals in
`DOMRenderer.findHostInstance` because
 - we will not ignore a non-portal second child with this approach
 - we meant to ignore portals in this method anyway (according to a
   'TODO' comment)
 - this change only affects the DOM renderer, instead of changing code
   which is shared with RN and other renderers
 - we avoid adding unneeded expandos

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Ran prettier

* Remove error snapshot test

I think there is a bug where an empty snapshot is treated as an 'outdated snapshot'.

If I delete the obsolute snapshot, and run ReactDOMFiber-test.js it generates a new snapshot.
But then when I run the test with the newly generated snapshot, it says "1 obsolete snapshot found",
At some point I will file an issue with Jest. For now going to skip the snapshot generation for the error message in the new test.

* Remove expando that we were adding to portal container

**what is the change?:**
see title

**why make this change?:**
this is part of an old approach to detecting portals, and we have
instead added a check in the `findHostInstance` method to filter out
portals.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854

* Fork `findHostInstance` to make `findHostInstanceWithNoPortals`

**what is the change?:**
We need to get host instances, but filter out portals. There is not
currently a method for that.

**why make this change?:**
Rather than change the existing `findHostInstance` method, which would
affect the behavior of the public `findDOMNode` method, we are forking.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/8854
2017-07-21 08:48:46 -07:00
Andrew Clark
ae430b7913 React.unstable_AsyncComponent (#10239)
Alternative to using the static class property unstable_asyncUpdates.
Everything inside <AsyncComponent /> has async updates by default. You
can also extend it like PureComponent or Component.
2017-07-20 18:00:53 -07:00
Sebastian Markbåge
9d248e0616 Remove record-tests step from contribution guides (#10223) 2017-07-20 14:16:35 -07:00
Dan Abramov
240b84ed8e Remove PooledClass from isomorphic build (#10227)
* Inline traverseAllChildren into ReactChildren

* Remove ForEachBookKeeping

* Inline traversal pooling logic into ReactChildren

* Reuse emptyFunction for dummy callback

* Move code around

* Record sizes
2017-07-20 15:56:49 +01:00
Dan Abramov
9cf888f661 Delete flattenChildren (#10224)
* Delete flattenChildren

* Stop exporting mapIntoWithKeyPrefixInternal

* Remove unescapeInDev()

flattenChildren() was the only traverseAllChildren() caller that relied on it.
2017-07-20 01:25:53 +01:00
Sebastian Markbåge
7b9f64307d Fix lint (#10222) 2017-07-19 11:12:47 -07:00
Sebastian Markbåge
1b4776f319 In SSR, Store Elements of Composites on the Stack for Warnings (#10187)
In DEV mode this keeps an additional sub-stack within the stack of the
server renderer. This substack keeps track of all the elements that we
resolved to get to to the next processing frame.

This lets us recreate the full composite component stack for warnings.
Normally the stack only contains host components.

We reset this every time we're going to resolve another sibling.
2017-07-19 10:36:57 -07:00
Sebastian Markbåge
9011182c55 Configure Jest with Stack and Fiber as separate projects (#10214)
* Disable Fiber specific test run in CI

This disables the comparison against previously recorded test. Instead,
we'll rely on jest failures to fail tests.

* Extract jest config into two separate projects for Fiber and Stack

Allows us to run both in the same jest run. The setupMocks file is forked into
specific environment configuration for each project. This replaces the
environment variable.

I used copy pasta here to make it clear. We can abstract this later. It's clear
to me that simply extracting shared stuff is not the best way to abstract this.
setupMocks for example didn't need all the code in both branches.

I think that some of the stuff that is shared such as error message extracting
etc. should probably be lifted out into a stand-alone jest project instead of
being shared.

* Fix class equivalence test

There's a behavior change when projects are used which makes
setupTestFrameworkScriptFile not override the normal config.

This test should probably just move to a separate CI script or something
less hacky.

* Only run Fiber tests with scripts/fiber/record-tests
2017-07-19 10:35:45 -07:00
Jason Quense
acd9818b90 Move input valueTracker to DOM nodes (#10208)
* Move input valueTracker to DOM nodes

This moves the storage of the input value tracker to the DOM node
instead of the wrapperState. This makes it easier to support both Stack
and Fiber without out a lot of ugly type casting and logic branches.

related: #10207

* run prettier

* remove instance accepting methods

* rm unused trst method

* address feedback

* fix naming

* fix lint
2017-07-19 12:10:13 -04:00
Dominic Gannaway
357925a84e Move DEV only module requires into __DEV__ blocks (#10185)
* modulesToStub cleaned up and DEV only modules put into __DEV__ blocks

* prettier run

* Prettier + new build run for bundle sizes
2017-07-19 17:28:55 +02:00
Dan Abramov
9254ce27a8 Split markup generation from DOM property management (#10197)
* Replace SSR unit test with integration test

* Remove unit test that is already covered by integration suite

* Replace unit tests for boolean attrs with integration tests

* Replace unit test for aria attrs with integration test

* Replace unit tests for numeric 0 with integration tests

* Remove unit test covered by integration tests

* Replace unit test for injection with integration test

It still touches internals but it tests both renderers.

* Fork DOMPropertyOperations into DOMMarkupOperations

* Trim down DOMPropertyOperations and DOMMarkupOperations

* Record SSR sizes

* Record them tests

* Fix false positive warning for overloaded booleans when passing numbers

* Remove stray import

* Replace CSS markup tests with public API tests

Some of these are handy as integration tests so I moved them there.
But some test markup specifically so I changed them to use DOMServer.

* Make CSSPropertyOperations client-only

I forked createMarkupForStyles() into ReactDOMComponent and ReactPartialRenderer. Duplication is fine because one of them will soon be gone (guess which one!)

The warnInvalidStyle helper is used by both server and client, unlike other client-only stuff in CSSPropertyOperations, so I moved it to a separately module used in both.

* Record server bundle size

* Add an early exit to validation

* Clarify what is being duplicated
2017-07-19 14:06:53 +01:00
Sebastian Markbåge
12d5c7a842 Upgrade jest to 20.1.0-delta.1 (#10211)
* Upgrade jest to 20.1.0-delta.1

This includes multi-project support.

* Use isSpy polyfill that is not available in jest 20

* Remove use of jasmine.createSpyObj

We don't really need this and it's not in jest 20.

* Upgrade record-tests script to use the new jest 20 APIs
2017-07-18 17:24:54 -07:00
Andrew Clark
71f591501b Fix scheduler control flow (#10015)
* Use performFailedUnitOfWork

instead of beginFailedWork and completeUnitOfWork separately. Also, we
unwind the context stack *before* beginning work again.

* Only use error loop directly after a commit

We have a special, forked version of work loop that checks if a fiber is
in a failed state (needs to be unmounted). This is only relevant right
after a commit -- begin phase errors are handled differently, by
unwinding the stack.

Also renamed findNextUnitOfWork to resetNextUnitOfWork and made it a
void function to signal that it's impure.

* Reset nextUnitOfWork after every commit

* Include the error boundary when unwinding a failed subtree

Also added a warning to the error boundary to show that it failed.

* Push context providers in beginFailedWork to avoid push/pop mismatch

Added a test that demonstrates how an error boundary that is also a
context provider could pop its context too many times if you neglect
to push it in beginFailedWork. This happens because we've already
popped the context once in unwindContext.

The solution is a code smell. I don't like how we push/pop context in
so many places. Shouldn't they all happen in the same location?

* Refactor work loop

- Optimizes the normal, non-error path by reducing the number of checks
needed to begin performing work.
- Prevents control flow from oscillating between fast normal loop and
slower error loop.

* Improve context unwinding test

Tests that we correctly unwind an error boundary that is also a
context provider.

* Triangle tester should assert the tree is consistent after every action

...not just at the end.

* Better implementation of infinite loop error

Infinite loops should only be possible if a while loop never terminates.
Now that we've refactored to avoid oscillation between different
work loops, we can count updates local to each loop.

The two loops that could infinite loop are the sync work loop and the
loop that surrounds the body of the render phase catch block. The
async loop could also fall into an infinite loop if the deadline never
terminates, but we'll assume that it always eventually does.

This change also creates better error stack traces because the error is
thrown from inside the first setState that exceeds the limit.

Added a test case for an error boundary whose parent remounts it
on recovery.

* Use invokeGuardedCallback in DEV
2017-07-18 16:31:49 -07:00
Dan Abramov
c2ed1b87dc Record sizes 2017-07-18 20:06:17 +01:00
Dan Abramov
9043ad6b9d Fix crash on master introduced during the radio bugfix (#10207)
* Add a regression test that passes in Stack but fails in Fiber

The failure happens because trackValueOnNode() can exit early if it detects an existing descriptor on node, or if it sees a "broken" Safari descriptor (which is how we encountered this bug in the wild).

As a result, the tracker field was not set, and subsequent updateValueIfChanged() call went into the branch that initializes the tracker lazily. That branch has a bug in Fiber mode where it passes the wrong type.

We did not see this issue before because that branch is relatively hard to hit (you have to either run it in Safari or define a custom DOM value descriptor which is what I did in the test).

In the future, we will likely remove the lazy branch altogether since if we bailed out of setting up the tracker once, we will likely bail out every time. But for now I'm just focused on a minimal fix to unbreak master.

* Fix updateValueIfChanged() lazy path to work with DOM argument

* Slightly reorder lines for clarity and record tests

* Also test the change event code path

This makes it go through the Fiber argument code path.
2017-07-18 16:31:04 +01:00
Brian Vaughn
197e184859 Replaced "unstable_handleError" with "componentDidCatch" (#10200)
Ran new codemod to rename all identifiers. Searched-and-replaced strings occurrences.
2017-07-17 14:38:37 -07:00
Sebastian Markbåge
3b5e3b5a23 Refactor Debug Frames to Enable Renderers to Provide Custom Logic (#10105)
* Extract the top element frame from ReactDebugCurrentFrame

This is part of a larger refactor to decouple stack addendums. All
renderers have their own way of getting the stack of the currently
executing components.

There is one special case in Element Validator that adds an additional line
for the element being validated. This commit moves that special case in
into the validator.

There is another case where it looked like this was used in shallow
renderer but this is actually something different. It is part of the
component stack. It just happens to be that shallow renderer has a simpler
implementation of the component stack that just happens to be a single
element.

This will let us decouple the implementation to get a stack from
ReactDebugCurrentFrame and put that in each renderer.

* Stop using ReactComponentTreeHook for Fiber

Currently we fall back to ReactCurrentOwner in ReactComponentTreeHook for
stack addendums. We shouldn't need to because we should use
ReactDebugCurrrentFiber.

Ensure we always set both ReactDebugCurrentFiber and ReactDebugCurrentFrame
so that we can rely on these for all stacks.

* Make ReactDebugCurrentFrame implementation independent

Introduced ReactDebugCurrentStack for the Stack renderer which does the
same thing as ReactDebugCurrentFiber.

ReactDebugCurrentFrame no longer keeps track of the current fiber/debug id.
That's handled by the individual renderers.

Instead, it is now used to keep track of the current *implementation* of
the current stack frame. That way it is decoupled from the specifics of
the renderers. There can be multiple renderers in a context. What matters
is which one is currently executing a debuggable context (such as a render
function).

* Add debug frames to ReactPartialRenderer (ssr)

Basic functionality.

* Add shared modules to shallow renderer

This is now needed because we share describeComponentFrame.
2017-07-14 15:36:24 -07:00
Andrew Clark
fb30d235db Remove didCommit from scheduler (#10182)
Don't actually need to track this, now that we removed the infinite
loop check to findNextUnitOfWork
2017-07-13 22:11:35 -07:00
Andrew Clark
b1a2ac89ca Uhhhh remove the extra space I literally just added (#10180)
0 spaces -> 2 spaces -> 1 space yay!
2017-07-13 16:19:40 -07:00
Andrew Clark
7c63d0178d Add missing space to key warning (#10179)
Found this when running the warnings script.
2017-07-13 16:14:45 -07:00
Andrew Clark
4dabdd2a30 Limit the number of nested synchronous updates (#10178)
* Limit the number of nested synchronous updates

In Stack, an infinite update loop would result in a stack overflow. This
gives the same behavior to Fiber.

Conceptually, I think this check belongs in findNextUnitOfWork, since
that is what we call right before starting a new stack. I've put it
in scheduleUpdate for now so I have access to the component that
triggered the nested update. But we could track that explicitly instead.

I've chosen 1000 as the limit rather arbitrarily. Most legit use cases
should really have a much smaller limit, but a smaller limit could break
existing code. For now I'm only concerned with preventing an infinite
loop. We could add a warning that fires at the smaller limit.

* Move check to findNextUnitOfWork

Including the name of the component in the message probably isn't
necessary. The JS stack will include either componentDidUpdate or
componentWillUpdate. And the component that's updating won't
necessarily be the component whose lifecycle triggered it.

So let's move the infinite loop check to findNextUnitWork as I
originally wanted to.
2017-07-13 15:56:02 -07:00
Jason Quense
999df3e777 Fix uncontrolled radios (#10156)
* Add fixture

* Fix Uncontrolled radio groups

* address feedback

* fix tests; prettier

* Update TestCase.js
2017-07-13 16:02:31 -04:00
Dan Abramov
2dcdc3c633 Simplify environment injections (#10175)
* Remove unnecessary injection guard

* Remove inject() indirection for global injections

It was necessary when they shared global state. But now these are flat bundles so we can inject as side effect.
This feels a bit less convoluted to me.

Ideally we can get rid of this somehow soon.
2017-07-13 20:44:52 +01:00
Dan Abramov
0070925a4f Don't use Stack-only helper in new SSR (#10174) 2017-07-13 19:55:48 +01:00
Dan Abramov
7dd7c1702b Remove dependency to event system on the server (#10173)
I do this by splitting ReactDOMInjection into generic and client-only injection.
2017-07-13 19:32:27 +01:00
Flarnie Marchan
309412d8b6 Improve error message thrown in Fiber with multiple copies of React (#10151)
* WIP Improve error message thrown in Fiber with multiple copies of React

**what is the change?:**
Adding an 'invariant' with detailed error message for the problem that
occurs when you load two copies of React with the Fiber reconciler.

WIP:
 - Is there any other likely cause for this error besides two copies of
   React?
 - How can we make the message more clear?

Still TODO:
 - Write a unit test
 - Write a documentation page and create the link to the page, similar
   to https://facebook.github.io/react/warnings/refs-must-have-owner.html

It would also be nice to have a page with instructions on how to fix
common cases of accidental double-loading of React, but we can open a
separate issue on that and let the community do it.

**why make this change?:**
This error comes up relatively often and we want to make things clear
when it happens in v16.0+

**test plan:**
WIP

**issue:**
Fixes #9962

* Add improved warning and docs for 'refs must have owner' in Fiber

**what is the change?:**
 - Added warning in the place where this error is thrown in Fiber, to
   get parity with older versions of React.
 - Updated docs to mention new error message as well as old one.

I started to write a new docs page for the new error, and realized the
content was the same as the old one. So then I just updated the existing
error page.

**why make this change?:**
We want to avoid confusion when this error is thrown from React v16.

**test plan:**
- manually inspected docs page
- manually tested in a CRA to trigger the error message

(Flarnie will insert screenshots)

**issue:**
Fixes #9962
Related to #8854

* Add test for the informative warning around multiple react copies

@gaearon debugged the test for this and now it works!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :)

**what is the change?:**
We now test for the warning that the previous commits add in Fiber, and
also test for the old warning in the stack reconciler.

**why make this change?:**
This is an especially important warning, and we want to know that it
will fire correctly.

**test plan:**
`yarn test src/renderers/__tests__/multiple-copies-of-react-test.js`
`REACT_DOM_JEST_USE_FIBER=1 yarn test src/renderers/__tests__/multiple-copies-of-react-test.js`

* Fix up test for 'multiple copies of react'

**what is the change?:**
refactor test for 'multiple copies of React' to be simpler and remove
some copypasta

* run prettier

* Fix conditionals in 'multiple copies of react' test

**what is the change?:**
When moving the 'fiber' and 'non-fiber' conditions from two assertions
into one, we copy pasted the wrong message into the 'fiber' condition.

This wasn't caught because we were using an outdated name for the
'fiber' constant when running the tests locally with fiber enabled.

This fixes the copy-paste error and we now are actually running the
tests with fiber enabled locally.

* Run scripts/fiber/record-tests
2017-07-13 10:41:32 -07:00
Brian Vaughn
5495e495de Remove conditional __DEV__ wrapper from RN bundles (#10171)
This causes an error with the older version of JSC packaged for Android.
2017-07-13 09:26:45 -07:00
Flarnie Marchan
3b43f3190b Reword duplicate key warning (#10148)
* Reword duplicate key warning

**what is the change?:**
 - Removes the now-inaccurate description of behavior around duplicate
   keys
 - Adds link to 'key' docs page
 - Changes tone to be more casual and friendly

Alternative wording idea;
'Encountered two children with the same key, ${key}
Child keys must be unique; using duplicate keys is not supported and
will cause unexpected behavior in some versions of React.
See https://fb.me/react-warning-keys for more information on how to
fix this.'

**why make this change?:**
Mainly this change was needed because in React 16, duplicate keys will
not cause omission of items with duplicate keys. All items will be
rendered. It could happen that in future versions of React we will have
different behavior though.

**test plan:**
`yarn test`

**issue:**
Wishlist item on https://github.com/facebook/react/issues/8854

* Further improve wording of duplicate key error

**what is the change?:**
Another tweak to the wording of this error to make it more clear and
accurate.

**why make this change?:**
The previous tweak was too casual in tone and still not clear enough.

**test plan:**
`yarn test` and `REACT_DOM_JEST_USE_FIBER=1 yarn run test`

**issue:**
Wishlist item on https://github.com/facebook/react/issues/8854

* Run prettier

* Fix typo in error message for duplicate keys

**what is the change?:**
Fixed a typo in the updated message

* Fix two more typo spots
2017-07-12 15:49:41 -07:00
Garrett McCullough
50d905b083 change the argument passed to CallbackQueue.getPooled (#10101)
* change the argument passed to CallbackQueue.getPooled

* remove undefined from function call

* add test for ReactNativeReconcileTransaction

* update log of tests

* change test to one that operates on setState

* added new tests and fixed another instance of the bug

* run prettier

* update names of tests and minor clean up

* remove arg from CallbackQueue and update tests
2017-07-12 18:49:13 +01:00
Michiya
5d5589b295 Update conferences.md (#10160) 2017-07-12 12:31:45 -05:00
Brandon Dail
d04618b28b Run all fixtures through Prettier (#10157)
* Include fixtures in prettier default pattern

* Run all fixtures through Prettier
2017-07-12 11:19:24 -05:00
Peter Ruibal
cff012fc16 Add react-dom-unstable-native-dependencies (#10138)
* Add react-dom-unstable-native-dependencies

react-native-web and react-primitives currently access a few internals
for shimming DOM events into native ones.  Changes in react@16 packaging
hide these internals completely.  This change adds a submodule to react-dom,
unstable-native-dependencies that includes the necessary modules to
continue enabling that method of dom-native event injection.

* Update ResponderEventPlugin to use "public" interfaces for test

In order to get some sort of smoke testing on
react-dom-unstable-native-dependencies, update ResponderEventPlugin-test
to use the "public" interfaces provided by react-dom and the new
react-dom/unstable-native dependencies

Also adds the missing references in package.json as well as missing
files required for unittests to do imports correctrly

Also exports injectComponentTree() which is required for the unittests
to re-set the shared component state between runs.

* Tweak bundle comment

* Bundle content updates from exporting injectComponentTree

* Added FB_DEV, FB_PROD to bundle types

* Run yarn prettier for -unstable-native-dependencies updates
2017-07-12 02:27:26 +01:00
Dan Abramov
2e2f503cb8 Tweak deprecation messages to be less scary (#10145) 2017-07-11 14:05:27 +01:00
walrusfruitcake
b79619e52a move augmentClass definition above SyntheticEvent Proxy replacement (#10011) 2017-07-11 11:37:11 +01:00
Brandon Dail
ab4ddf6493 Add columns to isUnitlessNumber list (#10115) 2017-07-11 11:28:57 +01:00
Eli White
8ca40630e6 Adding missing assertion to ReactDOMComponent-test (#10131) 2017-07-10 18:51:44 -06:00
Dheeraj Kumar
5ac6209599 Fix shallow renderer callbacks (#10106)
* Add failing test to show that shallow test renderer doesn't call setState's callback arg
* Record tests
* Fix shallow renderer's setState/replaceState/forceUpdate to execute any callbacks passed. (#10089)
* Ensure shallow renderer callbacks are called with the correct  binding.
2017-07-10 14:41:50 -07:00
Eli White
5bc25cb186 Fixing typo in ReactDOMComponent test name (#10132) 2017-07-09 19:34:39 -04:00
Martin V
242929bac1 Add Node v8.x support to devEngines in package.json (#10129) 2017-07-09 20:24:33 +01:00
Andrew Clark
ce7c01429c Don't increase priority when cloning current children (#10123)
This fixes a snapshot test regression introduced by #10008. I had
noticed this change and believe the new behavior was correct, but upon
further investigation I was wrong. This reverts the snapshot test and
fixes it accordingly.
2017-07-07 15:34:27 -07:00
Nick Kasten
8f4d30737d Updated Immutable Data Stuctures Docs (#9845)
* updated immutable data structures section

* improved immutable clarifications

* changes to example immutable code
2017-07-05 19:08:43 -05:00
Ilya Gelman
b22387d4fe Add ReactNext 2017 to conference list (#10114) 2017-07-05 18:44:04 -05:00
Andrew Rota
a39858f399 Add React Boston 2017 to upcoming conferences (#10099) 2017-07-03 21:07:09 -04:00
Guilherme Ruiz
83f56370e6 Fix the data-height of Step 5 CodePen embed (#10083) 2017-07-03 21:05:35 -04:00
Kiho · Cham
03db57aa71 doc: fix the order of lint and prettier (#10095) 2017-07-02 17:39:09 +01:00
Kiho · Cham
4880eb0fbc doc: switch the order of lint and prettier (#10094)
Ref #9876

Thanks to @wdhorton bring it up.
2017-07-02 13:24:45 +01:00
Andrew Clark
f9af9aacd3 Down-prioritize children of hidden host components
To make sure we don't reset the priority of a down-prioritized fiber,
we compare the priority we're currently rendering at to the fiber's
work priority. If the work priority is lower, then we know not to reset
the work priority.
2017-06-30 18:39:04 -07:00
Andrew Clark
de08c2af15 Ignore incremental tests that assert on work reuse
it -> xit

The diff looks messier than it actually is because of Prettier.
2017-06-30 18:39:04 -07:00
Andrew Clark
5a32e89b3d Failed error boundaries are a special case of resuming work
When an error in thrown in the begin phase, we begin work on the
error boundary a second time to unmount the children. This is a special
case of "resuming" work that we need to account for. The children are
set to the current children so that we can delete them.
2017-06-30 18:39:04 -07:00
Andrew Clark
ccbb92f9ef Enable the fuzz tester
Now that we've removed the buggy implementation of resuming work, the
fuzz tester passes consistently.
2017-06-30 18:39:04 -07:00
Andrew Clark
264a921054 Clear pending props when cloning from current
When we create a new work-in-progress, the existing pending props are
no longer valid.
2017-06-30 18:39:04 -07:00
Andrew Clark
a0af1e1317 Remove ability to resume work
The current implementation of resuming work is buggy. The underlying
model is also flawed. Rather than attempt to fix a flawed model, we'll
scrap the feature entirely and add it back later.
2017-06-30 18:39:04 -07:00
Andrew Clark
9749a6ea6a Update fuzz tester to not use animation priority
Neglected to fix this earlier because these tests were ignored.
2017-06-30 18:39:04 -07:00
Sebastian Markbåge
e6f1d29f07 Warn for inline style mismatches (#10084)
I use the technique of generating a style string and comparing that against the
attribute.
2017-06-30 18:24:04 -07:00
Almero Steyn
79868a978d docs(a11y): Small fixes (#10079) 2017-06-30 07:39:46 -04:00
Sebastian Markbåge
8d61138186 Warn When The HTML Mismatches in DEV (#10026)
* Warn for text content

* Warn for different attributes/properties values

Warns if there are unknown extra attributes in the hydrated node.

It also tries to compare the existing property or attribute against the
expected value. It does this by reading the property and comparing it to
the prop. Except it's not that simple because multiple prop values can
yield the same output. For this we pass an extra expected value that is
a hint as to which one was used. This is a bit weird but I'm not sure the
alternatives were much better.

* Warn when there is an insertion or deletion during hydration

This warns if there is ever an insertion or deletion due to hydration
failing to find a match.

Currently we can't warn for insertions required into the root because
that's how we do all non-hydrating renders atm. Left a todo.

This strategy is a bit unfortunate that it leads to so much plumbing code.
And we have to add three extra methods to the HostConfig that are only used
in DEV and not for anything else. I don't really have a better idea.

* Don't try to delete children of a textarea

Textareas are special cases. The initial mount inserts children
as the default value, but we should leave that untouched. This is the same
as the special case where we set text content of children so I'll use that
mechanism.

* Change expected format for text differences

In Stack this is presented as HTML which needs to have normalized escaping
rules. In Fiber it is currently not presented as HTML but a raw string
so we don't escape it.

* Unmount component in between tests

In Fiber, the second warning isn't issued because it's considered an update
not a new initial render and we don't fire the warning for those.

* Change expectation of white space text behavior in Fiber

In Fiber we don't expect empty strings to be different from rendering null.
In fact, in a follow up I plan on formalizing this by never creating text
Fibers for empty strings.

* Warn for different dangerouslySetInnerHTML

We can't just compare the raw innerHTML value because it will have been
normalized. Instead, we'll create another element, set its innerHTML and
read it back.

Since there can be custom elements registered with this document, we want
to avoid any side-effects they might cause. So I do this in a fresh new
document.

I'm not sure how this would affect controlled components and other stuff
that could have changed after runtime. I think for those cases maybe we
just need a general way of opting out of the diff.
2017-06-29 19:47:44 -07:00
Nathan Hunzaker
9d13557244 Add test to ensure extra zeros are covered by tests (#10033)
* Add test to ensure extra zeros are covered by tests

* Add DOM test fixture for trailing zeros

* Drop quotes to improve clarity
2017-06-29 12:44:05 -05:00
Henry Harris
dccc3850dc Tiny changes to tutorial (#10048)
* Initial commit

* PR feedback
2017-06-29 16:00:04 +01:00
Ben Alpert
21df484f25 Don't build ReactDOMNodeStream for FB (#10065)
require('stream') doesn't work for us right now.
2017-06-28 16:13:58 -07:00
Toru Kobayashi
85f3498fda Types Fiber as an exact object type (#10063) 2017-06-28 13:01:46 -05:00
Ben Alpert
864ae8fa98 Support comment node as a mount point (#9835)
This means you don't need an extra wrapper div for each component root you need. Rendered stuff is inserted before the comment you pass in.
2017-06-27 17:22:07 -07:00
Sebastian Markbåge
52a2365f19 Fix mount and unmount warnings in Fiber (#10056)
* Warn if unmounting a non-container

* Warn if the 2nd+ child is a "root" element but not first

This triggers our non-reuse mode. This is covered by ReactMount already but
the test doesn't pass yet without also landing #10026.
2017-06-27 17:15:53 -07:00
Sasha Aickin
f8a3a3989a Removed ReactMarkupChecksum from renderToString (#10053)
* Removed ReactMarkupChecksum from renderToString

* Oops. I messed up the merge in the previous commit.
2017-06-27 14:20:45 -07:00
Sebastian Markbåge
e955008b9b Remove most comments from HTML generation output (#10029)
Simplifies markup generation by only inserting a simple comments between
consecutive text nodes.

I also skip past comments and other nodes while hydrating. This leaves them
in place instead of being removed by the hydration mechanism. This is more
efficient but will also be needed by hydration validator.

There's a special case for empty strings. We probably shouldn't have nodes
for those at all. For now I special case it by assuming there won't be one
so if we need one, we'll insert an empty text node.

I also dropped the ID from the react ID.
2017-06-27 10:43:27 -07:00
Sebastian Markbåge
3c5b515286 Update yarn.lock (#10046) 2017-06-27 10:41:54 -07:00
Jack Ford
7831440dc9 Fix Typo in ReactFiberTreeReflection (#10055) 2017-06-27 17:53:16 +01:00
Jack Ford
15d3f2852f Fix Typo in ReactDOMFiberEntry (#10054) 2017-06-27 17:53:10 +01:00
Sebastian Markbåge
90b7facd52 Don't use the render callback with promises (#10050)
This covers up errors that are thrown in Fiber, because callback gets
fired *and* an error is thrown. Created a follow up #10049 to reevaluate
these semantics.

# Conflicts:
#	scripts/fiber/tests-passing-except-dev.txt
#	scripts/fiber/tests-passing.txt
2017-06-27 08:24:31 -07:00
Brian Vaughn
cb32253d2f ReactNativeFiberErrorDialog mutates error message (#10045)
This ensures that custom properties that are required by Facebook's error tooling (eg 'framesToPop') don't get dropped.

I also improved the handling/messaging of thrown strings.
2017-06-26 12:34:29 -07:00
Almero Steyn
2675ce13b8 [Docs: A11y] Add accessibility docs (#9519)
* [Docs: A11y] Add accessibility docs

* Fix the link

* Replace link image

* Tweak style
2017-06-26 18:17:05 +01:00
Sasha Aickin
8e2b70c772 Add node-stream.js to react-dom's package.json files entry, enabling the file to be uploaded to npm. (#10044) 2017-06-26 17:17:15 +01:00
Sasha Aickin
167f54c949 Documentation: added info about streaming character encoding. (#10039) 2017-06-26 16:32:11 +01:00
Sasha Aickin
c01d3061bb Pin prettier to a specific version so that it produces the same output on dev machines and CI. (#10038) 2017-06-26 16:30:45 +01:00
Simen Bekkhus
b629b78350 Remove Travis badge from readme (#10041) 2017-06-26 11:22:21 +01:00
Sasha Aickin
411e04bd71 Add ReactDOMNodeStream, adding streaming rendering. (#10024)
* Add ReactDOMNodeStream, adding ability to stream generated HTML.

* Forgot to rename a documentation page.

* Tests are passing locally but failing on CI; attempt to fix that with this tweak.

* Adding some debugging info to try to track down CI problem.

* More debugging of CI. Yay for printf debugging.

* More printf debugging of CI to figure out what is going on with includes during tests.

* I made a truly stupid error with my printf debugging statements for CI. Fixing that.

* And another dumb copy and paste typo.

* The node-stream.js stub for tests wasn't being added because of .gitignore.

* Fix for code review coment https://github.com/facebook/react/pull/10024#discussion_r123606138 . Thanks to @razh for helping me out.

* Removing all the console.logs I put in to debug the build problems on the CI server.

* Fix for code review coment https://github.com/facebook/react/pull/10024#discussion_r123628227 . Thanks to @aweary for the suggestion.

* Response to code review comment https://github.com/facebook/react/pull/10024#discussion_r123649131 . Thanks, @gaearon.

* Responding to code comments https://github.com/facebook/react/pull/10024#pullrequestreview-46104491 , https://github.com/facebook/react/pull/10024#pullrequestreview-46104616 , and https://github.com/facebook/react/pull/10024#pullrequestreview-46104822 . Thanks to @sebmarkbage for the help.

* Attempt to tweak spacing to see if it makes the prettier build step happy.

* Found a prettier bug that wasn't being reported by npm run prettier for some reason.

* Fixed a small prettier issue
2017-06-24 22:31:42 -07:00
Sasha Aickin
55c5cc264b As pointed out by @gaearon in code review comment https://github.com/facebook/react/pull/10024#discussion_r123649131 , ReactDOMServer is an object, not a class. (#10027) 2017-06-23 16:07:25 +01:00
Sasha Aickin
a494741b21 Excluding src/node_modules from .gitignore. (#10028) 2017-06-23 08:05:09 -07:00
Dan Abramov
fa98ecba9f Remove Stack-only www shim code (#10019) 2017-06-22 02:38:02 +01:00
Dan Abramov
8e251c5416 Remove unused www shims (#10018)
* Remove unused www shims

* Delete ReactElement.js
2017-06-21 19:10:45 +01:00
Dan Abramov
df10073f7d Remove "unstable" warning from ReactDOM (#10017)
* Remove "unstable" warning from ReactDOM

* Remove assertion about the warning

* There's more!
2017-06-21 19:06:25 +01:00
Dan Abramov
e68e95284b Remove more isomorphic www shims (#10007) 2017-06-21 17:54:11 +01:00
Michael Ridgway
7b05946776 [#9627] Fix componentWillUnmount test case in isMounted tests (#9629)
* Fix componentWillUnmount test case in isMounted tests and add mixin tests

* Upgrade create-react-class to 15.6.0
2017-06-20 23:37:01 +01:00
Toru Kobayashi
e817e8c95a Fix to work fiber-debugger (#10000) 2017-06-19 21:30:00 +01:00
Andrew Clark
11d67115f3 Update flow to 0.48 (#10006) 2017-06-19 11:45:36 -07:00
Andrew Clark
443ab45835 Only check minPriorityLevel after a commit 2017-06-19 09:53:19 -07:00
Andrew Clark
dcc02dd0f1 Task work inside batched updates is always sync, even for initial mounts
Behavior now matches Stack. It's unfortunate that this prevents us
from unifying SynchronousPriority and TaskPriority.
2017-06-19 09:53:19 -07:00
Andrew Clark
812244b57a Remove Animation priority
There's no advantage to scheduling updates with animation priority
versus scheduling sync work inside requestAnimationCallback. So we can
remove all the animation-specific code. Now there's only one type of
callback.
2017-06-19 09:53:19 -07:00
Andrew Clark
6a0c56cffc ReactNoop.flush methods return an array of yielded values
Allows us to make assertions on the values that are yielded when
performing work. In our existing tests, we do this manually by pushing
into an array.

ReactNoop.flushThrough extends this concept. It accepts an array of
expected values and flushes until those values are yielded.
2017-06-19 09:53:19 -07:00
newvlad
390fda7260 Create higher-order-components.md (#9976) 2017-06-19 10:06:54 -04:00
tokikuch
00ba97a354 Use KeyboardEvent.char in the fallback logic if available (#9792)
When a user types an emoji via Touch keyboard in IE, React's fallback logic
creates the `BeforeInput` event based on the `keypress`.  However, the length
of an emoji character (e.g. `\uD83D\uDE0A`) is two, so the `which` property
does not represent an emoji correctly.

Because IE's KeyboardEvent has the `char` property holding an entire emoji,
we can use it directly instead of converting from the `which`.
2017-06-16 15:14:09 -07:00
Ben Alpert
5029c3d6bc Split out container methods in host config (#9983)
This makes it so you don't need to pattern-match manually to build a renderer where the container and instance types are not the same. Prerequisite to #9835.
2017-06-16 15:00:38 -07:00
Dominic Gannaway
54e8478a3d Move out more ReactDOM FB shims (#9987)
* move out further ReactDOM shims from FB

* fixed a typo
2017-06-16 15:41:47 +02:00
Dominic Gannaway
52e13922b5 removes Synthetic event forwarding module shims (#9945) 2017-06-15 17:07:34 +01:00
Dan Abramov
ca83e3d321 Changelog for 15.6.1 (#9977) 2017-06-15 15:09:13 +01:00
Dan Abramov
310a6c4fc1 Wrap all non-UMD DEV bundles into a condition (#9969)
* Wrap all non-UMD DEV bundles into a condition

* Update header.js

* Create header.js
2017-06-15 00:53:22 +01:00
Bogdan Chadkin
29eb21dd04 Prevents adding units to css custom properties (#9966)
* Prevents adding units to css custom properties

* Fix code style

* Optimize custom property checking

* Prevents adding units to css custom properties in markup creation

* Update passing tests

* Fix argument name and reuse check in DEV
2017-06-14 23:15:09 +01:00
Dan Abramov
7dc27d35c1 Streamline Fiber/Stack testing and bundling setup a little bit (#9964)
* Remove internal forwarding modules for /lib/

* Add *Entry suffix to all entry points

* Don't bundle ReactNativeFeatureFlags since it's shimmed

* Delete TestRendererStack

* Switch tests at forwarding modules rather than via Jest

* Share mocks between regular and equivalence fixtures

* Rename environment flag to be more generic

* Remove accidental variable name change

* Minor naming changes for consistency

Files that have two versions get the engine in variable name.
2017-06-14 22:10:33 +01:00
Andrew Clark
462f4debfe Fuzz tester that simulates Sierpinski Triangle demo (#9952)
* Add ReactNoop.yield, ReactNoop.flushAndYield, ReactNoop.flushUnitsOfWork

Incremental tests often rely on yielding at a specific point. Using an
explicit API should make our tests more resilient to changes
in implementation.

* Fuzz tester that simulates Sierpinski Triangle demo

The tests only assert that the output of the tree is consistent after
each action, and that the final result after all work has flushed is
the expected value. It does not assert how work is reused, which means
it can't detect starvation issues. However, this also means that it
is fairly resilient to changes in our incremental algorithm.
2017-06-14 10:54:18 -07:00
Dan Abramov
14c0fd562d Add addon changes to 15.6.0 changelog (#9958)
* Add addon changes to 15.6.0 changelog

* Oops

* Add to blogpost
2017-06-14 13:57:00 +01:00
Dan Abramov
e2cf6f61c2 Add future changelog for 15.6.0 addon release (#9953) 2017-06-14 13:52:25 +01:00
Dan Abramov
d1445d42ed Reword animation documentation deprecation (#9957) 2017-06-14 13:04:04 +01:00
Dan Abramov
4f19558c6b Use public API in tests wherever possible (#9954)
* Use public API in tests wherever possible

* Add missing src/node_modules files
2017-06-14 00:58:35 +01:00
Flarnie Marchan
ce6108dac3 Blog post for 15.6.0 (#9950)
* Blog post for 15.6.0

**what is the change?:**
A short and sweet summary of 15.6.0 changes

**why make this change?:**
To thank community contributors and call out important changes.

**test plan:**
Visual inspection.
I also looked it over in a markdown viewer - http://dillinger.io/

**issue:**
https://github.com/facebook/react/issues/9398

* Add 'Installation' and 'Changelog' to 15.6.0 blog post

**what is the change?:**
Added the 'Installation' section we have on most release blog posts,
customized for the 15.6.0 version of React.
Added the 'Changelog' from master to the blog post.

**why make this change?:**
To show folks how to install React and what changes are in this release.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398

* Improvements to blog post, and add self to `authors.yml`

**what is the change?:**
- Add self to contributors so my name turns into a link
- Use backticks for code-ish things
- Second header to ##, not #
- Change production mode link to the new address per @bvaughn's comment
- Update changelog with fixes from https://github.com/facebook/react/pull/9951

**why make this change?:**
Make things more clear and accurate.

**test plan:**
Visual inspect - @flarnie will paste an image of how it appears in the
actual docs.

**issue:**
https://github.com/facebook/react/issues/9398

* Further improvements to 15.6 blog post

**what is the change?:**
- Reword heading about deprecation warning changes
- add 'br' s to the list of installation options
- add some stray missing backticks

**why make this change?:**
Clarity and readability

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-13 15:51:45 -07:00
Dan Abramov
00340f436b Minor fixes to 15.6.0 changelog (#9951)
* Minor fixes to 15.6.0 changelog

* Remove remaining double space

* Backticks
2017-06-13 13:25:08 -07:00
Flarnie Marchan
ac2f142729 Update changelog for 15.6 (#9949) 2017-06-13 10:53:57 -07:00
Nathan Hunzaker
d7157651f7 Add controlList to DOM property whitelist (#9940)
See:

- https://github.com/WICG/controls-list/blob/gh-pages/explainer.md
- https://developers.google.com/web/updates/2017/03/chrome-58-media-updates#controlslist
2017-06-12 21:09:33 -04:00
Taehwan, No
35ae38db2f Remove addons path deleted in #9209 (#9921) 2017-06-11 20:23:40 +01:00
Dan Abramov
7cd6fd2bc1 Don't build ReactDOMServerStack (#9916) 2017-06-10 18:08:05 +01:00
Jack Ford
a0534fb5c9 Initial commit (#9917) 2017-06-10 15:51:13 +01:00
Brian Vaughn
4aea7c3fad RN Inspector guard against clicks outside of RN (#9911) 2017-06-09 16:10:40 -07:00
Dan Abramov
107d6228db Fix doc styling and formatting issues 2017-06-10 00:04:50 +01:00
Danilo Vitoriano
a8d5b2b329 Move Past Confs, add React Conf Brazil 2017 (#9697)
* move past confs, add React Conf Brazil 2017

* move react europe to past confs

* resolve react europe conflicts

* Create conferences.md
2017-06-09 22:55:18 +01:00
Mario Souto
2b3a7df8d8 Remove extra brace (#9910) 2017-06-09 14:48:59 -07:00
Dan Abramov
2d9d4f6349 Return empty static markup for null components (#9907) 2017-06-09 16:32:00 +01:00
Dominic Gannaway
d13f07925f Add support for implicitly mocked components using ReactServerRenderer (#9906)
* adds the fix (from stack) and adds a test

* updated name of test and ran fiber script
2017-06-09 16:27:00 +01:00
Dan Abramov
47731c9f74 16.0.0-alpha.13 2017-06-09 15:00:01 +01:00
Dominic Gannaway
eadc2b1b7f remove alder32.js (#9905) 2017-06-09 15:19:16 +02:00
Dan Abramov
5c6a496d98 Inline some internals, reduce shared/ utilities between isomorphic and renderers (#9903)
* Make ReactControlledValuePropTypes DEV-only

* Remove canDefineProperty

This breaks IE8. We don't support it.

* Remove getNextDebugID

It was added temporarily to avoid Stack shared state issues across renderers.
Not a problem anymore.

* Make KeyEscapeUtils.unescape() DEV-only

* Remove unused deprecated() module

It's unlikely we'll deprecate anything else on React.* object soon.

* Inline getIteratorFn at the call sites

* Inline ReactElementSymbol

* Inline KeyEscapeUtils into Children and move the file into Stack

It's only used in one place in isomorphic.
It's used more broadly in Stack so we move it there to die.

* Update artifacts

* Reorder declarations for consistency

* Fix Flow
2017-06-09 12:41:50 +01:00
Nathan Hunzaker
cd7ee0f770 Revert "Add React Riot hackathon (#9861)"
This reverts commit 3daabf1efe.
2017-06-08 21:43:37 -04:00
pingan1927
8ab56e5c8b [#9712] fix <input type="number" /> value '.98' should not be equal to '0.98'. (#9714)
* [#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
2017-06-08 21:27:17 -04:00
Sakina Crocker
3daabf1efe Add React Riot hackathon (#9861)
React Riot is the first online worldwide hackathon for React! No cost to enter and teams can win some cool prizes. It's a community event to build the best React app in 48 hours.
2017-06-08 21:18:49 -04:00
Victoria Quirante
b8f32d7a3a Adding React Alicante 2017 to upcoming conferences (#9897) 2017-06-08 21:14:20 -04:00
Dan Abramov
9ff53dd0f4 Rebuild sizes 2017-06-09 00:47:49 +01:00
Dan Abramov
a37012a6b5 Add Bailout effectTag for React DevTools (#9887)
* Add Bailout effectTag for React DevTools

* Instead of tracking bailout, track performed work
2017-06-08 21:23:34 +01:00
Dan Abramov
6ab0531d68 Exclude Stack from DOMServerStream (#9896) 2017-06-08 19:41:02 +01:00
Dan Abramov
6f1d2c940d Delete ReactARTStack (#9895) 2017-06-08 17:05:21 +01:00
Dan Abramov
80fffbe0de Fix a bug with memoizedState affecting React DevTools (#9886)
* Fix a bug with memoizedState affecting React DevTools

* Restructure to avoid duplication
2017-06-07 19:54:57 +01:00
Flarnie Marchan
045e5bce35 Add check for string and null 'rootElement' in ReactDOMFiber (#9869)
* Add check for string and null 'rootElement' in ReactDOMFiber

**what is the change?:**
Before we call 'rootElement.getAttribute' we check that the method is
defined.

**why make this change?:**
There is an internal use case I found where 'rootElement' is a string
and null at different points as the page is rendered.

It looks like this method was added as part of support for re-hydration
of server-side rendered content. I can't imagine we would want to reuse
content if the rootnode is a string or null. Not sure if we want an
earlier check that it's an element before this point.

**test plan:**
`yarn test`
and I manually tested this fix in the internal case where it was
breaking

* Add test and improve check for non-element rootElement

**what is the change?:**
We use the nodeType to check that we have the correct type of
rootElement, and we added a unit test.

**why make this change?:**
Improve this solution to the problem.

**test plan:**
`yarn test`

* run ./scripts/fiber/record-tests
2017-06-07 07:51:05 -07:00
Dan Abramov
34927ea04f Remove useCreateElement flag (#9873)
* Remove useCreateElement flag

* Use Circle node #3 for ESLint
2017-06-07 13:22:26 +01:00
Dan Abramov
fc15d702b8 Delete .travis.yml (#9874) 2017-06-06 23:42:37 +01:00
Dan Abramov
b840229286 Remove prepareNewChildrenBeforeUnmountInStack flag (#9872) 2017-06-06 23:22:34 +01:00
Sebastian Markbåge
262b9c72f5 Don't hydrate any properties other than event listeners and text content (#9858)
* Don't hydrate any properties other than event listeners and text content

This strategy assumes that the rendered HTML is correct if the tree lines
up. Therefore we don't diff any attributes of the rendered HTML.

However, as a precaution I ensure that textContent *is* updated. This
ensures that if something goes wrong with keys lining up etc. at least
there is some feedback that the event handlers might not line up. With
what you expect. This might not be what you want e.g. for date formatting
where it can different between server and client.

It is expected that content will line up. To ensure that I will in a follow
up ensure that the warning is issued if it doesn't line up so that in
development this can be addressed.

The text content updates are now moved to the commit phase so if the tree
is asynchronously hydrated it doesn't start partially swapping out. I use
the regular update side-effect with payload if the content doesn't match up.

Since we no longer guarantee that attributes is correct I changed the
bad mark up SSR integration tests to only assert on the textContent
instead.

* Hydrate text node if possible

Currently we're never matching text nodes so we need to properly branch.
2017-06-06 15:19:38 -07:00
Brian Vaughn
7b16a46e0c Updated label in build-script (#9871)
Changed from "STARTING" to "BUILDING"
2017-06-06 14:54:35 -07:00
Dan Abramov
f50c4c9a43 Stop building ReactTestRendererStack (#9870)
* Stop building ReactTestRendererStack

We no longer use it.

* Remove now-unused sizes in JSON stats
2017-06-06 22:23:16 +01:00
Kurt Furbush
0966e77a2e Update reference-react-component.md (#9863)
Grammatical edit to match same statement in state-and-lifecycle.html
2017-06-06 09:59:44 -07:00
Garmash Nikolay
54ca9181ce Fix url to ng-animate (#9859) 2017-06-06 08:16:27 -07:00
Flarnie Marchan
30e6c6c9c9 Tweak syntax in rollup build script (#9852)
* Tweak syntax in rollup build script

@bvaughn and I already discussed this.

**test plan:**
`yarn build`

* Remove JSDoc comments

**what is the change?:**
removing some comments

**why make this change?:**
The code is basically self explanatory and these comments could get out
of sync.

**test plan:**
Visual inspection, `yarn build` and `yarn test`

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-06 07:26:47 -07:00
Flarnie Marchan
467dda6863 Add PR #9302 to 15.6RC CHANGELOG (#9857)
Just keeping things updated.

https://github.com/facebook/react/issues/9398
2017-06-06 07:26:24 -07:00
Ben Alpert
9d07ea7105 Remove reactComponentExpect (#9856)
Legacy.
2017-06-05 16:42:56 -07:00
Dan Abramov
1710e6c231 Fix CI (#9854) 2017-06-05 22:44:52 +01:00
Sebastian Markbåge
195aa65198 Disable tests of recovering from node.normalize() (#9853)
According to #9836 we're intentionally chosing to not support this until
we have better proof of this being a big need. E.g. to protect against
extensions. In a way that it's not better to push extensions to be fixed.
2017-06-05 16:46:26 -04:00
Arthur Gunn
5aa31534cd Avoid adding trailing semicolons to inline styles. (#9550)
* Avoid adding trailing semicolons to inline styles.

* Prettify.

* For sake of performance, avoid messing around with arrays.

* Change approach to avoid calling .substring.
2017-06-05 10:17:41 -05:00
Fernando Montoya
bc23cc31de Update webpack according to brand guidelines (#9595)
* Update webpack according to brand guidelines

* Change all ocurrences to webpack
2017-06-05 10:01:43 -05:00
Lipis
f4c9ad5791 Remove commented out code (#9795) 2017-06-05 09:59:18 -05:00
Ricardo
9d8519fc0d Insert blockquote on prop value explanation. (#9770)
While reading the page, the "chain of thought" is broken by stating that the `tempertature` and `onTemperatureChange` don't have any special meaning. Making this a blockquote makes that note look more like a comment and keep the "chain of thought" intact.
2017-06-05 09:51:59 -05:00
cjshawMIT
550b0220ca Clarifying how to apply aria-* attributes (#9843)
Provide explicit example of what "keep lowercase" means for `aria-*` attributes.
2017-06-05 09:48:21 -05:00
António Nuno Monteiro
d2824165ae changed -> changes in Changelog (#9833) 2017-06-05 09:37:01 -05:00
Edvin Erikson
b9ddd206f9 Fiber SSR tests (#9846) 2017-06-04 15:44:24 -07:00
Dan Abramov
28e89cfa2d Don't expose internal instance to React Native Inspector (#9840) 2017-06-02 19:34:26 +01:00
Brian Vaughn
a5d659d07e shouldSetTextContent accepts type parameter in addition to props (#9841) 2017-06-02 10:40:29 -07:00
Brian Vaughn
8b6b2f26c4 Add NPM 5 to devEngines (#9838) 2017-06-02 08:03:28 -07:00
Brian Vaughn
5f5cfe80f2 Removed unnecessary RN fiber "topsecret-" prefix (#9837)
* Removed RN fiber 'topsecret-' prefix
* Added a test to ensure that duplicate view-names can't be registered with createReactNativeComponentClass
2017-06-02 07:57:28 -07:00
Dustan Kasten
5f99a48229 Update to Flow 0.47 (#9815)
* bump flow to 0.47

* Fix variadic function flow issues in fiber

* Fix variadic function flow issues in ReactFiberNative

* fix ReactDOM type issues with flow 0.47

* getChildHostContext *does* take an `instance` argument

* change recently added anys to mixedies

* HydrationContext needs a handle on the rootContainerInstance

* prettier
2017-06-01 12:17:21 -07:00
Sebastian Markbåge
9dcc60af33 Delete logTopLevelRenders flag and console timing (#9825)
This was mostly used for timing of initial mounts. However, we haven't
implemented that in Fiber and yet nobody has complained despite running
without it. Further more the update tracks any update within the tree,
not just updates to the props of the top level. This is much less useful
due to the variation.

I could make this track initial mounts too but it's a bit awkward so I'd
rather just delete it if possible. We can run the full profiling mode if
we want more coverage.
2017-06-01 13:00:45 -04:00
Flarnie Marchan
f3dd489f36 Update CHANGELOG for unreleased 15.6 branch (#9827)
* Update CHANGELOG for unreleased 15.6 branch

**what is the change?:**
Added entries for the latest changes.

**why make this change?:**
We are about to do an RC release and folks can look at these notes to
see what is in the planned release.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398

* Update changelog regarding `createClass` dep. warning

**what is the change?:**
We decided to strike through the previous changelog item and add it to
the more recent changelog section, since this is the release where the
deprecation warning will actually go out.

**why make this change?:**
To make things clear for everyone using 15.6

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-01 09:23:28 -07:00
Nathan Hunzaker
e796d77004 Remove ensureScrollValueMonitoring (#9819)
I never actually removed the rest of this when I got rid of
ViewportMetrics. We no longer need `ReactDOMEventListener.monitorScrollValue`.
2017-06-01 07:18:51 -04:00
Timothy Yung
3f75ea8cdc Create ReactNativeComponent Abstract Class (#9814)
This creates `ReactNativeComponent`, the modern replacement for `NativeMethodsMixin`.

This class is going to allow us to start migrating React Native off `React.createClass(...)` into a typesafe, class-based brave new world.

This also introduces `IReactNativeComponent`, an interface that enforces consistency between `ReactNativeComponent` and `ReactNativeFiberHostComponent`.
2017-05-30 21:55:24 -07:00
Lipis
b88c42d970 Rename Javascript to JavaScript (#9796) 2017-05-30 21:35:22 -05:00
Brian Vaughn
8ca82e1df6 Fixed arity issues in advance of Flow strict checking being enabled (#9816) 2017-05-30 13:50:11 -07:00
Nathan Hunzaker
74044e0eba Inputs should not mutate value on type conversion (#9806)
This is a follow-up on
https://github.com/facebook/react/pull/9584#discussion_r115642293. There
is no need to assign the value property of an input if the value
property of the React component changes types, but stringifies to the
same value. For example:

```javascript
DOM.render(<input value="true" />, el)
DOM.render(<input value={true} />, el)
```

In this case, the assignment to `input.value` will always be
cast to the string "true". There is no need to perform this
assignment. Particularly when we already cast the value to a string
later:

```javascript
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
```
2017-05-30 15:25:44 -05:00
Dustan Kasten
80bdebc1f9 Fix ReactFiberReconciler annotation to include PI (#8751)
* Fix ReactFiberReconciler annotation to include `PI`

https://github.com/facebook/react/pull/8628#issuecomment-271970297

* Make getPublicInstance type safe

* attempting to trigger the issue @sebmarkbage described

https://github.com/facebook/react/pull/8751#discussion_r95669118

* Unify renderer-specific getPublicInstance with getRootInstance

* Switch on fiber type HostComponent for getPublicRootInstance

* Fix test that was too dynamic (and failing)

* Use PI in reconciler public API

* Prettier
2017-05-30 20:15:48 +01:00
Dan Abramov
af3ba36c7f Add bench remote repo to eslintignore 2017-05-30 16:43:03 +01:00
Dan Abramov
2b44565fca Don't build some stack bundles (#9812)
* Don't build ReactDOMStack and ReactARTStack bundles

* Regenerate results.json
2017-05-30 15:49:32 +01:00
Dan Abramov
fedb2ff8ec Remove createClass, PropTypes, DOM factories, and createMixin from React object (#9788) 2017-05-30 15:35:30 +01:00
Dominic Gannaway
319ba0bba9 adds getName() to base component, to be used by RN inspector (#9811) 2017-05-30 15:27:41 +02:00
Lipis
07d229b28e Rename Github to GitHub (#9797) 2017-05-29 07:36:14 -04:00
Ben Alpert
ba7ba84ec3 Ignore events on not-yet-mounted fibers (#9742)
This isn't necessarily what we want long-term especially with more async, but currently we crash in jsdom in some cases when an img load event gets dispatched synchronously. (Needed for FB-internal D5060180.)
2017-05-26 16:46:46 -07:00
Erik Hellman
d30bc9807e Add Videos link to React Europe 2017 (#9751) 2017-05-27 00:06:28 +02:00
Flarnie Marchan
4ef8865120 Fix externalization of 'lowPriorityWarning' in fb builds (#9790)
**what is the change?:**
 - Add two more special cases for 'lowPriorityWarning' in 'modules.js',
   treating it the same as 'ReactCurrentOwner'.

**why make this change?:**
Without this, the build was including 'lowPriorityWarning' seemingly both as an external module and as part of the bundle.

**test plan:**
Ran `yarn build` and inspected the `React-dev` build. `lowPriorityWarning` did not get bundled in this time.

**issue:**
None yet - @gaearon flagged this for me directly.
2017-05-26 10:35:39 -07:00
Flarnie Marchan
e6af1580fa Update print warning script for low priority warning (#9756)
* Add back caught error and other checks to 'lowPriorityWarning'

**what is the change?:**
This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from
e66ba20ad5/packages/fbjs/src/__forks__/warning.js
where before we had skipped some checks from that module.

- Adds an error which we catch, in order to let people find the error and resulting stack trace when using devtools with 'pause on caught errors' checked.
- Adds check that 'format' argument is passed

**why make this change?:**
- To maintain a closer fork to 'warning.js'
- To allow easier debugging using 'pause on caught errors'
- To validate inputs to 'lowPriorityWarning'

**test plan:**
`yarn test`

**issue:**

* Update 'print-warnings' script to include 'lowPriorityWarning' output

**what is the change?:**
We print the logs from 'lowPriorityWarning' as well as 'warning' from the 'print-warnings' script.

NOTE: This PR is branching off of https://github.com/facebook/react/pull/9754

**why make this change?:**
We want to use the same process of white/blacklisting warnings with 'lowPriorityWarning' that we do with 'warning'.

**test plan:**
This is not super easy to test unless we are doing a sync with FB afaik. I plan on running a sync in the next few days, or next week at latest, for the sake of not landing big things on a Friday. That will be the actual test of this.

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-26 07:47:49 -07:00
Flarnie Marchan
114b9c5500 Add 'Test Utils' docs back to main navigation (#9676)
* Add 'Test Utils' docs back to main navigation

**why make this change?:**
We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs.

**test plan:**
Manually tested the website - will insert a screenshot.

**issue:**
https://github.com/facebook/react/issues/9651

* Move test-utils docs to reference section

**what is the change?:**
Moved from 'advanced guides' to 'reference'

**why make this change?:**
It makes more sense as a reference

**test plan:**
Visual inspection (flarnie may add a screenshot)

**issue:**

* Add back the shallow renderer docs and remove outdated docs

**what is the change?:**
- Remove outdated 'shallow renderer' docs on 'test utils' page, and point to the updated 'shallow renderer' docs.
- Re-add a link to the updated 'shallow renderer' docs on the main navigation.

**why make this change?:**
This was already approved in https://github.com/facebook/react/pull/9331 which was then cherry-picked to https://github.com/facebook/react/pull/9359/commits and landed on master.

I'm not sure why some of these changes didn't persist. For now just adding back the changes we need.

**test plan:**
Manually inspected website - will insert screenshots.

**issue:**

* Further improvements to 'shallow rendering' and 'test utils' docs

Thanks @gaearon for the improvements!

**what is the change?:**
- Remove <hr/> from end of 'shallow rendering' docs
- 'documents' -> 'documentation'
- Move 'shallow rendering' redirection section to top of 'test utils' docs
- Add intro sentence about testing to 'shallow rendering' docs

**why make this change?:**
Documentation helps people learn.

**test plan:**
Visual inspection
2017-05-26 07:47:18 -07:00
Will Myers
546e7721ec Update blog post which creates unhandled promise rejection (#9668)
* Update 2015-12-16-ismounted-antipattern.md

In case anybody else stumbles across this old blog post, I wanted to submit a patch to help with unhandled rejections.  

`#then` and `#catch` each return new Promise instances, so here we actually create two new promises (that aren't assigned).  If the argument promise to `#makeCancelable` rejects, the promise created by `#then` will be an unhandled rejection, which in Node 7 will be an uncaught error.  

By using the second argument of `#then` to handle rejections instead, we don't need to worry about the runtime finding any unhandled rejections here.

* Style updates

* Add update notice
2017-05-26 14:35:19 +01:00
Dan Abramov
c632e58da6 Update numbers 2017-05-26 14:32:26 +01:00
Max Donchenko
43f2ea079c Fix typo (#9786) 2017-05-26 12:37:35 +01:00
Brian Vaughn
3630bf3559 Corrected a stubbed modules problem for RN fiber bundle (#9784) 2017-05-26 11:15:37 +01:00
Sebastian Markbåge
9c7a312d7c Hydration of previously rendered server markup (#9580)
* Don't double validate the DOM container

The warnings need to check a valid container but that should happen in
unstable_renderSubtreeIntoContainer too so might as well move it in.

* Hydrating DOM

Hydrates a server-rendered DOM tree by traversing it and connecting up the nodes if they match. Attributes are not diffed. They're assumed to be accurate on matching nodes.

* Remove meta data filtering from test

Because the current server renderer includes the meta data, it remains in a revived tree.

* Annotate because Flow

* Don't track insertion effects if we're going to hydrate

During initial mount, we should not track Placement

* Fix up test cases to ignore errors that we no longer throw

TODO make these warnings instead.

* Correctly track hydration state inside a newly inserted tree

When we don't match the first hydration node, we'll do an insertion.
Currently we keep the next hydratable sibling so that we know where to
pick up once we're done with the insertion. Unfortunately this makes the
nodes inside the insertion think that there's a node to hydrate.

I used to check for the direct parent but that doesn't work on nested host components.

We need to instead keep track of that we're in an hydration context but
we're not currently hydrating. Once we pop passed the inserted node can
we resume hydrating.

* Hacky fix to isMounted

isMounted checks whether a component is inside a Placement. During
hydration we ideally don't do any Placements if hydration matches the tree.

To work around this I use the Placement flag on the root, which isn't used
for anything else. But only temporarily while we're hydrating. Then reset
it before committing.

* Record tests

* Comments
2017-05-25 15:19:19 -04:00
Dan Abramov
63cd93af07 Fix Prettier 2017-05-25 19:34:14 +01:00
Dan Abramov
7494e0485d Don't strip error messages from builds (#9778) 2017-05-25 18:56:18 +01:00
Dominic Gannaway
492f7a8200 extractErrors -> extract-errors (#9777) 2017-05-25 19:49:58 +02:00
Brian Vaughn
824d22c9d9 Prevent fiber from leaking into RN stack renderer (#9775)
Since stripEnvVariables was used to replace __DEV__ references, I assumed it (and other plugins) we run before requires statements were processed. Obviously I was wrong 😬 and as a result, the RN Stack and Fiber builds were way too large. This is an attempt to mimic the approach taken with DOM renderer and stub out modules that we explicitly don't want to include.

The alternative to this would have been to fork findNodeHandle, NativeMethodsMixin, ReactNativeBaseComponent, etc. and essentially avoid using the feature flag. That didn't seem tenable. The previous injection approach also doesn't work here because the circular references it resulted in caused Rollup to choke when creating the modules.
2017-05-25 18:14:46 +01:00
Tom Occhino
7b5bdc14d8 Remove build time extractErrors message when error codes can't be found (#9555)
* Remove error message when error codes cannot be found

* Re-record fiber tests to fix CI
2017-05-25 17:07:55 +01:00
Brian Vaughn
108a395f4e Strip comments from UMD_PROD and NODE_PROD builds, not FB_PROD (#9776)
This regressed with the recent addition of RN_* bundles. I was accidentally stripping comments from FB_PROD when I meant to do the opposite. This corrects that mistake.

No significant bundle size change occurs when re-running this build against the version prior to the RN_* bundles.
2017-05-25 16:24:05 +01:00
Toru Kobayashi
cbef3fd412 Warn it only in DEV (#9772) 2017-05-25 07:31:35 -07:00
Danny Hurlburt
1f667fd37f Bind handleChange Instead of Calling (#9764) 2017-05-24 17:26:44 +01:00
Brian Vaughn
c22b94f14a ReactNative flat renderer bundles (#9626)
* Split ReactNativeFiber into separate ReactNativeFiberRenderer module
Hopefully this is sufficient to work around Rollup circular dependency problems. (To be seen in subsequent commits...)

* Split findNodeHandle into findNodeHandleFiber + findNodeHandleStack
This allowed me to remove the ReactNative -> findNodeHandle injections, which should in turn allow me to require a fully-functional findNodeHandle without going through ReactNative. This will hopefully allow ReactNativeBaseomponent to avoid a circular dependency.

* Un-forked findNodeHandle in favor of just inlining the findNode function impl

* takeSnapshot no longer requires/depends-on ReactNative for findNodeHandle
Instead it uses the new, renderer-specific wrappers (eg findNodeHandleFiberWrapper and findNodeHandleStackWrapper) to ensure the returned value is numeric (or null). This avoids a circular dependency that would trip up Rollup.

* NativeMethodsMixin requires findNodeHandler wrapper(s) directly rather than ReactNative
This works around a potential circular dependency that would break the Rollup build

* Add RN_* build targets to hash-finle-name check

* Strip @providesModule annotations from headers for RN_* builds

* Added process.env.REACT_NATIVE_USE_FIBER to ReactNativeFeatureFlags
This is kind of a hacky solution, but it is temporary. It works around the fact that ReactNativeFeatureFlag values need to be set at build time in order to avoid a mismatch between runtime flag values. DOM avoids the need to do this by using injection but Native is not able to use this same approach due to circular dependency issues.

* Moved a couple of SECRET exports to dev-only. Removed SyntheticEvent and PooledClass from SECRET exports. Converted Rollup helper function to use named params.

* Split NativeMethodsMixins interface and object-type

* Add @noflow header to flat-bundle template to avoid triggering Flow problems
When Flow tries to infer such a large file, it consumes massive amounts of CPU/RAM and can often lead to programs crashing. It is better for such large files to use .flow.js types instead.

* NativeMethodsMixin and ReactNativeFiberHostComponent now share the same Flow type

* Collocated (externally exposed) ReactTypes and ReactNativeTypes into single files to be synced to fbsource. ReactNativeFiber and ReactNativeStack use ReactNativeType Flow type

* Build script syncs RN types and PooledClass automatically

* Added optional sync-RN step to Rollup build script

* Added results.json for new RN bundles
2017-05-24 17:06:30 +01:00
Flarnie Marchan
6ac91d24c4 Improve low priority warning (#9754)
* Add back caught error and other checks to 'lowPriorityWarning'

**what is the change?:**
This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from
e66ba20ad5/packages/fbjs/src/__forks__/warning.js
where before we had skipped some checks from that module.

- Adds an error which we catch, in order to let people find the error and resulting stack trace when using devtools with 'pause on caught errors' checked.
- Adds check that 'format' argument is passed

**why make this change?:**
- To maintain a closer fork to 'warning.js'
- To allow easier debugging using 'pause on caught errors'
- To validate inputs to 'lowPriorityWarning'

**test plan:**
`yarn test`

**issue:**

* Update results.json

* Run prettier
2017-05-24 07:55:00 -07:00
Flarnie Marchan
e5f4327993 Add #8575 to changelog for 15.6 (#9740)
Just two more items before we will have an RC ready. :)
2017-05-23 15:43:38 -07:00
Dominic Gannaway
0ea4674d08 Adds a ReactNativeInspector API to ReactNativeRenderer (#9691)
* fixed conflicts with master

* splits fiber and stack implementations

* prettier run

* updated fiber implementation based on feedback

* updated fiber implementation for selecting inspector hierarchy

* run of prettier

* fixed flow issues

* updated stack implementation

* fixes an implementation difference where before it wasnt properly understoof

* addresses comments in PR feedback

* updated stack inspector to use emptyObject

* Update ReactNativeFiberInspector.js

Fixes a flow error

* fixes last flow error

* prettier

* applied changes to how viewConfig works for fibers and extracted measure out

* fixed bad paste

* fixes flow errors

* prettyify

* revmoed getComponentName changes

* updated logic for getHostProps and addressed other PR feedback

* improved throwing to invariant and update stack implemenation based on feedback

* prettier
2017-05-23 22:22:21 +02:00
Flarnie Marchan
964c263d8f Downgrade deprecation warnings from errors to warnings (#9650)
* Initial regeneration of results.json

**what is the change?:**
We ran `yarn build` and updated the perf. stats record.

**why make this change?:**
Some commits have landed without updating this. By getting an initial update, I can run the build script again after my changes and see any size regressions.

* Downgrade deprecation warnings from errors to warnings

**what is the change?:**
Swapping out `warning` module for a fork that uses `console.warn`.
It looks like we were using the `warning` module for deprecation notices, *but* there is also a 'deprecated' module designed specifically for deprecation notices.

However, we could not find any place that it was currently used.

Since React's build process is not 100% clear to me, I assume it could still be used somewhere by something and just updated it along with other deprecation notices.

We might consider a follow-up diff that does some clean up here;
 - remove 'deprecated' module if it's unused, OR
 - use 'deprecated' module for all our current deprecation warnings

**why make this change?:**
- We have had complaints about noisy warnings, in particular after introducing new deprecations
- They potentially cause CI failures
- Deprecations are not really time-sensitive, can ship without breaking your app, etc.

For more context - https://github.com/facebook/react/issues/9395

**test plan:**
`npm run test`
and unit tests for the new modules
and manual testing (WIP)

**issue:**
https://github.com/facebook/react/issues/9395

* Add 'lowPriorityWarning' to ReactExternals

**what is the change?:**
We won't bundle 'lowPriorityWarning' with the rest of React when building for Facebook.
NOTE: A parallel commit will introduce an internal implementation of 'lowPriorityWarning' in Facebook's codebase, to compensate. Will post a comment with the diff number once that is up.

**why make this change?:**
So that the sync between github and Facebook can go more smoothly!

**test plan:**
We will see when I run the sync! But this is a reasonable first step imo.

**issue:**
https://github.com/facebook/react/issues/9398

* Make state mutations an error, not low-pri warning

**what is the change?:**
Even though this is a "deprecation" warning, we still want to use 'console.error' for it.

**why make this change?:**
- It's not likely to come up now, hopefully, because this warning has been present for some time
- This will cause real issues in production if ignored

**test plan:**
`yarn test` - we did fix one test which failed bc of this change

**issue:**
https://github.com/facebook/react/issues/9398

* Fix test of assigning to this.state that was only passing in fiber

**what is the change?:**
updated a unit test for assigning directly to state; it once again raises an error and not a warning.

**why make this change?:**
So that tests pass

**test plan:**
 REACT_DOM_JEST_USE_FIBER=1 yarn run test

**issue:**

* Update results.json
2017-05-23 09:35:42 -07:00
Samuel Hapák
1f80931d32 Add ReactiveConf (#9723) 2017-05-22 16:12:52 +02:00
Erik Hellman
5b7e81579d Move ReactEurope 2017 from Upcoming Conferences to Past Conferences (#9726) 2017-05-22 13:52:46 +02:00
Hikaru Suido
3d6d641a8c Move previous events to the end (#9729) 2017-05-22 11:45:57 +02:00
Ben Alpert
f1abc3cd12 Expose ReactFiberTreeReflection in FB build (#9741)
I need this for some hacky stuff I'm doing (D5060180).
2017-05-21 16:37:17 -07:00
Ben Alpert
f0a0999c3b Add test for key warning at top level (#9473) 2017-05-21 15:39:25 -07:00
Dave Lunny
5cf571839e "Timeline" => "Performance" (#9602)
As of Chrome 58, the Timeline tab is now called the Performance tab, this updates the "Optimizing Performance > Profiling Components with Chrome Performance" section of the docs to reflect that.
2017-05-21 15:28:25 -04:00
Paul Manta
4b53dd0e6b Disable ESLint's no-extend-native for two lines (#9625) 2017-05-20 19:58:23 -04:00
Flarnie Marchan
91459086a9 Add PR #9642 to 15.6 change log (#9649)
Just keeping this fresh.

Issue:
2017-05-20 09:22:07 -07:00
Dan Abramov
bb89c11788 New blog post: What's New in Create React App (#9719) 2017-05-19 05:31:35 +01:00
Dylan Kirby
c1d4c8bc60 fix typo in benchmark docs (#9706) 2017-05-18 19:13:59 -04:00
Billy Shih
6ee701d18a Fix typo (#9717)
The example explaining how redux's connect works doesn't use the same component name. Line 264 references (Comment) while 274 referenced (CommentList). Changed 264 to match 274.
2017-05-18 19:06:29 -04:00
Sebastian Markbåge
39671ba45b Move some tests from failing to passing except dev (#9711)
These throw because we're asserting on the warnings. Make this not throw
so that they instead only fail to assert the warnings.
2017-05-17 23:54:26 -07:00
Sebastian Markbåge
e5e874d0e8 Add package builds for new server renderer and enable tests (#9710)
* Adjust some expectations of the server markup format of Fiber

Currently this case is using the stack renderer.

* Ensure debug hooks are injected into the Stack server renderer

In our tests this normally happens because ReactDOM.js injects them into
the shared module, but when Fiber is enabled or this is its own flat
bundle, that doesn't happen.

* Add package builds for new server renderer and enable tests

ReactServer -> ReactDOMServerStream

This file is going to be the replacement for ReactDOMServer.

I mock ReactDOMServer and user ReactDOMServerStream when we have
the fiber flag enabled. I'm now also enabling this as the default for
distributions builds (react-dom/server on npm and
react-dom-server.production.min.js as umd bundle).

I'm using traverseStackChildren instead of traverseAllChildren because
traverseAllChildren is now only in the isomorphic package and we don't
want to build all of that that into the server package.

I also have to require lower case react for the builds to work.
2017-05-17 17:19:11 -07:00
Tom Occhino
8af729231b Initial Stack-Free SSR Implementation (#9673)
* Server Rendering initial commit

Originally authored by spicyj, tweakes to rebase it and make it run by tomocchino.

Adding ReactDOMServerRendering and a createTagMarkup utility function which will be used in it.

* Fix build system, add shortcut scripts

* Make more ReactServerRendering-test unit tests pass

* Make ReactServerRendering-test pass with copious help from Ben

This is pretty hacky and I just inlined everything, but at least I sort of understand how it works now, and all of the tests are passing. There are also only 68 tests failing in the integration test suite.

* remove some unnecessary cruft

* Run prettier on ReactDOMServerRendering.js

* Fix more unit tests with Ben

* Add support for input and textarea by copy pasting a bunch of code from ReactDOMInput/ReactDOMTextarea

* Fix context unit tests with more copy paste :)

* progress on select

* Holy shit, 100% of ReactDOMServerIntegration tests are passing

* Checkpoint to fix some of the ReactDOMComponent-test tests

* Fix missing checkPropTypes

* Fix some unit tests in ReactDOMComponent-test

* Run prettier on everything, thanks Ben

* get rid of ssr tests that are looking for component file names

* add assertValidProps check

* rename flattenChildren to flattenOptionChildren per Ben

* Fix all the lint crap

* Move things around in the file and turn ReactDOMServerRenderer into a class

* remove changes I added to package.json

* remove separate createOpenTagMarkup file for now since everything should be copy pasted into a single file

* re-record Fiber tests

* Revert ReactDOMServer.js and the fiber tests per Sebastian

This also reverts the changes I made to ReactDOMComponent-test.js which removed the stack which is missing in the new server renderer"

* Rename files based on feedback

Moving src/renderers/dom/server/ReactDOMServerRendering.js to src/renderers/server/ReactServerRenderer.js and add src/renderers/server/ReactServer.js which makes this new codepath completely separate.

* Change throw to invariant, even though we probably need to remove this at some point

* fix prettier.. sigh
2017-05-17 14:53:59 -07:00
Nathan Hunzaker
7deb12fdde Remove invalid css from DOMFixtures (#9600) 2017-05-17 17:22:32 +02:00
Michal Srb
1c449cea34 Make the world a better place by placing closing /> on a new line (#9699) 2017-05-16 15:42:48 -07:00
Toru Kobayashi
17ab69c1ec [Fiber] Fix to call deferred callbackQueue even if updates are aborted (#9634)
* Fix to call deferred callbackQueue even if updates are aborted

* Add an assertion to make sure the update processed, but wasn't committed yet
2017-05-12 10:45:51 -07:00
Flarnie Marchan
0f129973ea Move 'lighthouse' and 'nodegit' to 'optionalDependencies' (#9675)
**what is the change?:**
See title.

**why make this change?:**
Both these dependencies were causing issues when working on React internally at
FB.

'lighthouse' requires node >=6 and we don't want to folks working on React to
using that version of node.
https://github.com/GoogleChrome/lighthouse/blob/master/package.json#L11

'nodegit' for me throws an error related to libssh2 and it's annoying to make
this work in every OS. See https://github.com/nodegit/nodegit/issues/1266

**test plan:**
`npm/yarn install`
Runs with no errors on my CentOS machine and also on MacOSX laptop.

**issue:**
This is blocking work related to https://github.com/facebook/react/issues/9398
2017-05-12 15:41:30 +01:00
Ben Alpert
f0df495f9a Run prettier on scripts/bench (#9671) 2017-05-11 16:14:17 -07:00
Ben Alpert
e736b4c4b9 "yarn prettier" only checks changed files (#9670)
CI still checks all of them.
2017-05-11 14:47:29 -07:00
Tom Occhino
fe750c9d5d Move assertValidProps into shared/utils since it will be used by the … (#9669)
* Move assertValidProps into shared/utils since it will be used by the server renderer

* Extract getCurrentOwnerName from assertValidProps and pass it in
2017-05-11 14:43:35 -07:00
Flarnie Marchan
bec0f736df Wrap fiber-only test in feature flag (#9665)
**what is the change?:**
A test was added for a change to Fiber's behavior in #9608, and because of a
bug in our CirclCI script it landed when failing for non-fiber runs of the
tests.

This just wraps the test in a feature flag because it seems clear it was
only intended to test the new fiber behavior.

Thanks to @gaearon for pairing on this! :)

**why make this change?:**
So that tests are passing on master.

**test plan:**
`npm run test ReactCompositeComponentState`

**issue:**
None - figured it out before anyone opened an issue afaik.
2017-05-11 13:32:04 +01:00
Dan Abramov
cc2450b7bf Always pass error code to CI (#9663) 2017-05-11 13:13:01 +01:00
shifengchen
d7e6ef0f88 Edit two errors in docs (#9659) 2017-05-11 11:34:35 +01:00
Tom Occhino
ffcbb0bfc2 Move small utility modules out of ReactDOM(Fiber)?Component (#9658)
* Move small utility modules out of ReactDOM(Fiber)?Component

These are all going to be needed in the server renderer, so I'm moving them out now so I can use them from in there.

* Fix `didWarnShadyDOM = false;` line
2017-05-10 22:01:48 -07:00
Philipp Spieß
b48107ed57 Remove injectReactDOMEventListener from ReactBrowserEventEmitter (#9656)
* Remove injectReactDOMEventListener from ReactBrowserEventEmitter

This PR removes the injection of ReactDOMEventListener from
ReactBrowserEventEmitter. Instead, the required initialization will
happen directly in ReactDOMInjection.

This injection was (probably) originally implemented for React Native
but never used, so we can clean it up.

* Mention how to see the full ouput of fiber tests
2017-05-10 17:05:38 -07:00
Carolina Powers
7c1e971e7f Fix typo on tutorial.md. (#9644)
The absence of the word `this` will cause CodePen
to scream at you. This fix should avoid that.
2017-05-10 08:23:53 +01:00
Dan Abramov
c1ba8ef264 Mention new fixes for addons in Changelog (#9643) 2017-05-10 01:03:34 +01:00
Philipp Spieß
c0e32a1b03 Rename ReactEventListener to ReactDOMEventListener (#9640)
`ReactEventListener` is a DOM-specific module although the name suggests
otherwise. This change renames the module to the more specific
`ReactDOMEventListener`.
2017-05-09 16:17:03 -07:00
Dan Abramov
831fd6940e Sync RN downstream fix (#9637) 2017-05-09 20:29:37 +01:00
Flarnie Marchan
7842ff97c2 Add PR #8356 to the change log for v15.6 (#9636)
Another change log update ~ v15.6 is closer than ever! :)

Issue:
2017-05-09 18:54:45 +01:00
Flarnie Marchan
e249c935ed Add PR #9584 to 15.6 change log (#9598)
Updating the change log~ :)

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-09 18:22:17 +01:00
Dominic Gannaway
a7d8ebd2b5 Add React benchmarking infrastructure (#9465)
* Initial commit for WIP benchmarking infrastructure

* fixed lint issues and ran prettier

* added <rootDir>/scripts/bench/ to ignore paths for Jest

* tidied up code and fixed a few bugs in the runner.js

* fixed eslint

* improved the benchmark output from the runner

* fixed typo

* tided up print output in runner.js

* throw error if chrome canary is not installed on mac

* added better bench stats output (tables)

* added benchmark diff to table results

* adds bundle size comparisons to results

* tidied up the results

* fixed prettier output

* attempt to trigger bech for circleci build

* fixes flow exlclusion for lighthouse module

* added class components benchmark

* cleaned up stats.js

* stability changes

* circleci node version to 7

* added another benchmark

* added colours to the different benchmarks to check if being cached

* force no-cache headers

* added more info messages

* refactor chrome launching.

* fixed an issue where launcher.kill might fail

* Move server to runner. Launch it only once.

* tidy up

* changes the logic in how the remote repo is checked out

* removes bench from circleci build

* removed colors from benchmarks (no longer needed)

* added CI integration comment

* added hacker news benchmark

* added skipBuild functionality

* relabelled remote

* Add confidence intervals

* added first meaningful paint

* removed some unused code

* reverted code.json

* updated benchmark runs back to 10

* no longer breaks when results contain missing bundles

* adds CPU throttling

* renamed build to remote-repo

* small fix to build

* fixed bad merge

* upped runs to 10 from 2 again

* properly pulls master

* removes old-bench

* runs benchmarks in headless mode

* adds a --headless option

* improved the git build process

* added README

* updated based feedback from review

* adds merge base commit sha

* addressing more PR feedback

* remove built JS react files

* updated .gitignore

* added combined bundle load times to the metrics
2017-05-09 17:13:54 +01:00
Ben Alpert
542dac4a23 Fix return value of ReactDOMFiber.unmountComponentAtNode (#9619) 2017-05-05 17:54:53 -07:00
Andrew Clark
767a5d60e8 updateQueue -> newUpdateQueue
Fix typo introduced after renaming a variable to address shadowing.
2017-05-05 14:21:17 -07:00
Andrew Clark
628b82c808 Allow assigning to this.state inside componentWillMount, with a warning 2017-05-05 14:03:29 -07:00
Andrew Clark
1232666590 Don't recreate instance when resuming a class component's initial mount
Recreating the class instance causes refs (and other callbacks) to close
over stale instances.

Instead, re-use the previous instance. componentWillMount is called
again. We also call componentWillReceiveProps, to ensure that
state derived from props remains in sync.
2017-05-05 14:03:29 -07:00
Dan Abramov
6facb85f85 Fix horizontal scrolling in docs (#9613) 2017-05-05 18:03:39 +01:00
Dan Abramov
138ff5e46b Fix sequencing in the Tutorial (#9615)
* Fix sequencing in the Tutorial

* Update tutorial.md

* Update tutorial.md
2017-05-05 18:02:13 +01:00
Andrew Clark
824e991241 Update flow to 0.45 (#9603) 2017-05-04 11:31:14 -07:00
Dan Abramov
943367faa7 Tweak Tutorial based on feedback 2017-05-04 00:30:12 +01:00
Nathan Hunzaker
6875fa867f Remove loose check on non-number controlled inputs. Fix trailing dot issue. (#9584)
* Remove loose check when assigning non-number inputs

This commit removes a check I added when working on number input
issues where we perform a loose check on an input's value before we
assign it. This prevented controlled text inputs from disallowing
numeric text entry.

I also added a DOM fixture text case.

Related issues:

https://github.com/facebook/react/issues/9561#issuecomment-298394312

* Use strict equality as a guard before assigning input.value

This commit adds back the guard around assigning the value property to
an input, however it does it using a strict equals. This prevents
validated inputs, like emails and urls from losing the cursor
position.

It also adds associated test fixtures.

* Add copy command after build for interup with surge.sh
2017-05-03 13:37:56 -05:00
Flarnie Marchan
50a60dbe74 Add 'unreleased' incremental change log for v15.6.0 (#9544)
* Add 'unreleased' incremental change log for v15.6.0

**what is the change?:**
Adding a section to the change log where we start accumulating
annotations for React v15.6.0.

**why make this change?:**
- Saves us the trouble of writing the change log entry all at once when
  we do the release.
- Adds transparency about what is in the upcoming release, for those who
  aren't following https://github.com/facebook/react/issues/9398

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398

* Minor tweaks to v15.6.0 changelog annotation

**what is the change?:**
- added missing `#` for commit hashes
- added minor details to two annotations

Thanks to @gaearon for the code review comments.

**why make this change?:**
Consistency and clarity.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398

* Remove hashes from commit numbers

**what is the change?:**
We had added hashes to some commit numbers, but ideally only do that
for PRs.

**why make this change?:**
Consistency - this is how github displays those types of links too. PRs
get a '#', and commits don't.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-03 09:00:36 -07:00
Dan Abramov
2b7012ffb0 Fix mobile layout 2017-05-03 15:39:02 +01:00
Dan Abramov
ac00e849fd Fix a typo 2017-05-03 15:04:25 +01:00
Dan Abramov
e6c0ac9a0a Use a more specific link 2017-05-03 11:04:18 +01:00
Addy Osmani
f86256ece0 Add DEV mode note to installation doc (#8784) (#9157)
* Add DEV mode note to installation doc (#8784)

* Address feedback from Dan on wording
2017-05-03 11:03:04 +01:00
Dan Abramov
185db64c76 Add more info about building for production (#9592)
* Add more info about building for production

* Add more info to the docs
2017-05-03 11:01:53 +01:00
Andrew Clark
535afaf759 16.0.0-alpha.12 2017-05-02 14:26:42 -07:00
Dan Abramov
ba72c99183 Report version and bundle type to DevTools (#9586)
* Report version and bundle type to DevTools

* Flip the flag the other way around

It's easier to remember 0 is always PROD, and 1 is like DEV flag. 2 could be PROFILE in the future.

* Add version to RN inject call
2017-05-02 20:34:10 +01:00
Joe Critchley
109d1c95e3 [Docs] Show the name 'React' first in the homepage's <title> (#9582) 2017-05-02 14:22:24 +01:00
Dan Abramov
45dbcfb67d Add missing passing test 2017-05-02 14:22:09 +01:00
Andrew Clark
4d8174480c Only perform class checks on initial mount
Avoids firing warnings multiple times
2017-05-01 15:53:19 -07:00
Andrew Clark
9145f40eb8 Fix bug where null props is passed to constructor when resuming mount
Another example of where the pending/progressed/memoized props model
would benefit from a refactor.
2017-05-01 15:53:19 -07:00
Andrew Clark
ae4fa9ad94 Demonstrate failing test when resuming mount of class component 2017-05-01 15:53:14 -07:00
Dan Abramov
8dcf9c7be7 Change warning casing (#9573)
* Change warning casing

* Update ReactFiberClassComponent.js

* Update ReactCompositeComponent.js
2017-05-01 21:51:47 +01:00
Andrew Clark
b1384062d2 Move AsyncUpdates flag check to class-only path (#9570) 2017-05-01 13:23:54 -07:00
Andrew Clark
835c21a5ef Don't prevent extensions on Fiber if using bad Map polyfill (#9572)
Many Map polyfills work by adding an extra field to the key type.

In the future, we'll likely print a warning.
2017-05-01 13:23:37 -07:00
Abhay Nikam
1f5693ec67 Warning message updated if defaultProps were defined as an instance property (#9493)
* Updated the warning message for setting defaultProps on instance property.

* Updated the testcases for the defaultProps warning.

* Updated the warning message for defaultProps set on instance property.
2017-05-01 13:30:40 -05:00
Dan Abramov
ca4250a1e0 Remove unnecessary # in changelog 2017-05-01 18:32:08 +01:00
Frankie Bagnardi
e9d6f3f10e [Tutorial] Make it easier to follow the instructions (#9454)
* tutorial: adds note about onClick

* tutorial: show full square component

* merge

* fixes line number

* tutorial: misc changes

* fixes Board render initial code sample

* [tutorial] adds codepen links and misc small fixes

* removes useless arrow functions, #9531

* {this.renderSquare} new lines

* be more explicit about history state

* fixes highlight

* following along locally

* changes todo to this.props.value

* removes calculateWinner from initial codepens and includes it in tutorial

* removes note about calculateWinner at end of file

* adds debug-view and debug-view-final

* removes debug view, updates codepen instructions

* adds another codepen

* tutorial.md

* tutorial.md

* tutorial.md

* tutorial.md

* Put . into links for consistency with docs

* Make the very first change easier to follow

* A few more changes
2017-05-01 17:22:26 +01:00
Flarnie Marchan
2e053a5be3 fix typos in CHANGELOG 2017-05-01 09:01:36 -07:00
Flarnie Marchan
0549c4506f Update Changelog for v15.5.1-15.5.4 (#9537)
* Update Changelog for v15.5.1-15.5.4

This could really use extra code review attention since the history of
these changes was a bit convoluted to follow.

After talking to @bvaughn and @acdlite, we thought it might make sense
to put the 'add-ons' changes in a separate change log. The other option,
of including them in the main React change log, seemed the more
confusing of the two.

Also this commit is related to and somewhat blocked by
https://github.com/reactjs/prop-types/pull/40

**what is the change?:**
Adding the change log for recent patch versions of React.

**why make this change?:**
We missed this step in the flurry of releasing patches, and it's useful
for folks who want info about what version to use.

**test plan:**
Visual inspection of the change log.

**issue:**
https://github.com/facebook/react/issues/9443

* Further improve CHANGELOG entries for v15.5.1-15.5.4

**what is the change?:**
- Use the '[@author] in [#PR/commit]' format for annotations
- Make annotations less technical, more clear
- Move 'React Addons' updates into main changelog
- Remove separate 'React Addons' changelog

**why make this change?:**
These changes each make things more clear and accurate.

**test plan:**
Visual inspection

**issue:**

* Fix final nits in CHANGELOG

**what is the change?:**
- Put backticks around package names
- Reformat link to to commit in '([@user](...) in [#NNNN](...))' format
- Remove newlines after subheaders; in the past we sometimes have
  included a newline after the subheader, but most recently it looks
  like we do not.
- Add some missing punctuation.

**why make this change?:**
Consistency and aesthetics

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9443

* Add deprecation notice to v15.5.0-15.5.3

**what is the change?:**
Adding deprecation notice to some recent React versions.

**why make this change?:**
These versions of React use a version of `prop-types` that had a
critical bug. We updated the dependency in React 15.5.4, and hopefully
people will see this notice and update.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/pull/9537
2017-05-01 08:59:42 -07:00
Dan Abramov
f217228326 Clarify where docs live 2017-05-01 13:39:10 +01:00
Marcos Ojeda
f737d63302 docs better indicate that state updaters shallowly merge with state (#9554)
this was a surprise to me because the docs seemed to indicate that when
using an updater, the result _needed_ to be a new state object. I was
[not alone](https://twitter.com/ken_wheeler/status/857939690191806464)
i think in discovering this as a result of the previous tweet in the
thread.
2017-04-30 17:40:22 -07:00
Ben Alpert
f677bfc964 Fix __proto__ bug in ReactDOMSelect (#9536)
https://twitter.com/rauschma/status/857307345231249409
2017-04-29 08:23:00 -07:00
Sebastian Markbage
50d6f9656d Don't try to load asset manifest in dev mode
We're not going to use it so don't try to load it since it may not have
been built yet.
2017-04-27 21:57:01 -07:00
Sebastian Markbåge
b9da1741cb SSR fixture (#9547)
Adds a server-rendering fixture based on create-react-app without ejecting.

This is using the full-page strategy because I wanted to flush out any issues with it. Turns out there's a lot of little things that are fixable and some non-fixable. This actually surfaced some differences between the current strategy and the one I had in mind.

This uses the asset manifest from webpack to pass the final URLs to the client. This ensures that we can render the same exact mark up on the client - including the URL to our own script that we're running in.

Doing full document renders work with 15.x as long as the checksum matches. However, with the patch up reviving strategy I had in mind it would end up removing the CSS tags that webpack injects before running our render call. This is a behavior change.

In dev mode the server runs a proxy in front of the normal CRA webpack server so that we can replace the HTML request for the root page.

I don't know what the best way to link in the react and react-dom packages. Each fixture has a different strategy so here's another one. Just add NODE_PATH=../../build/packages in front of all commands.
2017-04-27 21:03:32 -07:00
Manas
182642b2ea Fiber ReactDOM shouldn't throw on import in Node environment if it's unused (#9389)
* Fixes #9102 by fake polyfilling rAF (and rIC)

* Ensure we restore globals even if test fails + minor nits

* Remove periods
2017-04-27 13:13:03 +01:00
Sriram Thiagarajan
70c01963d9 pre format only compile time errors (#9538)
* pre format only compile time errors

* Style tweak
2017-04-27 11:49:34 +01:00
Andrew Clark
0e3280e2c6 includes -> indexOf 2017-04-26 18:10:27 -07:00
Andrew Clark
1fd582ba20 Fix unnecessary ReactDOM require (#9534)
Apparently, when you mark something as external in Rollup, a require
statement is inserted even if the module isn't used. This is causing
ReactDOM and several other modules to be inserted unnecessarily.

We need a better fix for this, but I'm pushing this quick fix for
now since it's blocking sync to www.
2017-04-26 18:07:53 -07:00
lamo2k123
48479438a3 Completely remove Object.prototype.hasOwnProperty.call() (#7853)
* Avoid directly calling hasOwnProperty

* correct use hasOwnProperty

* added eslint rules `no-prototype-builtins` http://eslint.org/docs/rules/no-prototype-builtins

* single style hasOwnProperty

* added file info /* global hasOwnProperty:true */

* added file info /* global hasOwnProperty:true */

* fixed no-prototype-builtins after merge

* yarn run prettier fixed

* remove src/addons

* return space after *

* remove /* global hasOwnProperty:true */

* Removed using Object.prototype.hasOwnProperty.call()

* yarn run prettier fixed

* Removed using Object.prototype.hasOwnProperty.call()
2017-04-26 20:30:38 +01:00
wacii
1816d06d6b Add guide on integrating with non-react code (#9316)
* Add guide on integrating with non-react code

* Capitalize guide title

* Make links to other docs relative

* Rephrase 'What it does do'

* Remove experimental syntax

* Capitalize Backbone

* Remove empty lifecycle method in generic jQuery example

* Use shouldComponentUpdate() not componentWillUpdate()

* Prefer single quotes

* Add cleanup to generic jQuery example

* Capitalize React

* Generalize the section on Backbone Views

* Generalize the section on Backbone Models, a little

* Add introduction

* Adjust wording

* Simplify ref callbacks

* Fix typo in generic jQuery example

* Fix typos in Backbone models in React components

* Fix more typos in Backbone models in React components

* Add generic section on integrating with other view libraries

* Stress the benefits of an unchanging React element

* Small changes to introduction

* Add missing semicolon

* Revise generic jQuery wrapper section

Moved the section on using empty elements to prevent conflicts above the
code example and added brief introduction to that example.

* Add usage example for Chosen wrapper

* Prevent Chosen wrapper from updating

* Note that sharing the DOM with plugins is not recommended

* Mention how React is used at Facebook

* Mention React event system in template rendering section

* Remove destructuring from function parameters

* Do not name React components Component

* Elaborate on unmountComponentAtNode()

* Mention preference for unidirectional data flow

* Rename backboneModelAdapter

* Replace rest syntax

* Respond to updated model in connectToBackboneModel

* Rewrite connectToBackboneModel example

* Rework connectToBackboneModel example

* Misc changes

* Misc changes

* Change wording

* Tweak some parts
2017-04-26 17:24:22 +01:00
RSG
9824d52a4c React.createElement syntax (#9459)
* React.createElement syntax

Added React.createElement syntax.
I think this is required for this tutorial.

* Reword
2017-04-26 14:25:40 +01:00
Tetsuya Hasegawa
d6cc1d1755 Remove outdated Troubleshooting section (#9489)
* fixed a simple typo in README.md troubleshooting section

* Remove the troubleshooting section
2017-04-26 14:14:07 +01:00
Sriram Thiagarajan
7ccfb07337 fixed error formatting in live editor (#9497) 2017-04-26 14:06:53 +01:00
Daniel Lo Nigro
cf24d87177 [site] Load libraries from unpkg (#9499)
* [site] Load libraries from unpkg

* Revert Gemfile changes
2017-04-26 14:02:50 +01:00
chocolateboy
3d60d4cc7d [Docs] Fix confusing description for the <script>...</script> usage (#9502)
* Fix confusing description for the <script>...</script> usage

* Update jsx-in-depth.md

* Update reference-react-dom-server.md

* Update reference-react-dom.md

* Update reference-react.md
2017-04-26 13:57:22 +01:00
Dmitri Zaitsev
a8c223ab41 Add reference to the Hyperscript libraries (#9517)
* Add reference to the Hyperscript libraries

I feel these should be mentioned as they provide terser syntax than using `R.createElement` directly, even with a shorthand.

* Rephrase
2017-04-26 13:54:31 +01:00
Mateusz Burzyński
dce3c28ccb Prevent process polyfill to be included in builds because of process guards preventing code replace (#9518) 2017-04-26 13:47:35 +01:00
Dominic Gannaway
71f201b5c3 updates yarn.lock (#9530) 2017-04-26 13:43:36 +01:00
Frankie Bagnardi
14fa8a5452 adds indirect refs to docs (#9528)
* adds indirect refs to docs

* Add more info

* Explain clearer

* Rephrase

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md
2017-04-26 13:40:09 +01:00
Andrew Clark
8ba820a699 Use prop-types instead of prop-types factory (#9526)
Latest versions of prop-types don't depend on React, so the factory is
not necessary, and in fact bloats the build because it is intended for
15.5 and so doesn't strip out the checkers in prod.
2017-04-25 14:32:27 -07:00
Andrew Clark
09a9c646fd Rename react-dom to ReactDOM in Facebook www (#9525) 2017-04-25 13:30:48 -07:00
Brian Vaughn
81336fd8ce Prettier 2017-04-25 10:19:06 -07:00
Benedikt Meurer
0e587c1a8e Improve component type check in getComponentKey. (#9464)
* Improve component type check in getComponentKey.

The sequence
```
component && typeof component === 'object'
```
checks whether component is any JavaScript object except document.all.
Since document.all cannot occur here, this can be replaced with the
usual
```
typeof component === 'object' && component !== null
```
sequence, which yields true for all JavaScript objects and is well
optimized by all JavaScript engines.

* Run yarn prettier.
2017-04-25 09:39:30 -07:00
Nathan Hunzaker
a9d0deb8e1 Consolidate events between EventConstants and BrowserEventEmitter (#9512) 2017-04-25 09:24:10 -07:00
Maciej Kasprzyk
d12c41c7a6 Describe fixtures dir in the codebase overview (#9516)
* Describe fixtures dir in overview

* Fix folder name
2017-04-25 10:25:32 +01:00
Brian Vaughn
2905e56904 Bumped version numbers and built 16.0.0-alpha.11 2017-04-24 18:52:10 -07:00
Brian Vaughn
e71b3087c8 Added stack renderer to react-test-renderer bundle temporarily (#9514)
Also fixed an error in a temporary export property that had been added to the React object
2017-04-24 18:45:43 -07:00
Andrew Clark
4cbadd3fb6 Prettier 2017-04-24 17:19:38 -07:00
Andrew Clark
b61f060044 ReactARTStack should use ReactDOM's ReactUpdates (#9515) 2017-04-24 17:03:12 -07:00
Nathan Hunzaker
86dd083f45 Move ReactDOMFactories into separate package (#8356)
- Update examples to no longer use React.DOM
- Add package and documentation entries for react-addons-dom-factories
- Update dom-factories readme
- Set up proxy to intercept React.DOM usage
- Update ReactDOM children tests to use createElement
- Add more specific warning assertion for React DOM factories
- Do not use expectDev in ReactDOMFactories tests
2017-04-24 08:08:17 -07:00
Jen Wong
c8a64e2637 Updates how-to-contribute.md to use JSFiddle referenced in submit Git issue template (#9503) 2017-04-23 18:03:11 -05:00
Paul O’Shannessy
bcb6f0eac4 Don't build gh-pages branch on CircleCI (#9442) 2017-04-22 22:33:43 +01:00
Flarnie Marchan
39ca8aacf8 Add link to 'Typechecking with PropTypes' under 'Advanced Guides' (#9472)
This should have been retained in our docs, since PropTypes are only
moved and not deprecated.

Partially handles #9467, and I'll make a separate PR to
https://github.com/reactjs/prop-types to add more docs to the README
there.
2017-04-22 10:41:39 -07:00
Brian Vaughn
9d225b5a44 Stop passing prevContext param to componentDidUpdate (#8631) 2017-04-21 13:15:22 -07:00
Soo Jae Hwang
ec527cc834 [WIP] Warn in dev if shouldComponentUpdate is defined on PureComponent (#9240)
* Add test for React.PureComponent

* Add warning when shouldComponentUpdate is declared in a PureComponent

* Add actionable warning

* Add warning in Fiber

* Format added code by running yarn prettier

* Move pure sCU check to checkClassInstance

That way it warns before the component updates
2017-04-21 09:55:16 -05:00
Abhay Nikam
5518bd44a9 Warning added if defaultProps were defined as an instance property (#9433)
* Added warning when defaultProps was defined as an instance property

* Added testcases to check warning message for defaultProps

* Update fiber tests
2017-04-21 09:46:19 -05:00
Vitaliy Potapov
895dca587b Warn about Infinity in style value (#9360)
* warn about Infinity in style value

* prettier
2017-04-21 09:41:43 -05:00
Roman Matusevich
6dfb65a121 Remove Prev Next links from add-ons documentation (#9226) 2017-04-21 15:31:17 +01:00
David Hu
f5144121f9 Add more details in jsx-in-depth.md (#9006)
* jsx-in-depth.md add ternary statement for javascript expressions section

* jsx-in-depth.md add explanation to get falsey values for props

* update jsx-in-depth.md

* ensure links work locally, remove section about falsey prop values

* Fix links
2017-04-21 15:27:39 +01:00
Benton Rochester
217d271032 Ignoring files for vim users. (#9199) 2017-04-21 15:25:34 +01:00
Brandon Dail
42bc28bbfd Use setProperty when setting style properties (#9302)
* Use setProperty when setting style properties

setProperty is faster in all/most modern browsers. It also lets us support CSS variables.

* Only use setProperty when setting CSS variables

* Add test to ensure setting CSS variables do not warn

* Make this PR pretty again

* Run fiber test script
2017-04-20 15:25:39 -05:00
Brian Vaughn
41290742e6 Bumped version numbers for alpha 10 (#9474) 2017-04-20 13:06:51 -07:00
Brian Vaughn
73ca89408b Updated PropTypes test to work with newer prop-types version (#9471)
The prop-types lib got an anti-spamming change in 15.5.8 that broke some of our tests (see reactjs/prop-types/commit/e1d51dd0efbd0eee5e4a8d24759f2a4d518721d3). This PR resolves that by resetting the prop-types import between tests.
2017-04-20 12:48:53 -07:00
Andrew Clark
28bc8860bc Run prettier after update to 1.2 in master 2017-04-20 11:39:04 -07:00
Andrew Clark
b4d77b98ed Fix subtree tests so that async component is not top-level 2017-04-20 11:38:13 -07:00
Andrew Clark
9b676a7d0b Remove enableAsyncSubtreeAPI from host config
Use a ReactFeatureFlag instead. It won't be per-renderer, but we likely
won't need that.

When enableAsyncSubtreeAPI is false, unstable_asyncUpdates is ignored,
but does not warn or throw. That way if we discover a bug in async mode,
we can flip the flag and revert back to sync without code changes.
2017-04-20 11:38:13 -07:00
Andrew Clark
0c896ffe6b Change unstable_asyncUpdates from an instance to a static property
This lets us check for its existence before the instance is constructed.

Also works with functional components.
2017-04-20 11:38:13 -07:00
Andrew Clark
488b973d68 Use number type for bitfields
Unions don't enumerate all the possible combinations of bitfields. I'm
not actually sure why this was type-checking before.

number doesn't provide much safety but it's more correct.
2017-04-20 11:38:13 -07:00
Andrew Clark
f69748601d Remove unstable_asyncRender() API in favor of always using a wrapper 2017-04-20 11:38:13 -07:00
Andrew Clark
abd07dffb3 Rename contextTag -> internalContextTag 2017-04-20 11:38:13 -07:00
Andrew Clark
26d70fd334 Add enableAsyncSubtreeAPI to host config
Allows us to control this feature on a per-renderer basis
2017-04-20 11:37:18 -07:00
Andrew Clark
864973c544 Run Fiber test script 2017-04-20 11:37:18 -07:00
Andrew Clark
ada638a064 Run prettier 2017-04-20 11:37:18 -07:00
Andrew Clark
609e97ebe7 instance.unstable_asyncUpdates = true creates an async subtree
Same behavior as unstable_asyncRender. Can be used to wrap a specific
subtree, rather than an entire root.
2017-04-20 11:37:18 -07:00
Andrew Clark
3bf398bcbc ReactDOM.unstable_asyncRender creates an async-by-default tree
The default priority of updates in a async tree is LowPriority, rather
than SynchronousPriority.

Warns if you call unstable_asyncRender on a tree that was created with
the normal, sync ReactDOM.render.
2017-04-20 11:37:18 -07:00
Andrew Clark
6f8fec4b80 Use different default priority depending on the AsyncUpdate context flag
- A priority context of NoWork represents the default priority
- Changed the signature of getPriorityContext to accept the fiber that
is about to be updated.
2017-04-20 11:36:35 -07:00
Andrew Clark
1b388366c1 Inherit contextTag from the parent on creation
A fiber has all the context flags of its parent. It may also add
additional ones during construction/mount. After mounting, contextTag
shouldn't change.
2017-04-20 11:35:08 -07:00
Andrew Clark
f1df675b93 Add contextTag field to Fiber type
contextTag is a bitmask that describes properties about the fiber
and its subtree. For example, the AsyncUpdates flag indicates whether
the subtree should use async scheduling.

When a fiber is created, it inherits the bitmask of its parent.
2017-04-20 11:35:08 -07:00
Eric Sakmar
648822952f Adds CSS Grid properties to list of unitless numbers (#9185) 2017-04-20 11:20:15 -07:00
Ben Alpert
b1768b5a48 Prettier 1.2 (#9462) 2017-04-20 11:18:33 -07:00
Ben Alpert
32480a0462 Add component stack to invalid-object-child error (#9415)
https://twitter.com/EsaMatti/status/835952325525188608 (28 likes!)
2017-04-20 09:49:46 -07:00
Dan Abramov
e59506c478 Bump prop-types 2017-04-20 16:40:58 +01:00
Almero Steyn
a92128e7fb [Docs: Installation] Fix tabs responsive layout - Resubmit (#9458)
* [Docs: Installation] Fix tabs responsive layout

* Move tabs a pixel down

* Remove left margin on first tab

* Remove the long line

* Fix mobile styles
2017-04-20 11:49:48 +01:00
Brian Vaughn
9bb7ca5001 Fix master (ran prettier) 2017-04-19 19:03:04 -07:00
Brian Vaughn
66f2097f33 Shallow renderer and test utils bundles (#9426)
Shallow renderer and test utils bundles

Adds new bundles introduced with React 15.5 release to master (and 16 alpha)

react-dom/test-utils:

This new bundle contains what used to be react-addons-test-utils. This bundle shares things from react-dom rather than duplicates them.

A temporary createRenderer method has been left behind as a way to access the new shallow renderer. This is for the ReactNative release cycle only and should be going away before the final release.

react-test-renderer/shallow:

This new shallow renderer is almost entirely stand-alone (in that it doesn't use the React reconciler or scheduler). The only touch points are ReactElement and prop/context validation. This renderer is stack and fiber compatible.
2017-04-19 16:45:31 -07:00
Ben Alpert
53dbb191d6 Uncomment invariant in UIManager mock (#9461) 2017-04-19 16:28:59 -07:00
Brian Vaughn
8782ab759e Fix CI failures in master (#9455)
* Ran prettier over UIManager mock
* Temporarily disabled an invariant() in UIManager mock that was breaking tests
* Updated Fiber passing tests
2017-04-19 08:59:40 -07:00
Flarnie Marchan
3e48422fdc Warn for keys in fragments - third approach (#9445)
* Fix tests to pass when we warn for missing keys in fragments

In most cases we just needed to add the 'key' prop.

This ignores the tests which are already failing on master when running
with ` REACT_DOM_JEST_USE_FIBER=1` - there are 8.

All tests should now pass with `npm run test`, and the 8 which fail when
running `REACT_DOM_JEST_USE_FIBER=1 npm run test` are the same 8 which
are failing on master.

* Added missing key warning for children in array fragments

After trying twice to reuse the code between the ReactChildFiber and
ReactElementValidator, I am thinking that it's simpler to just have some
duplication of code. The parts that are shared are interleaved with
parts which cannot be shared, either because of singleton modules that
must be required differently in 'isomorphic' and the 'renderers', or the
fact that 'warning' requires a hard coded string.

Test Plan:

- Added test to ReactChildren-test
- Manually tested via fixture that was not committed.

* commit updated "scripts/rollup/results.json"

* Make 'ReactChildren-test' more specific, and remove unneeded nesting

Based on helpful tips from @spicyj and @aweary's review
 - Made the unit test for the warning on missing keys more specific
 - Removed unneeded nesting in the code which generates missing key
   warning
 - Change test syntax to use JSX to be more consistent

Also fixes flow warning.

* Commit update of scripts/rollup/results.json

* run "scripts/fiber/record-tests"
2017-04-19 08:05:04 -07:00
Almero Steyn
9526174e30 [Docs] Add accessibility to tabs in installation documentation (#9431)
* Add accessibility to tabs in installation documentation

* Change color and fix styling
2017-04-19 12:31:39 +01:00
Joel Denning
233195cb6b Fixing the instantiation of customized builtin elements (related to custom elements) (#9313)
* Fixing the creation of customized builtin elements

* Whitespace

* Running prettier

* Updating ReactDOMFiberComponent
2017-04-19 12:07:16 +01:00
Fabrizio Castellarin
1ce562ead3 Reorganize the "following along" instructions (#9453)
* Reorganize the "following along" instructions

* Minor tweaks
2017-04-19 12:00:15 +01:00
Ben Alpert
b392f1e2fc Fix errors in React Native children management (#9449)
* Fix errors in React Native children management

- Support using appendChild to move an existing child (Fiber does this, but we were assuming all children here were new; Yoga throws if you insert a child that already has a parent)
- Calculate beforeChildIndex after removing old child (previously, off by one when the new position is later than the old position)

* Add better children management tests for RN
2017-04-18 17:31:33 -07:00
Filip Hoško
10eaf26809 FIX: Move CRA build info under it's tab page (#9452)
* FIX: Move CRA build info under it's tab page

* Add some links
2017-04-18 18:17:28 +01:00
Dan Abramov
c5783901a8 Tweak tutorial structure 2017-04-18 18:07:16 +01:00
Dan Abramov
7b80361b6b Add missing tutorial sidebar links 2017-04-18 18:00:54 +01:00
Dan Abramov
a41d469bcf Minor tutorial nits 2017-04-18 17:53:53 +01:00
Dan Abramov
a7f124f48f Fix duplicate sentence 2017-04-18 17:44:32 +01:00
Dan Abramov
da124f2fb1 Minor tweaks to tutorial 2017-04-18 17:40:59 +01:00
Frankie Bagnardi
8417534bd0 [Tutorial] ES6, installation, and button closing tag (#9441)
* adds notes to tutorial on es6 and installation

* fixes tutorial mention of opening button tag

* More writing

* Update
2017-04-18 17:34:43 +01:00
Abhishek Soni
d724115144 Fixed grammar (#9432)
* Update codebase-overview.md

* Some more fixes
2017-04-18 16:38:39 +01:00
hanumanthan
53a3939fb0 Lift state up - Updating the documentation to mention that onClick is a synthetic event handler (#9427)
* Lift state up - Updating the documentation to mention that onClick is a synthetic event handler

* Review comments - Rephrase to handle synthetic events and event handler patterns

* Tweak
2017-04-18 16:27:45 +01:00
Michał Ordon
37f9e35ad9 Sort out conferences by date (#9172) 2017-04-18 15:38:19 +01:00
Jayen Ashar
ccb38a96cf Update jsx-in-depth.md (#9178)
* Update jsx-in-depth.md

Line 9 isn't changed

* Move selection down

* Fix
2017-04-18 15:29:17 +01:00
Fraser Haer
363f6cb2e5 Unique headings for linking purposes (#9259)
Previously two headings were 'Javascript Expressions' - now 'Javascript
Expressions as Props' and 'Javascript Expressions as Children'
2017-04-18 14:47:44 +01:00
NE-SmallTown
359f5d276f [Documentation] Impreove the react-component section of doc (#9349)
* Impreove react-component of doc 

[#9304](https://github.com/facebook/react/issues/9304)

* update description

* add missing space
2017-04-18 14:42:40 +01:00
Chris Pearce
f6c4fe6cbb Only attempt to clear measures if we created the measure (#9451)
This fixes an issue where if we decided not to create a measurement we would clear ALL measurements from the performance entry buffer due to passing `undefined` as the entry name.
2017-04-18 14:31:47 +01:00
Sung Won Cho
ac9d698636 Make nodeType into constant for readability and reuse (#9113)
* Make nodeType into constant for readability and reuse

* Fix eslint line length warning

* Delete unused nodeType values

* Destructure HTMLNodeType constant

* Make nodeType into constant for readability and reuse

* Fix eslint line length warning

* Delete unused nodeType values

* Destructure HTMLNodeType constant

* Fix test

* Format using prettier
2017-04-15 18:37:12 +01:00
Ben Alpert
7bf686b76f Add component stack to ReactControlledValuePropTypes (#9435) 2017-04-14 19:50:43 -07:00
Ben Alpert
1447d9f1ae Add component stack to uncontrolled-to-controlled warning (#9416)
https://twitter.com/JulianVModesto/status/836089555304448000
https://twitter.com/abevoelker/status/836040051993763842
2017-04-14 16:57:47 -07:00
Arshabh Kumar Agarwal
f54fdd5441 Add warning if rendering and HTMLUnknownElement (#9163)
* Add warning if rendering and HTMLUnknownElement

* Records fiber tests

* Fixes linting and server render tests

* Incorporates review comments

* Uses ownerDocument instead of document

* uses el instead of creating a new element

* Removes warning check of voidElementTags

* Add missing space to unknown element warning

* Only call isCustomComponent once

* Spy on console in menuitem test

Since menuitem is treated as an unknown element in jsdom it triggers the unknown element warning.

* Add unknown element warning to Fiber

* Replace instanceof with toString check

It is more resilient.

* Record tests
2017-04-14 11:30:38 -05:00
Abhay Nikam
36c935ca8f Updated the Good First Bug section in readme (#9429)
* Updated the Good First Bug section in readme

* Inconsistent use of quotes. Prefered single quotes instead of double quotes

* Updated Good first bug link in how_to_contribute doc.

* Undo JSX attribute quote change

* don't capitalize "beginner friendly issue"
2017-04-14 11:02:07 -05:00
Vikash Agrawal
db989c0f63 Updated link for good first bug's in README.md (#9273)
* Updated link for good first bug's in README.md

* Changed text for beginner friendly bugs

* update beginner friendly bugs section title
2017-04-14 10:56:38 -05:00
Abhay Nikam
a95e1d8ffc Updated recommended links for installation in readme (#9425) 2017-04-13 23:15:13 +01:00
Dan Abramov
4c8c5debac Switch Installation to a tab when hash is present (#9422) 2017-04-13 21:51:19 +01:00
Marks Polakovs
855b8d3526 Add tabs to installation page (#9275, #9277) (#9401)
* Add tabs to installation page (#9275, #9277)

This adds tabs for create-react-app and existing apps to the installation section of the docs. The tab implementation is a simplified version of React Native's installation page.

Fixes #9275.

* Use classList instead of className

* Use same implementation as in RN
2017-04-13 20:54:12 +01:00
Eric Elliott
30d6c598c6 Docs: Clarification of setState() behavior (#9329)
* Clarification of setState() behavior

`setState()` is a frequent source of confusion for people new to React, and I believe part of that is due to minimization of the impact of the asynchronous behavior of `setState()` in the documentation. This revision is an attempt to clarify that behavior. For motivation and justification, see [setState Gate](https://medium.com/javascript-scene/setstate-gate-abc10a9b2d82).

* Update reference-react-component.md

* Signature fix

* Update to address @acdlite concerns

* Add more details
2017-04-13 19:13:55 +01:00
Jack
4e0c57315a Update proptypes doc (#9391)
* Update proptypes doc

* Removed note
2017-04-13 18:11:23 +01:00
Gabriel Lett Viviani
22655d5759 Fix the proptypes deprecation warning url on the "Don't Call PropTypes Warning" doc page (#9419)
* Use the same prop-types link on the warning docs page as the main proptypes doc page

* Link to repo instead
2017-04-13 15:15:34 +01:00
hanumanthan
5cd44d21e9 Refractor docs to indicate that state set to props in constructor will not recieve the updated props (#9404) 2017-04-13 00:56:22 +01:00
Dominic Gannaway
446f186279 Update typechecking-with-proptypes.md (#9392)
* Update typechecking-with-proptypes.md

* Update typechecking-with-proptypes.md

* Use consistent style for PropTypes import
2017-04-12 00:04:38 +01:00
Brian Vaughn
6cd7618bd7 Bumped versions for 16.0.0-alpha.9 and re-built 2017-04-11 14:40:56 -07:00
Brian Vaughn
2beec2f308 createClass + PropTypes + checkPropTypes warnings (#9399)
(Temporarily) re-adds getters with deprecation warnings for React.PropTypes, React.checkPropTypes, and React.createClass.

* 08bd020: Replace all references to React.PropTypes with prop-types to avoid triggering our own warning message.
* ef5b5c6: Removed several references to React.createClass that appeared after rebasing this branch. (reviewed by @flarnie)
* 524ce20: Added getters for createClass and PropTypes to the main React isomorphic object, behind one-time warning messages. (reviewed by @spicyj)
* db48f54: Fixed Rollup bundles to inline 'prop-types' and 'create-react-class' for UMD builds only. (reviewed by @spicyj, @trueadm )
* cf49cfd: Updated tests-passing.txt to remove tests that were deleted in this branch.
* d34109a: Responses to PR feedback from @spicyj. (Added package.json dependencies to packages/react and packages/react-dom. Renamed a var. Expanded on an inline comment.)
* 488c8d2: Added warning for moved package to React.checkPropTypes accessor too and updated build script.
* 83bcb29: Wordsmithing for deprecation notices (added fb.me links).
* afdc9d2: Tweaked legacy module inlining to remove order-of-deps constraint
* d1348b9: Removed $FlowFixMe.
* 7dbc3e7: More wordsmithing of deprecation notices based on Dan's feedback.
2017-04-11 14:28:03 -07:00
Dan Abramov
aa1f8687d7 Use caret range in blog instructions
The release was a bit broken.
2017-04-11 22:04:29 +01:00
Denis Pismenny
cec9b07402 Fix minor typo in lifting-state-up.md (#9408) 2017-04-11 22:03:53 +01:00
Ben Alpert
b1a06bd945 Fix ignore patterns in package.json (#9409) 2017-04-11 13:58:14 -07:00
Andrew Clark
957fbc92b1 react-create-class -> create-react-class 2017-04-10 17:06:32 -07:00
Andrew Clark
ce489262a1 Add react-create-class integration tests
These are mostly copied from the old ReactClass-test module.
2017-04-10 17:03:05 -07:00
Andrew Clark
6b539f280d Convert createClass caller
This snuck in after rebasing
2017-04-10 17:03:05 -07:00
Andrew Clark
646e786334 Warn once when attempting to access React.createClass
Should still be undefined.
2017-04-10 17:03:05 -07:00
Andrew Clark
194b25f709 Run prettier 2017-04-10 17:03:05 -07:00
Andrew Clark
c76a4eaa2a Update tests to use plain JavaScript classes
Tests that rely on replaceState or isMounted use
updater.enqueueReplaceState and updater.isMounted instead.
2017-04-10 17:03:05 -07:00
Andrew Clark
087fe88f20 Rewrite Stack implementation of ReactART using plain classes
instead of createClass
2017-04-10 17:03:05 -07:00
Andrew Clark
5cfaa7cf68 Delete createClass
Remove createClass from isomorphic package
2017-04-10 17:03:05 -07:00
Maciej Kasprzyk
c2309bf4b5 Delete examples dir from codebase overview (#9397)
Removes doc about folder that no longer exists.
2017-04-10 16:26:09 -05:00
Dan Abramov
457b812c26 Fix ReactARTStack bundles to not include DOM Stack inside (#9394)
* Move ReactDOMFrameScheduling.js to shared (between dom and art)

* Fix ReactARTStack bundles to not include DOM Stack inside
2017-04-10 22:01:56 +01:00
Luke Belliveau
6c8fd16a06 Amended implementation-notes.md with link to Dan Abramov's post describing difference between React components, elements, and instances (#9388)
* Amended implementation-notes.md to include a link to a blog post by Dan Abramov, explaining the difference between components, elements, and instances. An understanding of this distinction is crucial in tracing through Implementation pseudocode, and reading Dan's blog first may ease newcomers into understanding the implementation.

* adjusted wording to maintain stylistic consistency with rest of content, per @aweary's request
2017-04-09 14:37:41 -05:00
Aaron Ackerman
d3d4b599b9 Point users to the npm page instead of the github project for prop-types (#9373) 2017-04-08 04:05:34 +01:00
Andrew Clark
e5ce3fd368 Blog post and changelog for 15.5.0 (#9368) 2017-04-07 14:41:16 -07:00
Dan Abramov
72196da829 Replace shims with explicit React access from the renderers for shared global state (#9366)
* Remove non-existent /lib/ from souce files

* Replace all shims with explicit access

This deletes shims and changes to access require('react').__DO_NOT_USE__ from renderers for global shared state.

I cloned flattenChildren() and traverseAllChildren() because they relied on CurrentOwner but were used both from Stack and Isomorphic. The stack implementations will die, and the isomorphic ones can be changed to be optimized for Children specifically in the future.

I also deleted UMD shims because they are now unnecessary. I moved the internals assignment to main modules since they're now used in tests, and made them direct UMD entry points.
2017-04-07 22:07:10 +01:00
Flarnie Marchan
6eaa539ad5 Update example snippet in old 'React.addons' doc page (#9363)
* Update example snippet in old 'React.addons' doc page

This makes the example more consistent.

* Add back the pointers in docs that were mistakenly removed

In https://github.com/facebook/react/pull/9359 we accidentally removed
pointers in some doc pages. Putting them back now.

* Link to npm package instead of github page

This seems like a more stable place to link to in the 'context'
document.
Based on @bvaughn's feedback in https://github.com/facebook/react/pull/9359
2017-04-07 13:47:54 -07:00
Dan Abramov
d88696941d 16.0.0-alpha.8 2017-04-07 18:47:23 +01:00
Dan Abramov
d9fd08df26 Make ReactDebugCurrentFrame shared state between core and renderers (#9365) 2017-04-07 17:03:22 +01:00
Dan Abramov
e303e00d06 Tweak Rollup setup (#9364)
* Remove unused Rollup shim and exports

* Add a way to build multiple bundles
2017-04-07 16:17:36 +01:00
Dan Abramov
a8d37a7aa0 Remove indirection in checking propTypes (#9358)
* Remove indirection in checking propTypes

* Silence flow errors
2017-04-07 15:23:28 +01:00
Flarnie Marchan
8f7281199d All doc updates forv15.5 (#9359)
* `react-addons-test-utils` -> `react-dom/test-utils`

Updating all references and docs on the `React.addons.TestUtils` and the
shallow renderer to refer to the correct targets.

Instead of:
```
const React = require('react');

// ...
React.addons.Testutils
// or

const ReactTestUtils = require('react-addons-test-utils');
```
we now show:
```
const ReactTestUtils = require('react-dom/test-utils');
```

And for shallow renderer, instead of:
```
const shallowRenderer = TestUtils.createRenderer();
```

we now show:
```
const shallowRenderer = require('react-test-renderer/shallow');
```

* Update the 'prev' and 'next' attributes of 'add-ons' docs

These flags are used to set arrow links to easily navigate through the
documents. They were wrong or missing in some of the 'add-ons' pages and
this bothered me when manually testing the updates from the previous
commit.

* Update syntax for instantiating shallow renderer

Missed this when updating the docs for the changes to shallow-renderer
in React 15.5.

* Fix pointers in addons docs

Thanks @bvaughn for catching this

* Make example of shallow renderer more consistent

We should show using the same variable names between code samples.

* Make names in example even more consistent

We should use the same variable name for the same thing across examples.
`renderer` -> `shallowRenderer`.

* Update docs to deprecate React<CSS>TransitionGroup

 - removes link to the docs about `ReactCSSTransitionGroup` and
   `ReactTransitionGroup` from the main navigation
 - updates 'prev' and 'next' pointers to skip this page
 - adds deprecation warning to the top of the page
 - remove references to these modules from the packages README
 - updates 'add-ons' main page to list this as a deprecated add-on

* Update `React.createClass` to `createReactClass` in the docs

The `React.createClass` method is being deprecated in favor of
`createReactClass`.

* Remove 'React.createClass' from top level API docs

It no longer makes sense to have a section for the 'createClass' method
in this page, since it won't be available as a top level method on
'React'.

I initially was going to pull the section about 'createClass' into a
separate page to add under 'addons' but it was short and duplicative of
the 'react-without-es6' docs. So I just linked to those.

* Remove *most* `React.PropTypes` from the docs

I am doing the docs for `context` in a separate commit because that case
was a bit less clear-cut.

We will no longer support `React.PropTypes` as a built-in feature of
React, and instead should direct folks to use the `PropTypes` project
that stands alone.

Rather than retaining the `React.PropTypes` examples and just revamping
them to show the use of the stand-alone `PropTypes` library with React,
it makes more sense to direct people to that project and reduce the
perceived API area and complexity of React core. The proper place to
document `PropTypes` is in the README or docs of that project, not in
React docs.

* Update `context` docs to not use `React.PropTypes`

We use `React.PropTypes` to define the `contextType` for the `context`
feature of React. It's unclear how this will work once `React.PropTypes`
is replaced by the external `PropTypes` library. Some options;

a) Deprecate `context`, either in v16 or shortly after. Seems reasonable
based on the intense warnings against using context that we have in the
docs -
https://facebook.github.io/react/docs/context.html#why-not-to-use-context
**Except** that probably some widely used libraries depend on it, like
`React-Router`.

b) Expect users will use external `PropTypes` library when defining
`contextTypes` and just don't do our `checkReactTypeSpec` against them
any more in v16.

c) Stop masking context and pass the whole context
unmasked everywhere. Worst option, do not recommend.

I went with `b` and assume that, for now, we will get users to use the
external `PropTypes` when defining context. I will update this PR if we
want a different approach.

* Remove 'addons' items from left nav, and deprecate 'addons' doc page

The plan:
[X] Remove links to 'addons' items from main navigation
[X] Add deprecation notices where appropriate, and update syntax to show
using the separate modules.
[ ] Update other references to 'React.addons' in docs. Coming in next
commit.
--- blocked but coming in future PRs
[ ] Link to a blog post describing the new locations of add-ons in the
deprecation notice on the '/docs/addons.html' page. Blocked until we
actually publish that blog post.
[ ] Move the docs for each add-on to the actual github repo where it now
lives.
[ ] Redirect the old add-ons doc permalinks to the docs in the separate
github repos for those modules.
[ ] Remove the old add-ons doc markdown files from React core docs.

* Remove references to `React.addons` from docs

Just misc. places where we referenced the 'addons' feature. All gone!
2017-04-06 17:20:54 -07:00
Dan Abramov
21bb8c00d4 16.0.0-alpha.7 2017-04-06 19:50:22 +01:00
Brian Vaughn
6ba42514ea Remove 'takeSnapshot' from ReactNative renderer\nUpstream sync from react-native repo (#9356) 2017-04-06 10:39:18 -07:00
Dominic Gannaway
832488ab09 change permissions of test_print_warnings (#9347) 2017-04-05 23:18:39 +01:00
Dominic Gannaway
3ebdd0911e Fixes the eager react-dom replacement on the rollup plugin (#9346)
* Fixes the eager react-dom replacement on the rollup plugin

* added the other replaceInternalModules
2017-04-05 22:42:12 +01:00
Dan Abramov
84b5b49aec Delete extra babel-standalone.html: it already exists in a folder 2017-04-05 21:17:10 +01:00
Dan Abramov
2429fd2cee Fix art fixture 2017-04-05 21:05:23 +01:00
Dan Abramov
3a416762e7 Fix glob ignore for build script 2017-04-05 20:24:30 +01:00
Dan Abramov
a85d7eed9a Run prettier 2017-04-05 19:51:23 +01:00
Dan Abramov
6a48f32f21 Exclude tests from warning print script 2017-04-05 19:51:19 +01:00
Brian Vaughn
c80570b016 Synced ReactNativeFiber bugfix for leaf-node children (#9330) 2017-04-05 11:29:45 -07:00
Dan Abramov
fc1f324cc4 Fix warnings script to work on Node 4 2017-04-05 19:01:09 +01:00
Dan Abramov
398d449c48 Fix the print warnings script (#9344) 2017-04-05 18:54:48 +01:00
Dominic Gannaway
6b68410808 Adds support for labels on building bundles (#9342)
* adds support for labels on bundles

* -fiber

* reverts results
2017-04-05 18:30:12 +01:00
Dominic Gannaway
24dc43c49f fixes circleci/upload_build.sh paths for dist files (#9341)
* fixes circleci/upload_build.sh paths for dist files

* updated the react filenames to include development or production
2017-04-05 17:25:09 +01:00
Dan Abramov
4fa8122d5d Update release manager with latest change 2017-04-05 17:16:36 +01:00
Dan Abramov
665f80483e Update build paths in docs (#9340) 2017-04-05 16:53:25 +01:00
Dominic Gannaway
4b2eac3de7 Convert current build system to Rollup and adopt flat bundles (#9327)
* WIP

* fbjs support

* WIP

* dev/prod mode WIP

* More WIP

* builds a cjs bundle

* adding forwarding modules

* more progress on forwarding modules and FB config

* improved how certain modules get inlined for fb and cjs

* more forwarding modules

* added comments to the module aliasing code

* made ReactPerf and ReactTestUtils bundle again

* Use -core suffix for all bundles

This makes it easier to override things in www.

* Add a lazy shim for ReactPerf

This prevents a circular dependency between ReactGKJSModule and ReactDOM

* Fix forwarding module for ReactCurrentOwner

* Revert "Add a lazy shim for ReactPerf"

This reverts commit 723b402c07116a70ce8ff1e43a1f4d92052e8f43.

* Rename -core suffix to -fb for clarity

* Change forwarding modules to import from -fb

This is another, more direct fix for ReactPerf circular dependency

* should fix fb and cjs bundles for ReactCurrentOwner

* added provides module for ReactCurrentOwner

* should improve console output

* fixed typo with argument passing on functon call

* Revert "should improve console output"

This breaks the FB bundles.

This reverts commit 65f11ee64f678c387cb3cfef9a8b28b89a6272b9.

* Work around internal FB transform require() issue

* moved  ReactInstanceMap out of React and into ReactDOM and ReactDOMFiber

* Expose more internal modules to www

* Add missing modules to Stack ReactDOM to fix UFI

* Fix onlyChild module

* improved the build tool

* Add a rollup npm script

* Rename ReactDOM-fb to ReactDOMStack-fb

* Fix circular dependencies now that ReactDOM-fb is a GK switch

* Revert "Work around internal FB transform require() issue"

This reverts commit 0a50b6a90bffc59f8f5416ef36000b5e3a44d253.

* Bump rollup-plugin-commonjs to include a fix for rollup/rollup-plugin-commonjs#176

* Add more forwarding modules that are used on www

* Add even more forwarding modules that are used on www

* Add DOMProperty to hidden exports

* Externalize feature flags

This lets www specify them dynamically.

* Remove forwarding modules with implementations

Instead I'm adding them to react-fb in my diff.

* Add all injection necessary for error logging

* Add missing forwarding module (oops)

* Add ReactART builds

* Add ReactDOMServer bundle

* Fix UMD build of ReactDOMFiber

* Work in progress: start adding ReactNative bundle

* tidied up the options for bundles, so they can define what types they output and exclude

* Add a working RN build

* further improved and tidied up build process

* improved how bundles are built by exposing externals and making the process less "magical", also tidied up code and added more comments

* better handling of bundling ReactCurrentOwner and accessing it from renderer modules

* added NODE_DEV and NODE_PROD

* added NPM package creation and copying into build chain

* Improved UMD bundles, added better fixture testing and doc plus prod builds

* updated internal modules (WIP)

* removed all react/lib/* dependencies from appearing in bundles created on build

* added react-test-renderer bundles

* renamed bundles and paths

* fixed fixture path changes

* added extract-errors support

* added extractErrors warning

* moved shims to shims directory in rollup scripts

* changed pathing to use build rather than build/rollup

* updated release doc to reflect some rollup changes

* Updated ReactNative findNodeHandle() to handle number case (#9238)

* Add dynamic injection to ReactErrorUtils (#9246)

* Fix ReactErrorUtils injection (#9247)

* Fix Haste name

* Move files around

* More descriptive filenames

* Add missing ReactErrorUtils shim

* Tweak reactComponentExpect to make it standalone-ish in www

* Unflowify shims

* facebook-www shims now get copied over correctly to build

* removed unnecessary resolve

* building facebook-www/build is now all sync to prevent IO issues plus handles extra facebook-www src assets

* removed react-native-renderer package and made build make a react-native build dir instead

* 😭😭😭

* Add more SSR unit tests for elements and children. (#9221)

* Adding more SSR unit tests for elements and children.

* Some of my SSR tests were testing for react-text and react-empty elements that no longer exist in Fiber. Fixed the tests so that they expect correct markup in Fiber.

* Tweaked some test names after @gaearon review comment https://github.com/facebook/react/pull/9221#discussion_r107045673 . Also realized that one of the tests was essentially a direct copy of another, so deleted it.

* Responding to code review https://github.com/facebook/react/pull/9221#pullrequestreview-28996315 . Thanks @spicyj!

* ReactElementValidator uses temporary ReactNative View propTypes getter (#9256)

* Updating packages for 16.0.0-alpha.6 release

* Revert "😭😭😭"

This reverts commit 7dba33b2cfc67246881f6d57633a80e628ea05ec.

* Work around Jest issue with CurrentOwner shared state in www

* updated error codes

* splits FB into FB_DEV and FB_PROD

* Remove deps on specific builds from shims

* should no longer mangle FB_PROD output

* Added init() dev block to ReactTestUtils

* added shims for DEV only code so it does not get included in prod bundles

* added a __DEV__ wrapping code to FB_DEV

* added __DEV__ flag behind a footer/header

* Use right haste names

* keeps comments in prod

* added external babel helpers plugin

* fixed fixtures and updated cjs/umd paths

* Fixes Jest so it run tests correctly

* fixed an issue with stubbed modules not properly being replaced due to greedy replacement

* added a WIP solution for ReactCurrentOwner on FB DEV

* adds a FB_TEST bundle

* allows both ReactCurrentOwner and react/lib/ReactCurrentOwner

* adds -test to provides module name

* Remove TEST env

* Ensure requires stay at the top

* added basic mangle support (disbaled by default)

* per bundle property mangling added

* moved around plugin order to try and fix deadcode requires as per https://github.com/rollup/rollup/issues/855

* Fix flow issues

* removed gulp and grunt and moved tasks to standalone node script

* configured circleci to use new paths

* Fix lint

* removed gulp-extract-errors

* added test_build.sh back in

* added missing newline to flow.js

* fixed test coverage command

* changed permissions on test_build.sh

* fixed test_html_generations.sh

* temp removed html render test

* removed the warning output from test_build, the build should do this instead

* fixed test_build

* fixed broken npm script

* Remove unused ViewportMetrics shim

* better error output

* updated circleci to node 7 for async/await

* Fixes

* removed coverage test from circleci run

* circleci run tets

* removed build from circlci

* made a dedicated jest script in a new process

* moved order around of circlci tasks

* changing path to jest in more circleci tests

* re-enabled code coverage

* Add file header to prod bundles

* Remove react-dom/server.js (WIP: decide on the plan)

* Only UMD bundles need version header

* Merge with master

* disabled const evaluation by uglify for <script></script> string literal

* deal with ART modules for UMD bundles

* improved how bundle output gets printed

* fixed filesize difference reporting

* added filesize dep

* Update yarn lockfile for some reason

* now compares against the last run branch built on

* added react-dom-server

* removed un-needed comment

* results only get saved on full builds

* moved the rollup sized plugin into a plugins directory

* added a missing commonjs()

* fixed missing ignore

* Hack around to fix RN bundle

* Partially fix RN bundles

* added react-art bundle and a fixture for it

* Point UMD bundle to Fiber and add EventPluginHub to exported internals

* Make it build on Node 4

* fixed eslint error with resolve being defined in outer scope

* Tweak how build results are calculated and stored

* Tweak fixtures build to work on Node 4

* Include LICENSE/PATENTS and fix up package.json files

* Add Node bundle for react-test-renderer

* Revert "Hack around to fix RN bundle"

We'll do this later.

This reverts commit 59445a625962d7be4c7c3e98defc8a31f8761ec1.

* Revert more RN changes

We'll do them separately later

* Revert more unintentional changes

* Revert changes to error codes

* Add accidentally deleted RN externals

* added RN_DEV/RN_PROD bundles

* fixed typo where RN_DEV and RN_PROD were the wrong way around

* Delete/ignore fixture build outputs

* Format scripts/ with Prettier

* tidied up the Rollup build process and split functions into various different files to improve readability

* Copy folder before files

* updated yarn.lock

* updated results and yarn dependencies to the latest versions
2017-04-05 16:47:29 +01:00
Nathan Hunzaker
d99b3fc6d6 Remove MouseEvent.button polyfill (#9334)
MouseEvent.button is supported in every browser React targets:
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
2017-04-05 12:34:48 +01:00
Rahul Gupta
3829859e22 Moved the JSdoc for invokeGuardedCallback to correct position (#9337) 2017-04-05 12:34:14 +01:00
Justin
0c7863075d Fix grammar typo in Design Principles docs (#9324)
features → feature
> There is nothing "bad" about using state or lifecycle hooks in components. Like any powerful feature**s**, they should be used in moderation, but we have no intention to remove them.

I can’t explain the exact grammatical principle this violates, but it sounds wrong to my native English ears that “feature” is plural here. Another way to check if the grammar sounds right is to change the order of the clauses: ”They should be used in moderation, like any powerful feature“ sounds right, whereas “They should be used in moderation, like any powerful features” does not.
2017-04-04 17:16:54 -05:00
Ben Alpert
e50f97b4cb Update addons-two-way-binding-helpers.md
I don't think this reference is that helpful and could turn people away since it sounds very fancy and isn't relevant..
2017-04-04 11:14:09 -07:00
Aaron Cannon
50b3cab3ec Make it clear that textarea also supports defaultValue. (#9318) 2017-04-03 23:05:50 -05:00
Dan Abramov
4a37718e4e Remove examples/ folder (#9323) 2017-04-03 20:32:02 +01:00
Sasha Aickin
04713fc4bd Merge pull request #9264 from aickin/server-render-unit-tests-forms
Adding SSR test for form fields.
2017-03-31 15:42:07 -07:00
Andrey Marchenko
d9915db43b Deleting a specific style name float for ie8 (#9311)
* Deleting a specific style name float for ie8

* Remove unnecessary condition
2017-03-31 23:31:52 +01:00
Sasha Aickin
a734aecc98 Response to code review comment https://github.com/facebook/react/pull/9264#discussion_r108974871 . Thanks, @spicyj! 2017-03-31 14:49:03 -07:00
Ben Alpert
6fd539ec66 Fix build
oops i broke it
2017-03-31 16:20:28 +01:00
Ben Alpert
e9c995974d Port out bug fixes to ReactARTFiber (#9309)
D4616127 D4629747 D4631778
2017-03-31 16:13:01 +01:00
Nathan Hunzaker
27c844905f Remove scroll capture support warning (#9303)
I removed the scroll capture feature check for IE8, however I missed
the associated warning.
2017-03-31 11:36:08 +01:00
Nathan Hunzaker
bd2802523c Remove viewport metrics, other pageX/pageY behaviors (#9290)
* Remove viewport metrics

event.pageX and event.pageY are in every browser React supports.

* Rerecord tests
2017-03-31 02:20:57 +01:00
Andrey Marchenko
5ad1c76386 Deleted a specific code for ie8 - document.selection (#9298) 2017-03-30 19:00:12 -05:00
Brian Vaughn
76c5c6deb5 Disabling a no-unreachable lint error (#9300) 2017-03-30 16:40:45 -07:00
Brian Vaughn
4f69474e03 Added explicit null return to completeUnitOfWork() to resolve Flow error (#9299) 2017-03-30 15:45:13 -07:00
Brian Vaughn
224487a0e2 Show more meanignful stack trace for ReactNative errors (#9291)
* Show more meanignful stack trace for ReactNative errors

Clicking on the stack should jump to where the error actually occurred rather than to where it's logged in a redbox component.

* Made showDialog() return type stricter. Added mock and Flow types for ExceptionManager

* Prettier

* Handle null/string thrown errors

* Removed unused reference to emptyFunction
2017-03-30 15:15:33 -07:00
Nathan Hunzaker
b8857d4f27 Remove captured focus feature check (#9285)
IE8 was the only browser that did not support captured focus. We no
longer have that constraint.
2017-03-30 13:47:14 -07:00
Brian Vaughn
004c937cb0 Move takeSnapshot from UIManager to ReactNative renderer(s) (#9292)
* Move takeSnapshot from UIManager to ReactNative renderer(s)

* Prettier
2017-03-30 13:10:15 -07:00
Brandon Dail
8d6d3e8c05 Update JSFiddle for issue template (#9289) 2017-03-30 11:43:16 -05:00
Brandon Dail
686010037d Remove IE8-specific setInnerHTML behavior (#9288)
Since IE8 is not supported anymore, lets save those bytes!
2017-03-30 17:24:58 +01:00
Nathan Hunzaker
dbeb37fe69 Add DOM fixture for unmasking passwords (#9269)
IE11 and Edge have a password unmask field that React prevents the
display of for controlled inputs. This commit adds DOM fixture
coverage for this test case.
2017-03-30 10:16:36 -05:00
Damian Nicholson
0c70fb8b18 Added semicolons to addons imports examples. (#9287) 2017-03-30 15:55:27 +01:00
Ben Alpert
e57ad7f51e Allow returning null as host context (#9278)
If your renderer doesn't use host context, you might prefer to return null. This used to give an error:

> Invariant Violation: Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.

I use a sentinel value instead now.

The code in ReactFiberHostContext is a little complicated now. We could probably also just remove the invariants.
2017-03-30 13:18:39 +01:00
Nathan Hunzaker
4c292facc9 Remove captured scroll feature check (#9283)
* Remove captured scroll feature check

IE8 was the only browser that did not support captured scroll. We no
longer have that constraint.

* Remove WINDOW_HANDLE const
2017-03-30 11:01:29 +01:00
Brandon Dail
9a93be0b33 Remove IE8-specific ChangeEventPlugin logic (#9281) 2017-03-29 17:37:56 -05:00
Brandon Dail
da91e9ebe9 Add DOM fixtures for disabled button click events (#9271) 2017-03-29 11:17:54 -05:00
Dominic Gannaway
09f0a5ded9 Merge pull request #9276 from trueadm/getDeclarationErrorAddendum_DEV
[Fiber] Adds DEV condition around getDeclarationErrorAddendum
2017-03-29 13:55:04 +01:00
Dominic Gannaway
660306982c added DEV condition around getDeclarationErrorAddendum contents 2017-03-29 13:49:30 +01:00
Sasha Aickin
aaabd655a6 Added jest-cli to the package.json for the Fiber record-tests script. (#9270) 2017-03-28 22:55:22 +01:00
Brian Vaughn
a749f4fb63 Adding fix to EventPropagators that was accidentally omitted from PR #9219 (#9274) 2017-03-28 11:24:13 -07:00
Brian Vaughn
fca5d3ffc5 Added missing @flow annotation to ReactNativeFeatureFlags file (#9267) 2017-03-27 14:59:37 -07:00
Andrew Clark
090efbdb17 Merge branch 'giamir-add_toggle_to_fiber_triangle_demo' 2017-03-27 12:48:39 -07:00
Andrew Clark
f6a64cad5d Use radio buttons for toggle 2017-03-27 12:48:05 -07:00
Andrew Clark
ef9dac518f Merge branch 'add_toggle_to_fiber_triangle_demo' of https://github.com/giamir/react into giamir-add_toggle_to_fiber_triangle_demo 2017-03-27 11:46:59 -07:00
Nathan Hunzaker
29d9710892 Fix Chrome number input backspace and invalid input issue (#7359)
* Only re-assign defaultValue if it is different

* Do not set value if it is the same

* Properly cover defaultValue

* Use coercion to be smart about value assignment

* Add explanation of loose type checks in value assignment.

* Add test coverage for setAttribute update.

* Only apply loose value check to text inputs

* Fix case where empty switches to zero

* Handle zero case in controlled input

* Correct mistake with default value assignment after rebase

* Do not assign bad input to number input

* Only trigger number input value attribute updates on blur

* Remove reference to LinkedValueUtils

* Record new fiber tests

* Add tests for blurred number input behavior

* Replace onBlur wrapper with rule in ChangeEventPlugin

* Sift down to only number inputs

* Re-record fiber tests

* Add test case for updating attribute on uncontrolled inputs. Make related correction

* Handle uncontrolled inputs, integrate fiber

* Reorder boolean to mitigate DOM checks

* Only assign value if it is different

* Add number input browser test fixtures

During the course of the number input fix, we uncovered many edge
cases. This commit adds browser test fixtures for each of those instances.

* Address edge case preventing number precision lower than 1 place

0.0 coerces to 0, however they are not the same value when doing
string comparision. This prevented controlled number inputs from
inputing the characters `0.00`.

Also adds test cases.

* Accommodate lack of IE9 number input support

IE9 does not support number inputs. Number inputs in IE9 fallback to
traditional text inputs. This means that accessing `input.value` will
report the raw text, rather than parsing a numeric value.

This commit makes the ReactDOMInput wrapper check to see if the `type`
prop has been configured to `"number"`. In those cases, it will
perform a comparison based upon `parseFloat` instead of the raw input
value.

* Remove footnotes about IE exponent issues

With the recent IE9 fix, IE properly inserts `e` when it produces an
invalid number.

* Address exception in IE9/10 ChangeEventPlugin blur event

On blur, inputs have their values assigned. This is so that number
inputs do not conduct unexpected behavior in
Chrome/Safari. Unfortunately, there are cases where the target
instance might be undefined in IE9/10, raising an exception.

* Migrate over ReactDOMInput.js number input fixes to Fiber

Also re-record tests

* Update number fixtures to use latest components

* Add number input test case for dashes and negative numbers

* Replace trailing dash test case with replace with dash

Also run prettier
2017-03-27 11:39:18 -05:00
Sasha Aickin
14863c9a87 Adding SSR test for form fields. 2017-03-26 20:51:40 -07:00
Sasha Aickin
c51411c812 Adding new SSR tests for context, refs, and reviving markup. (#9257) 2017-03-26 13:32:23 -07:00
Giamir Buoncristiani
b62f851e64 Add a button to switch from Fiber with time-slicing to Fiber without it 2017-03-26 17:24:26 +01:00
najisawas
c47f334ac9 Fixed typo on implementation notes page (#9258)
Added paren to "mountComponent()" for consistency
2017-03-25 20:57:28 -05:00
Brian Vaughn
cb585229bc Ran yarn and fixed line-length lint issue 2017-03-24 19:59:05 -07:00
Brian Vaughn
1a29b4e2a3 Updating packages for 16.0.0-alpha.6 release 2017-03-24 15:44:09 -07:00
Brian Vaughn
1acf949240 ReactElementValidator uses temporary ReactNative View propTypes getter (#9256) 2017-03-24 15:37:21 -07:00
Sasha Aickin
25deff6203 Add more SSR unit tests for elements and children. (#9221)
* Adding more SSR unit tests for elements and children.

* Some of my SSR tests were testing for react-text and react-empty elements that no longer exist in Fiber. Fixed the tests so that they expect correct markup in Fiber.

* Tweaked some test names after @gaearon review comment https://github.com/facebook/react/pull/9221#discussion_r107045673 . Also realized that one of the tests was essentially a direct copy of another, so deleted it.

* Responding to code review https://github.com/facebook/react/pull/9221#pullrequestreview-28996315 . Thanks @spicyj!
2017-03-24 13:31:15 -07:00
Dan Abramov
0a41890eaa Remove rethrowCaughtError injection (#9252) 2017-03-24 18:19:12 +00:00
Johan Tinglöf
38d8f3ee6b Updated Router import for example (#9233)
Updated import in order to be a correct working example as in accordance with the docs
2017-03-24 09:37:32 -05:00
Dan Abramov
f082e35b36 Fix up invariant import to be from fbjs/lib/ 2017-03-23 19:45:10 +00:00
Dan Abramov
d6a2c669d2 Fix ReactErrorUtils injection (#9247) 2017-03-23 19:13:07 +00:00
Dan Abramov
1c9dcd53d5 Add dynamic injection to ReactErrorUtils (#9246) 2017-03-23 18:45:38 +00:00
Brian Vaughn
c8897f8382 Updated ReactNative findNodeHandle() to handle number case (#9238) 2017-03-23 08:16:52 -07:00
Dan Abramov
b0b9f37960 Fix up Flow syntax 2017-03-22 18:41:42 +00:00
Dan Abramov
8de9c6c12c Add injection for error dialog (#9235) 2017-03-22 18:21:12 +00:00
Bernard Lin
fbc6977fbc Conferences (#9234)
* standard format for React Rally

* move React Conf 2017 to past conferences
2017-03-22 10:40:13 -05:00
Brian Vaughn
8ce5fe97b5 Bumped React version to 16.0.0-alpha.5 2017-03-21 13:04:08 -07:00
Valentin Shergin
97ab3f5ef8 Removed optimization for events without target in ReactNativeEventEmitter (#9219)
* Removed optimization for events without target in ReactNativeEventEmitter

This PR fixes the problem originally introduced in https://github.com/facebook/react/pull/6590
The problem is that `ResponderEventPlugin` (and `ResponderTouchHistoryStore`) relies on that fact that touch events are balanced.
So if one `startish` event happened, should be coming `endish` event. Otherwise there is no way to maintain internal `trackedTouchCount` counter. So, if we drop some events, we break this logic.

Moreover, that optimization clearly contradict with this statement from `ResponderEventPlugin`:
```
We must be resilient to `targetInst` being `null` on `touchMove` or
`touchEnd`. On certain platforms, this means that a native scroll has
assumed control and the original touch targets are destroyed.
```

This issue causes several major problems in React Native, and one of them (finally!) is easy to reproduce: https://github.com/facebook/react-native/issues/12976 .

The test also illustrates this problem.

* Prettier
2017-03-20 17:07:28 -07:00
Brian Vaughn
7f665da0ee ReactNative upstream sync (#9197)
* Addresses a circular dependency between NativeMethodsMixin and ReactNativeFiber:

* Created new ReactNativeFiberHostComponent with similar interface but without unnecessary call to findNodeHandle.
* Created new Flow interface for mixins to ensure ReactNativeFiberHostComponent and NativeMethodsMixinUtils stay synced.
* Moved helper methods to NativeMethodsMixinUtils to be shared between the 2 wrappers.

This diff was submitted and reviewed internally along with some other ReactNative changes. This is the React-only portion.

* Removed unused Flow type import

* Copied a Flow fix from internal
2017-03-20 13:50:31 -07:00
Dan Abramov
e15a481773 Re-add tests unintentionally deleted in #9209 (#9225)
These tests are useful and don't test addons specifically.
I moved them to appropriate places in the codebase.
2017-03-20 19:38:54 +00:00
Dan Abramov
34e4352cba Delete addons (#9209)
* Delete addons

* Remove ReactFragment dependency from tests

* Remove addons testing from fixtures

* Don't mention createFragment() in a warning

* Address feedback

* Remove unused variables

* Remove mention of deleted file

* Add a missing key to the test

* Fix lint
2017-03-20 16:15:01 +00:00
CodinCat
0ceb5115ac Use single quotes, remove extra whitespace (#9215) 2017-03-19 18:34:53 +00:00
Sasha Aickin
78761c387f Add unit tests for props to attribute mapping in SSR. (#9106)
* Added a handful of SSR unit tests, ported from a previous pull request.

* Fixing linting errors

* Fixed a test helper function to properly report errors.

* Un-nested the new rendering tests. Updated the fiber test passing/not passing lists.

* Edited to comply with the react/jsx-space-before-closing eslint rule, which will soon be merged into master.

* Response to code review from @spicyj. Moved tests to separate file, reworked wording of test names, corrected use of canUseDom, and simplified tests against tagName. Thanks for the help, @spicyj!

* Converted the unit tests to use async-await style.

* Moved async-await babel transform for tests from .babelrc to preprocessor.js.

* Response to code review in PR #9089. Thanks, @spicyj!

* Fixing some bugs in the SSR unit tests.

* Missed deleting some repeated code in the last commit.

* Adding unit tests for property to attribute mapping in SSR.

* Removing some redundant unit tests.

* Oops. I forgot to re-run record-tests after c593dbc; fixing that here.

* Reformatting for prettier so that the build will pass.
2017-03-19 16:08:55 +00:00
Andrew Clark
f606e0e7d3 Merge pull request #9145 from acdlite/explicitnullcheckfiberupdatequeue
Use explicit null checks in ReactFiberUpdateQueue
2017-03-17 10:44:11 -07:00
Brian Vaughn
ad2b6545fe Upgraded Flow dev dependency to 41 for 'implements' support (#9196) 2017-03-16 17:12:50 -07:00
Sebastian Markbåge
096975afab Record fiber tests (#9195) 2017-03-16 16:29:05 -07:00
Sebastian Markbåge
9c7cf20dd5 Ignore event listener extraction on numeric text components (#9194)
In ReactDOM we don't dispatch events in the synthetic event system on to
text nodes. We back up one to the element before dispatching.

In React Native we don't do that. The iOS native side doesn't dispatch on
the text nodes but only the parent. The Android native side however does
dispatch on text nodes.

We already covered this for strings, but current element in Stack can be
a number if it is numeric text content.
2017-03-16 15:29:06 -07:00
Andrew Clark
9549ebfae5 Merge pull request #9187 from acdlite/prettierci
Failing to run prettier should block CI
2017-03-16 11:55:41 -07:00
Andrew Clark
8802c20c22 Run yarn prettier to format code
CI should now pass
2017-03-16 11:53:44 -07:00
Andrew Clark
cbdddbeb58 (test) Commit changes without running prettier to see if CI fails 2017-03-16 11:53:44 -07:00
Andrew Clark
0e5be287f7 Exit with failing code if prettier throws to ensure CI is blocked 2017-03-16 11:53:44 -07:00
Andrew Clark
c71a8ecd00 Add prettier instructions to PR template and contribution guide 2017-03-16 11:53:44 -07:00
Andrew Clark
7cf2950ebb Pass args as an array 2017-03-16 11:53:44 -07:00
Andrew Clark
ecf2e44908 CI should fail if prettier wasn't run 2017-03-16 11:53:44 -07:00
Andrew Clark
f365e52dd7 Add prettier script
`scripts/prettier/index.js write` will run prettier on source files.
Run using `yarn prettier`.

`scripts/prettier/index.js` will throw if any source files are not
formatted with prettier. We'll use this to block CI.

Based on similar script in Jest repo.
2017-03-16 11:53:44 -07:00
Jamison Dance
7253e6544b Add React Rally to conferences list (#9179) 2017-03-15 14:20:57 -10:00
Andrew Clark
bc30ef9842 Work around loose typing for fiber.updateQueue
The updateQueue field is currently an any type. Check the fiber's tag so
that only UpdateQueues are passed to getPendingPriority.
2017-03-15 15:05:04 -07:00
Andrew Clark
21e0e3711b Use explicit null checks in ReactFiberUpdateQueue
Follow-up to #8978
2017-03-15 15:04:59 -07:00
James Long
b1b4a2fb25 Merge pull request #9101 from sebmarkbage/prettier
Use Prettier
2017-03-14 15:33:27 -07:00
Sebastian Markbage
7e078d6a92 Fix lint rules
The typeof one is a bit strange because the disable rule gets moved.
2017-03-14 14:12:35 -07:00
Sebastian Markbage
ba1299acc2 Non idempotent steps in prettier 2017-03-13 17:06:03 -07:00
Sebastian Markbage
1843f87168 Run prettier 2017-03-13 17:05:18 -07:00
Sebastian Markbage
46bcd7fdf2 Add ignore to multichild test 2017-03-13 17:04:37 -07:00
Sebastian Markbage
b363803d26 Update to prettier 0.22 2017-03-13 17:02:21 -07:00
Sebastian Markbage
898ba574d6 Try 80-character line limit instead 2017-03-13 16:57:16 -07:00
Sebastian Markbage
df6388ab52 Add prettier-ignore where we do matrix style formatting 2017-03-13 16:57:13 -07:00
Sebastian Markbage
9d34dd3c01 More options 2017-03-13 16:55:59 -07:00
Sebastian Markbage
4adad94eac Add prettier option in scripts 2017-03-13 16:55:58 -07:00
Bernard Lin
2b59afb984 Updated React Native EU (#9170)
* Updated Chain React

Changed conference date from "Summer 2017" to given date on website

* Updated React Native EU 

Updated date and place with information from website
2017-03-13 22:43:03 +00:00
Ben Alpert
a2716d087e Fix two bugs in version bump script (#9165)
* Fix version bump script when files are missing

* Add noop renderer to version bump script

Without this, grunt build fails due to the version mismatch.
2017-03-13 10:04:14 -07:00
Ben Alpert
0d7b4d6dba 16.0.0-alpha.4 2017-03-13 08:54:41 -07:00
Ben Alpert
f3a26c0f75 Switch UMD build to use Fiber 2017-03-13 08:46:20 -07:00
Adam
bf5abdf14f Remove ref usage in main markdown example (#9160)
from [elsewhere in the docs](https://facebook.github.io/react/docs/refs-and-the-dom.html):

> Avoid using refs for anything that can be done declaratively.
2017-03-12 15:29:10 +00:00
Ben Alpert
19c2649e02 Use fiber by default (#9155)
Affects our builds. But not in tests yet.
2017-03-10 17:06:02 -08:00
Dan Abramov
8de68c56f9 [Fiber] Remove unnecessary second getComponentName() (#9153)
* Remove unnecessary second getComponentName()

We already have one. The other one is also less fragile and doesn't throw on null type.

* Make setState in render warning check simpler

This skips it earlier since in most cases phase won't be "render".
This is unobservable.
2017-03-10 19:29:20 +00:00
Dan Abramov
c96482d37f Remove PR check from GH Pages build hook for stable branch (#9144) 2017-03-10 01:17:27 +00:00
Dan Abramov
7fa311bcd9 Reorder sections in alphabetical order (#9143)
* Reorder sections in alphabetical order

* Reorder here too
2017-03-09 20:46:55 +00:00
Dan Abramov
6559b10b11 Use more widely supported emoji (#9139) 2017-03-09 00:55:36 +00:00
Dan Abramov
266481dacf Don't count skipped tests when calculating Fiber facts (#9136) 2017-03-08 21:03:21 +00:00
Dan Abramov
73378c9293 [Fiber] Performance measurements (#9071)
* wip

* better

* better

* track commits

* better

* wip

* Fix

* Add some lifecycles

* wip

* Naming

* Moar emojis

* Remove stacks in favor of a flag

* Fix Flow

* Gate behind __DEV__

* Revert flag for testing

* Measure all lifecycles

* Push it to the limits

* Polish

* Indent

* Refactor and track cascading updates

* More prominent warnings

* Make mark names themselves readable

This is useful for RN Systrace which doesn't let us assign labels after the fact.

* Keep track of how many effects we call

* Fix typo

* Do less work to reduce the overhead

* Fix lint

* Remove closure

* Remove unintentional formatting changes

* Add tests

* Fix test regex and record tests

* Disable irrelevant tests needed for ReactPerf

* Fix typo

* Fix lint and flow

* Don't treat cWM or cWRP as cascading

* Whitespace

* Update tests

* Gate callComponentWillUnmountWithTimerInDev definition by DEV
2017-03-08 18:28:53 +00:00
Dominic Gannaway
4e9d7ac833 Merge pull request #9096 from trueadm/component-tree-hook-dev
[Fiber] Split dev methods within ReactComponentTreeHook
2017-03-07 14:09:22 +00:00
Dominic Gannaway
a159e85c46 removed inline boolean checks for methods 2017-03-07 13:35:41 +00:00
Brandon Dail
6ca2140c73 Remove _resetEventPlugins, use jest.resetModuleRegistry (#9111)
* Move EventPluginRegistry._resetEventPlugins to DEV

This is not called during runtime at all and is only using in internal unit tests. Despite that, its currently being included in production builds. This change makes it so its only defined in DEV, which might even be too much (we can maybe inject it in our unit tests to avoid defining it at all in EventPluginRegistry)

* Remove _resetEventsPlugin, use resetModuleRegistry
2017-03-07 02:25:24 +00:00
Ben Alpert
d79c6ab995 Fiber DOM async feature flag (#9127)
D4662171
2017-03-06 16:21:43 -08:00
Vincent Taing
bb149c8170 Fix redundant null type coercion (#9114) 2017-03-06 15:20:12 -08:00
Ben Alpert
678cb70da2 Fix radio buttons using stale props in Fiber (#9126)
D4662269
2017-03-06 14:58:29 -08:00
Andrew Clark
0b06b0b35e Merge pull request #9121 from jddxf/refactor
Don't reset the return fiber again after cloning the child fibers
2017-03-06 12:21:10 -08:00
Dominic Gannaway
f992d54157 removed describe.only 2017-03-06 15:18:21 +00:00
Dominic Gannaway
af4d249aa9 fixes tests so they correctly pass in fiber 2017-03-06 15:15:18 +00:00
Dominic Gannaway
b67a29a8ab Merge remote-tracking branch 'upstream/master' into component-tree-hook-dev 2017-03-06 14:55:33 +00:00
Dominic Gannaway
b572e3c907 moved non DEV methods to a new file called ReactFiberComponentTreeHook.js
This moves the non DEV methods to a new file called ReactFiberComponentTreeHook, updates existing references to DEV functions to remain inside DEV flags so they do not pull in ReactComponentTreeHook
2017-03-06 14:19:23 +00:00
jddxf
f939c1bca4 Don't reset the return fiber after cloning the child fibers, as we already do that while cloning. 2017-03-06 17:08:56 +08:00
Brandon Dail
12ad77d006 Remove EventPluginRegistry.getPluginModuleForEvent (#9110) 2017-03-06 00:52:56 -06:00
Brandon Dail
0c1f515faf Remove sliceChildren (#9109) 2017-03-06 00:52:39 -06:00
Brandon Dail
ceafdbf0a5 Remove ReactStateSetters (#9107) 2017-03-03 22:42:25 -06:00
Dan Abramov
d87c4d5e5c [Fiber] Don't schedule class fibers without relevant lifecycles for commit (#9105)
* Don't schedule class fibers without relevant lifecycles for commit

* Separate Update and Ref effects

* Simplify the exit condition

* Add missing annotation

* Write conditions differently to avoid an extra check

* Inline markUpdateIfNecessary()

* Inline markUpdateIfAlreadyInProgress()
2017-03-04 04:23:09 +00:00
Dima Beznos
0bedd0697a Added Brunch build tool to the docs (#9074)
* Added Brunch build tool to the docs

* Improved grammar

* product build -> production build
2017-03-03 16:15:25 -06:00
Andrew Clark
ccde21cd2b Merge pull request #9088 from acdlite/testerrorutilsshim
Test that ReactErrorUtils module can be shimmed
2017-03-03 14:09:10 -08:00
Andrew Clark
e3f6c850c2 Merge pull request #9097 from acdlite/dontextractprodproptypeerror
Fix production propTypes test so it works with error code system
2017-03-03 11:06:04 -08:00
Sasha Aickin
fcf41e7ca2 Add async/await to unit tests; modify server rendering tests to use async/await. (#9089) 2017-03-03 10:34:14 -08:00
Andrew Clark
fc4633775a Remove destructuring, since the version of node on www doesn't support it 2017-03-02 16:44:04 -08:00
Andrew Clark
cf4c06ceba Merge pull request #9098 from acdlite/printwarnings
Add script to print out a list of warnings
2017-03-02 16:39:43 -08:00
Andrew Clark
673f514f81 Fix PropTypes production test so it works with error code system 2017-03-02 16:12:50 -08:00
Dominic Gannaway
91de17ec52 added guards in place to prevent mixed prod+dev errors from occuring 2017-03-02 23:06:32 +00:00
Dominic Gannaway
397fd2b92e removed double semicolon 2017-03-02 22:09:12 +00:00
Dominic Gannaway
9a1db49259 removed comment 2017-03-02 22:08:15 +00:00
Dominic Gannaway
1f7cbb63e8 updated flow annotations 2017-03-02 22:06:46 +00:00
Dominic Gannaway
54fef50186 re-added missing files 2017-03-02 21:52:54 +00:00
Dominic Gannaway
da9d91829e WIP - not sure how to get the Flow type working properly 2017-03-02 21:50:02 +00:00
Sunny Ripert
179240ca30 Fix spacing in documentation (#9070)
Replace non-breaking space by space.
2017-03-02 13:57:58 -06:00
Jason Quense
2757a53fa5 Add fixture components (#8860)
* add fixture components

* add a few more options and styles

* Test fixture updates

- Pull in React from window global
- Add field to TestCase for fix PR links
- Update some styles

* Remove unused Fixture.Result comment

* Remove leading # from resolvedBy link

* Implement tag loading utility that caches response

Don't bust the cache doing feature detection

COME ON

* Use 'local' without version for option
2017-03-02 13:38:27 -06:00
Andrew Clark
9c8547cc9f Add script to print out a list of warnings
We'll use this in the GH sync script to track which warnings have
changed since the last sync
2017-03-02 11:37:01 -08:00
Dominic Gannaway
e8f3f92a88 fixed flow issues and bug resulting in failing tests 2017-03-02 17:53:09 +00:00
Dominic Gannaway
0e23042e4b refactor of ReactComponentTreeHook to isolate dev methods 2017-03-02 16:15:37 +00:00
Vesa Laakso
a190cfce29 Update Lifting State Up not to mix up DOM value with component state (#9032)
* Update Lifting State Up not to mix up DOM value with component state

A few weeks ago when teaching my friend, she got stuck on
`this.state.value` vs. `event.target.value`. As the documentation
talked a lot about "values", and the term value could mean three
different things (values in general, the "value" prop / DOM value of
the <input> component and the value in state/props), it was not weird
that she got a bit confused.

* Rename Lifting State Up onChange props to onTemperatureChange

This is in-line with how the temperature is provided as a prop named `temperature`

* Fix one value prop not being renamed to temperature

* Update codepen examples in Lifting state up documentation

* Update devtools state change to reflect docs change
2017-03-02 00:28:09 +00:00
Dan Abramov
c8f14c26b0 Add a step to the release process 2017-03-01 22:56:06 +00:00
Andrew Clark
b1a565f8fa Convert shorthanded syntax for function Flow types to expanded form
Something in www's test pipeline isn't able to parse this.
2017-03-01 14:38:48 -08:00
Andrew Clark
a293d75f75 Test that ReactErrorUtils module can be shimmed
We do this in www
2017-03-01 14:38:48 -08:00
Andrew Clark
5881371b61 Merge pull request #9087 from acdlite/fixstringcasting
Fix string casting and remove Flow suppression comments
2017-03-01 13:51:17 -08:00
Sasha Aickin
3788654d57 Adding some server rendering unit tests. (#9055)
* Added a handful of SSR unit tests, ported from a previous pull request.

* Fixing linting errors

* Fixed a test helper function to properly report errors.

* Un-nested the new rendering tests. Updated the fiber test passing/not passing lists.

* Edited to comply with the react/jsx-space-before-closing eslint rule, which will soon be merged into master.

* Response to code review from @spicyj. Moved tests to separate file, reworked wording of test names, corrected use of canUseDom, and simplified tests against tagName. Thanks for the help, @spicyj!
2017-03-01 13:39:47 -08:00
Andrew Clark
5e5bc69230 Fix string casting and remove Flow suppression comments 2017-03-01 13:07:22 -08:00
Andrew Clark
d1ee199492 Fix usage of Boolean constructor 2017-03-01 12:30:32 -08:00
Bryan Braun
7a878d27e3 Replace the header_links plugin with client-side generated anchors. (#4165)
* Replace the header_links plugin with client-side generated anchors.

Fixes facebook/react#4124

* Move anchor-link code into a separate script

Also adds a couple comments, for context.
2017-03-01 11:52:54 -08:00
Andrew Clark
737dac4f03 areChildrenOffscreen -> shouldDeprioritizeSubtree 2017-03-01 10:56:31 -08:00
Andrew Clark
a1cd77db6e Pass type to areChildrenOffscreen, too 2017-03-01 10:56:31 -08:00
Andrew Clark
4602e768f3 Add areChildrenOffscreen to host config
Renderers can determine whether a node's children are offscreen based on
the host component's props. If so, they are given OffscreenPriority.

useSyncScheduling takes precedence.
2017-03-01 10:56:31 -08:00
Andrew Clark
4ef197b7d4 Check if we're in sync mode before deprioritizing hidden subtrees 2017-03-01 10:56:31 -08:00
Andrew Clark
81eef12507 Test that hidden subtrees render/update synchronously
When useSyncScheduling is set to true (as it is in the DOM renderer),
we shouldn't give OffscreenPriority to hidden subtrees. Everything
should be sync/task.
2017-03-01 10:56:31 -08:00
Andrew Clark
0585ee8b22 Merge pull request #9082 from acdlite/nobooleanorstringconstructors
Enforce no boolean or string constructors
2017-03-01 10:55:42 -08:00
Dominic Gannaway
18b86bc9d8 Merge pull request #9080 from trueadm/remove-stack-dependencies-from-tests
[Fiber] Remove stack dependencies from tests
2017-03-01 18:24:10 +00:00
Fokke Zandbergen
8eb7068364 Square renders button, not div (#9084) 2017-03-01 09:40:45 -06:00
Dominic Gannaway
8bc11649df Merge branch 'master' into remove-stack-dependencies-from-tests 2017-03-01 12:32:36 +00:00
Andrew Clark
b963396c61 Run test script 2017-02-28 18:57:06 -08:00
Andrew Clark
7d5cc2eee3 Add test for no-primitive-constructors rule 2017-02-28 18:57:06 -08:00
Andrew Clark
2f63b0d6c9 Add error for number constructor, too 2017-02-28 18:57:06 -08:00
Andrew Clark
b9c96cfc73 Add caveat about symbols to string error message 2017-02-28 18:57:06 -08:00
Andrew Clark
6ac5fd3c2b Rename rule to no-primitive-constructors 2017-02-28 18:57:06 -08:00
Andrew Clark
1e9812e31b Convert usage of String and Boolean constructors 2017-02-28 18:56:57 -08:00
Sebastian Markbåge
e452e33741 providesModule -> explicit requires for cross-package dependencies (#9078)
* Add forwarding modules

* Codemod to use full package path outside of own package

Files that require modules from a different package than their own now
does so by the npm path name instead of the providesModule.

* Codemod fbjs module dependencies

* Fix gulp module mapping config

This is a bit lame but because of our module rewrite we need to white
list all the paths that we don't *don't* want to rewrite.
2017-02-28 18:42:52 -08:00
Andrew Clark
5f92d28e52 New ESLint rule that warns against Boolean and String constructors 2017-02-28 13:04:33 -08:00
Ben Alpert
a269e7ec3f Enable react/jsx-space-before-closing rule (#9077)
We mostly do this but not 100%; I fixed the stragglers here with `./node_modules/.bin/eslint --fix src` and enabled the lint rule.
2017-02-28 09:03:08 -08:00
Dominic Gannaway
d2944bb5bf updates test-failing and tests-passing 2017-02-28 15:02:48 +00:00
Dominic Gannaway
04cd2b2a81 refactors/removes stack dependent tests to work with fiber 2017-02-28 15:00:42 +00:00
Sebastian Markbåge
e35724a03d Move webcomponents.js polyfill to mocks (#8993)
* Move webcomponents.js polyfill to mocks

I'd like to move it out of shared to make it easier to sync this to RN.
Since this is only used for testing and a polyfill is essentially a mock.
Maybe this makes sense?

Rename to camel case to be consistent with providesModule.

* Update path to ignore in configs
2017-02-27 18:35:05 -08:00
Brian Vaughn
f923adb585 Pass component stack to error boundary handler (#9073)
This information is probably more useful for custom redbox components than the call stack info we are already passing.
2017-02-27 16:53:17 -08:00
Bernard Lin
fe46def5e2 Updated Chain React (#9067)
Changed conference date from "Summer 2017" to given date on website
2017-02-27 09:53:47 -06:00
Andrew Clark
07dc04d9f4 Merge pull request #8961 from acdlite/fiberbreakonuncaught
[Fiber] Preserve "Break on all/uncaught exceptions" behavior in DEV mode
2017-02-24 16:21:35 -08:00
Andrew Clark
2c59713f71 Remove invokeGuardedCallbackProd
We weren't using it anywhere except for the test suite. Instead, we can
change the environment flag and run the tests in both environments.
2017-02-24 16:19:29 -08:00
Andrew Clark
7e348acab7 Use invokeGuardedCallback in place of Fiber try-catch blocks
Only in DEV. In production, continue using a local try-catch.
2017-02-24 15:49:33 -08:00
Andrew Clark
13d4574228 invokeGuardedCallback should work when nested
Added a guard in the global error event listener to prevent nested
errors from being captured higher up the stack.

Also found a bug where the DEV version of invokeGuardedCallback would
infinite loop if there were nested invocations with the same name. Fixed
by appending the depth to the fake event name. (I'm actually not sure
why this is necessary.)
2017-02-24 15:49:33 -08:00
Andrew Clark
0304008a65 invokeGuardedCallback returns a thrown error
We can use this more flexible version for error handling in Fiber.

The DEV mode version uses same fake event trick as before to preserve
"break on uncaught exception" behavior when debugging.
2017-02-24 15:49:33 -08:00
Ben Alpert
0934ab948d Flatten Text children before rendering (#9063)
From FB-internal D4613844.
2017-02-24 13:40:08 -08:00
Andrew Clark
bc86ac4380 Merge pull request #8950 from acdlite/fibercompositecomponenttests
[Fiber] ReactCompositeComponent-test.js
2017-02-24 11:17:19 -08:00
Andrew Clark
393cdbc745 Consolidate ReactCurrentFiber and ReactDebugLifeCycle 2017-02-24 11:16:58 -08:00
Andrew Clark
d2c28be69b Use ReactDebugLifeCycle to track if we're inside getChildContext 2017-02-24 11:02:21 -08:00
Andrew Clark
309dea5b4c Track which lifecycle method we're in during DEV
Use this to detect setState inside of render instead of relying on
the owner.
2017-02-24 11:02:21 -08:00
Andrew Clark
ebfde985d9 Warn about nested renders 2017-02-24 11:02:21 -08:00
Andrew Clark
75ee3c1424 Warn about setState inside getChildContext
Stack uses a module called ReactInvalidSetStateWarningHook, but all it
does is warn about setState inside getChildContext. Doesn't seem worth
keeping around, so I didn't use it for Fiber, but if I'm mistaken I'll
change it.
2017-02-24 11:02:21 -08:00
Andrew Clark
2f3df5f0b3 Warn about setState in render 2017-02-24 11:02:21 -08:00
Andrew Clark
769c6e0ebe Merge pull request #9060 from acdlite/fixrecordtestsscript
Fix record-tests script
2017-02-24 10:59:44 -08:00
Andrew Clark
3bdc6d0c8e Fix record-tests script
Result of readConfig changed slightly in Jest 0.19.
2017-02-24 10:46:49 -08:00
Andrew Clark
1ae7436d01 Merge pull request #9058 from nihgwu/patch-1
fix version
2017-02-24 10:10:11 -08:00
Neo
18229fdeda fix version
per ca4325e3ef (commitcomment-21033948)
2017-02-24 17:35:27 +08:00
Andrew Clark
ca4325e3ef 16.0.0-alpha.3 2017-02-23 15:36:08 -08:00
Andrew Clark
18217cfede Merge pull request #9054 from acdlite/fiberpreventextensions
[Fiber] Prevent extensions to fiber in DEV
2017-02-23 14:42:16 -08:00
Andrew Clark
f3c2d9f308 Merge pull request #9004 from acdlite/proptypescheck
API for checking external objects against React prop types
2017-02-23 14:37:19 -08:00
Maxwel D'souza
b81175d37a Removed unnecessary if (#9031) 2017-02-23 15:14:21 -06:00
mdogadailo
49840f2e6b Missing onLoad and onError events on image tag (#9042) 2017-02-23 15:05:38 -06:00
Dai Nguyen
d724aed404 Update tutorial.md (#9051) 2017-02-23 14:54:03 -06:00
Andrew Clark
ddf59c403a Prevent extensions to fiber in DEV
Helps us avoid accidentally adding fields to the fiber class
2017-02-23 11:23:44 -08:00
Andrew Clark
03ed3437c9 Fix build config
ReactDebugCurrentFrame is shared state.

checkPropTypes should be imported via the main React export,
not imported directly.
2017-02-23 11:14:15 -08:00
Andrew Clark
0320b8ecb4 Wrap checkPropTypes in DEV conditional so it's stripped out in prod 2017-02-23 11:14:15 -08:00
Andrew Clark
e6d6ad3e88 Remove closure in checkReactTypeSpec by tracking stack info globally
There's a lot of overlap between ReactCurrentOwner,
ReactDebugCurrentFrame, and ReactDebugCurrentFiber that should
be consolidated.
2017-02-23 11:14:14 -08:00
Andrew Clark
9993fdd957 Change formatMessage parameter to getStack
Gives us flexibility in the future to deal with the stack and the
message separately.
2017-02-23 11:14:14 -08:00
Andrew Clark
6ff5211dee Remove warnOnRepeat option
Don't need this internally; doubt external users will need it either
2017-02-23 11:14:14 -08:00
Andrew Clark
3746a9dafb Invert dependency between checkPropTypes and checkReactTypeSpec
Expressing checkReactTypeSpec using the public API frees us to move it
to a separate module in the future.
2017-02-23 11:14:14 -08:00
Andrew Clark
e4acd12a9b Test that checkPropTypes does not throw or return a value 2017-02-23 11:14:14 -08:00
Andrew Clark
600685bdef Add PropTypes.checkPropTypes API
Allows users to check arbitrary objects against React prop types without
relying on the implementation details of the prop validators themselves.
An example of why this is important: some prop validators may throw,
while others return an error object. Calling a prop validator manually
requires handling both cases. `checkPropTypes` does this for you.
2017-02-23 11:14:14 -08:00
Andrew Clark
bef723e47f Remove ReactPropTypeLocationNames module
ReactPropTypeLocationNames was a map of location identifiers to location
display names, for use in warnings. But in practice, this did nothing
except rename "childContext" to "child context." Not worth it, IMO.

Since we are going to add an API for running prop type checks manually,
we need the ability to support arbitrary prop type locations. So
each place that used to accept a ReactPropTypeLocation now just accepts
a string.
2017-02-23 11:14:14 -08:00
Dominic Gannaway
91e8081cf0 Merge pull request #9045 from trueadm/emptyObject-reference-mismatch-due-to-mocking
[Fiber] fix ensure class components refs get re-assigned to emptyObject on mount
2017-02-23 15:38:10 +00:00
Dominic Gannaway
23f245173a Merge pull request #9043 from trueadm/fix-fiber-functional-componment-childcontext
[Fiber] adds `childContextTypes` warnings for functional components
2017-02-23 15:37:48 +00:00
Dominic Gannaway
bde5df1d76 addressed code in feedback 2017-02-23 15:37:19 +00:00
Dominic Gannaway
a99d77e073 added a regression test for factory components 2017-02-23 14:00:02 +00:00
Dominic Gannaway
925743bfc9 reverted ReactDOMFeatureFlags 2017-02-23 13:40:16 +00:00
Dominic Gannaway
e7d7809eb1 reverted the getChildContext warning from showing on functional components in Fiber 2017-02-23 13:39:08 +00:00
Dominic Gannaway
25f4abc9d5 mountClassInstance() now re-assigns instance.refs to emptyObject 2017-02-23 12:58:37 +00:00
Dominic Gannaway
a749083b85 fixed comment that was incorrect 2017-02-23 12:42:21 +00:00
Dominic Gannaway
724ae9b35a reverts previous changes to inlining requires and fixes test suite instead 2017-02-23 12:31:58 +00:00
Ben Alpert
5f6f3277f5 Add test for hack to stop bubbling (#8922) 2017-02-22 14:02:10 -08:00
Ben Alpert
9503abe5c7 Pass errorBoundary to logCapturedError (#9050) 2017-02-22 13:06:49 -08:00
Andrew Clark
2081a0053a Merge pull request #8949 from acdlite/fibercomponentlifecycletests
[Fiber] Component lifecycle tests
2017-02-22 12:54:42 -08:00
Brian Vaughn
a44a5d68d8 Fix bugs that occur when event responder unmounts during a touch event sequence
> This PR adds a test (initially failing) for this case along with a fix for stack and fiber. The stack fix was copied from a Diff submitted by @sema. The fiber fix just required us to stop leaking properties for unmounted views.
> Longer term we may want to explicitly invoke a release event listener for a responder just before unmounting it. This PR does not do that.
2017-02-22 12:47:34 -08:00
Andrew Clark
42c375b136 Merge pull request #9040 from acdlite/assignstateincwrp
Support for assigning to this.state inside componentWillReceiveProps
2017-02-22 12:45:58 -08:00
Stephie
5cc2a4fe3e Fixed typo: "Calcutor" to "Calculator" (#9047) 2017-02-22 17:37:55 +00:00
Dan Abramov
55f18f20ea Update Fiber debugger deps 2017-02-22 17:20:53 +00:00
Michał Pierzchała
67c1fde70e Upgrade Jest to v19 (#9034) 2017-02-22 16:59:18 +00:00
Dominic Gannaway
b8cf75a5b4 updated tests-failing and test-passing 2017-02-22 16:16:21 +00:00
Dominic Gannaway
3a7d6f5384 moved require(emptyObject) to inline calls to get around referential mismatch
Due to how Jest and other mocking libraries work in userland, modules that are required might not be referentially equal at various stages of the application lifecycle. This isnt a perfect fix, but by having the require calls inline, it has a better liklihood of ensuring emptyObject is the same reference
2017-02-22 16:12:51 +00:00
Dominic Gannaway
a9325e2ec4 adds childContextTypes warnings for functional components
ReactStatelessComponent-test.js fails due to warnings not showing up when functional components mount or update. This PR ports the existing warnings from stack and re-applies them to fiber functional components and attempts to re-use some logic in ReactFiberContext that currently exists for showing warnings when dealing with class components.
2017-02-22 14:21:10 +00:00
Andrew Clark
d649ebc6e1 Test should ensure that update is applied before corresponding render
Tightens up the test a bit to prevent regressions.
2017-02-21 16:47:25 -08:00
Brian Vaughn
3d44a6a486 Improved stack/fiber type-check to avoid false negative match when inst._rootNodeID is 0 2017-02-21 15:14:18 -08:00
Andrew Clark
28dbbe5734 Run test script 2017-02-21 14:43:01 -08:00
Andrew Clark
d3cbbe3b36 Add deprecation warning for assigning to this.state inside cWRP
We'll remove support for this in a future release, though we'll likely
still warn.
2017-02-21 14:42:12 -08:00
Andrew Clark
adc1641fec Should be able to setState inside cWRP before assigning to this.state
...without dropping the update. This won't work the other way around,
if you assign to this.state before calling setState. we'll add a
deprecation warning so people stop relying on this pattern.
2017-02-21 14:40:56 -08:00
Andrew Clark
d98a3d9269 Support assigning directly to this.state inside cWRP
We don't explicitly support this but it happens to work in Stack. We'll
give it the same semantics as replaceState.
2017-02-21 14:29:30 -08:00
Dan Abramov
51733c9a36 Add more details to the doc 2017-02-19 12:07:54 +00:00
Dan Abramov
6d6211f526 Doc consistency tweaks 2017-02-19 11:58:42 +00:00
Roman Matusevich
d28264e689 Remove extra article from documentation (#9028) 2017-02-19 11:10:50 +00:00
DanZeuss
fc362bf095 Improved for a better understanding (#8970)
* Improved for a better understanding

that code shouldn't name this parameter onchange. It is so confusing for a starter of ReactJs like me. It looks like that the onChange is an common event from props.

* Update the lifting state up paragraph

I tried to write something to explain to starter programmers in react, how we lift the state up calling a method defined by the ancestor and called by the children that will affect the children element.

* Rewrite Lifting State Up
2017-02-19 02:21:05 +00:00
Ben Alpert
bc2702f8bd Fix Fiber devtools prod (#9019) 2017-02-16 18:00:49 -08:00
Dimzel Sobolev
764531d53a Switch to shipping Fiber in npm packages (#9015) 2017-02-16 15:42:04 +00:00
Ben Alpert
d20dea1de2 Update to babel-plugin-transform-es2015-block-scoping 6.23 (#9002)
Now we won't add closures unnecessarily. I verified that we have no code that throws -- adding some then running `grunt build:modules` correctly throws.
2017-02-14 11:24:01 -08:00
Sebastian Markbåge
66bae80b08 Move validation calls behind DEV blocks (#8999)
This was done for Fiber but not Stack, causing these to throw in prod.
2017-02-14 11:10:59 -08:00
Sebastian Markbåge
5a1e30a868 Ignore events on text nodes (#9000)
In React Native events can fire on text nodes (on Android at least).

In that case, the current element will be a string and not props. These
can not have event handlers on them so we need to bail out so that
we don't throw later on.
2017-02-14 11:08:29 -08:00
Dan Abramov
7bdc189147 Revert "update react perf docs (#8060) and (#6174)" (#8997) 2017-02-13 23:43:08 +00:00
Toru Kobayashi
080f21e64f Remove an unnecessary condition 2017-02-13 15:36:13 -08:00
Dan Abramov
2464cd2d53 Update Thinking in React embed to match the link (#8996) 2017-02-13 23:25:47 +00:00
Brandon Dail
1ccb9361fe Revert "Revert "Missing a space for error 125"" (#8995) 2017-02-13 23:15:08 +00:00
Dan Abramov
c906fecd26 Revert "Missing a space for error 125" (#8994) 2017-02-13 23:11:05 +00:00
Ben Alpert
1e722e4a97 Check alternate in ReactTreeTraversal (#8992)
Test Plan: Couldn't figure out how to write a unit test. :\ Verified that enter/leave bubbling now works correctly in one FB interface that was broken though.
2017-02-13 14:24:44 -08:00
Phil Rajchgot
6367f9fbf3 Missing a space for error 125 (#8981) 2017-02-13 16:21:15 -06:00
Sean Gransee
c16ec5df13 fix misspellings in comments and tests (#8946)
* fix misspellings in comments and tests

* revert change in docs/js/react-dom.js
2017-02-13 16:01:54 -06:00
Sebastian Markbåge
890d52bafc Move ReactElementType to shared (#8991)
This is currently used by both isomorphic and the renderer. I think that
we can probably split these up. The isomorphic type should actually be
different. It has to do with that the caller needs to know exactly which
type of element it is but this is never needed in the renderer which only
needs to know that the type is internally consistent.

The owner type is renderer dependent so it can literally be anything.
2017-02-13 13:54:40 -08:00
Dan Abramov
4a05f268c8 Revert "Fix createNodeMock doc to avoid Invariant Violation" (#8990) 2017-02-13 20:15:49 +00:00
Andrew Clark
5ee033e40b Merge pull request #8974 from acdlite/fibercallbackvalidation
[Fiber] Move callback validation to top level
2017-02-13 12:15:42 -08:00
Andrew Clark
ea2ade251f Don't pass method names in production
Requires us to make the error message a bit more generic.
2017-02-13 12:13:50 -08:00
BDav24
00092957b6 Fix createNodeMock doc to avoid Invariant Violation (#8989) 2017-02-13 20:13:31 +00:00
Andrew Clark
d3aeca1ff8 Validate callbacks just before they are invoked
This delays the type check until the point when the engine will have to
perform a type check regardless.

Because the error is now thrown during the commit phase rather than
when the callback is originally scheduled, we warn in DEV when
scheduling so it's easier to track down.
2017-02-13 12:12:44 -08:00
Andrew Clark
662170673f Merge pull request #8978 from acdlite/nooptionaltypes
[Fiber] Use `T | null` instead of `?T` types
2017-02-13 11:20:58 -08:00
Jiminikiz
7958c1d77d Fixing grammatical error ... (#8987)
... in the Create React App section.
2017-02-13 10:04:09 -08:00
Prayag Verma
c60f852cdb Fix a typo in design principles doc (#8985)
unambigious → unambiguous
2017-02-13 15:09:00 +00:00
Andrew Clark
350d736361 Use T | null instead of ?T types
Flow maybe types accept both null and undefined. When the final
parameter of a function accepts a maybe type, passing nothing
(undefined) successfully typechecks, which can lead to bugs if the
omission is accidental. Being forced to pass null is harder to screw up.

Explicit null checks are also faster.
2017-02-10 17:30:09 -08:00
Toru Kobayashi
77c7792556 Remove React.__spread 2017-02-10 12:27:02 -08:00
Moacir Rosa
de673bca8d Only fix a small wrong key in example (#8976)
Only fix a small wrong key in example
2017-02-10 15:40:24 +00:00
Brian Vaughn
2e095b4140 Hardened validateCallback to better handle null values (#8973)
Previously, calls to validateCallback() with a null callback value resulted in runtime errors if a certain transform was not applied prior to running. This commit wraps the invariant() with the condition check so as to avoid calling formatUnexpectedArgument() unless necessary. It also replaces the truthy/falsy callback check with an explicit check for improved performance.
2017-02-09 14:10:45 -10:00
Leland Richardson
869c779861 Add toTree() method to stack and fiber TestRenderer (#8931)
* Add toTree() method to stack and fiber TestRenderer

* Address PR feedback

* Refactor TestRenderer to use correct root

* Rebase off master and fix root node references

* Add flow types

* Add test for null rendering components

* Remove last remaining lint error

* Add missing test
2017-02-09 20:55:00 +00:00
Dan Abramov
3f48caab40 Fix release guide again 2017-02-09 16:15:04 +00:00
Dan Abramov
6cfc0ecd72 Fix release guide 2017-02-09 16:14:27 +00:00
Dan Abramov
c11733dfb7 Update Yarn lockfile with fresh deps 2017-02-09 16:10:35 +00:00
Dan Abramov
c7ebe88c2a 16.0.0-alpha.2 2017-02-09 16:07:56 +00:00
Brian Vaughn
df13eb354e Fixed lint warning in master (#8960) 2017-02-09 16:02:47 +00:00
Sebastian Markbåge
741d9b2db9 Move React Native Environment Mocks to root (#8963)
These mocks are things we expect to be available in the React Native
environment. I'd like to move them out of the renderer folder so that we
can sync that folder to React Native as is without overriding its mocks.

I motivate by the fact that they're not really part of the renderer code
itself. I leave the ReactNative mock since that is in fact part of the
renderer.
2017-02-09 16:02:09 +00:00
Sebastian Markbåge
13e05b4237 Use separate feature flag for ReactTestRenderer (#8965)
The ReactDOMFeatureFlags is not reachable from the npm package since it is
in a separate build so we need a separate one.
2017-02-09 16:00:59 +00:00
Brian Vaughn
ab757e905c Fixed ReactNativeFiber event handling regression (#8959)
* Fixed ReactNativeFiber event system regression introduced in b354db2
Also added test coverage to ReactNativeEvents-test for Fiber

* ReactNative tests now run against fiber renderer when env flag set
Updated the test-framework-setup file so that record-tests runs native tests against ReactNativeFiber. ReactComponentTreeHook native tests all now fail but that's expected.

* Avoid calling setChildren() if no children
2017-02-08 21:28:56 -10:00
Sebastian Markbåge
81bd138144 findNodeHandle -> ReactNative.findNodeHandle (#8962)
Submitted this internally already.

Needed because people import this file directly and they might not have the renderer inject the findNodeHandle handler yet.
2017-02-08 17:13:33 -08:00
Andrew Clark
9b7dc4036c Merge pull request #8948 from acdlite/fiberdonttesthostcleanup
[Fiber] Don't test input value clean-up in Fiber
2017-02-08 15:33:20 -08:00
Andrew Clark
5b181a696e Make Stack error message more generic, too
We want to avoid passing around caller names because stripping them
out in production complicates the code for little benefit.
2017-02-08 11:43:53 -08:00
Andrew Clark
e9aca8e389 Warn about calling setState on an unmounted component 2017-02-08 11:23:58 -08:00
Andrew Clark
3955e222d2 Use isMounted instead of instance map to check if mounted 2017-02-08 10:33:00 -08:00
Andrew Clark
76a168fed6 Warn if findDOMNode is used inside render
Need to reset current owner to null before committing
2017-02-08 10:32:14 -08:00
Andrew Clark
4d52ebc066 Warn about isMounted inside render 2017-02-08 10:31:30 -08:00
Andrew Clark
f4cabafc8d Don't test input value clean-up in Fiber
Fiber doesn't clean up host components; relies on GC.
2017-02-08 10:26:47 -08:00
Sebastian Markbåge
b187142103 Move DOM dependent tests out of the shared folder (#8954)
We have a bunch of tests that are meant to test generic React behavior.
However, we've written the tests against the DOM renderer. This moves
tests that depend on ReactDOM or ReactTestUtils out of the shared repo.

This will let us sync the shared repo directly to environments that don't
support running these tests. Such as React Native.
2017-02-08 10:20:02 -08:00
Dan Abramov
1d90894f93 Re-add the warning if PropType function is called manually (#8903)
* Revert "Revert "Warn if PropType function is called manually (#7132)""

This reverts commit be71f76ed8b7dbad25e3519455605252d3daf683.

In other words, now we again have the warning if you attempt to call PropTypes manually.
It was removed in #8066 but we shouldn't have done this since we still want to avoid people accidentally calling them in production (and even more so since now it would throw).

Fixes #8080.

* Pass secret in ReactControlledValuePropTypes

* Record tests
2017-02-08 16:29:19 +00:00
Dhyey Thakore
994a0c8b0c update react perf docs (#8060) and (#6174) (#8236)
* update react perf docs issue 8060 and 6174

* Grammar

Small stuff
2017-02-07 14:00:08 -08:00
Dan Abramov
e280f5a1a7 Fix lint (#8945) 2017-02-07 14:42:09 +00:00
Andrew Clark
5cfff8706e Merge pull request #8919 from acdlite/fibermounttests
[Fiber] Mount/unmount warnings and invariants
2017-02-06 18:00:50 -08:00
Andrew Clark
0564b08cf2 Split into multiple invariants
That way the messages are extracted by the error code transform.
2017-02-06 17:59:53 -08:00
Andrew Clark
23f9e7b8ad Merge pull request #8937 from acdlite/inlineinternalerrormessage
Inline internal error message
2017-02-06 17:44:26 -08:00
Andrew Clark
2c7c783498 Merge pull request #8936 from acdlite/removemapsaschildren
Remove experimental support for maps as children
2017-02-06 17:14:30 -08:00
Andrew Clark
14962f8b40 Continue warning if a Map is rendered as a child
The entries of a map are a two-element array of [key, value], which
React will treat as fragments with children. This is unlikely to ever
be the intended behavior, so we warn.
2017-02-06 17:07:19 -08:00
Andrew Clark
94e843955d Remove experimental support for maps as children 2017-02-06 15:51:19 -08:00
Andrew Clark
2e1b3aab91 Inline internal error message
So that it is stripped out by the error code transform
2017-02-06 15:43:47 -08:00
Andrew Clark
a2c49f48bf Merge pull request #8926 from acdlite/fiberuseinvariant
[Fiber] Replace `throw new Error` with invariant module
2017-02-06 14:49:14 -08:00
Andrew Clark
915a3e88a2 Add additional message to internal invariants
The message tells users that the error is likely due to a bug in React,
and that they should file an issue.
2017-02-06 14:43:57 -08:00
Andrew Clark
b338c75c28 Get rid of DEV only invariant 2017-02-06 14:43:22 -08:00
Andrew Clark
a1ef4c4391 Replace throw new Error with invariant module 2017-02-06 14:43:14 -08:00
Andrew Clark
9fcf761e90 Run test script 2017-02-06 14:22:27 -08:00
Andrew Clark
255e5aeb3e Rendering into an empty React-rendered element should not warn
Only warn if the container has a React-rendered child.
2017-02-06 14:22:16 -08:00
Sebastian Markbåge
e05f0a3a13 Only expose FiberRoot at the top level instead of a Fiber (#8934)
It is strange to get a handle on the Fiber since it is one of possibly two
root Fibers. The correct way to get the current Fiber is through the
root.current.

I exposed the Fiber originally because I thought we might use it for
Portals but we went with a different approach. So we don't need this.
2017-02-06 13:19:33 -08:00
Andrew Clark
b49611e643 Merge pull request #8927 from mitenka/patch-5
Update higher-order-components.md
2017-02-06 11:42:31 -08:00
Jon Bretman
afdf47f425 Bump fbjs to 0.8.9 (#8910) 2017-02-06 19:02:17 +00:00
Dan Abramov
fb1444c463 Inject DevTools integration for RN Fiber (#8930) 2017-02-06 17:36:59 +00:00
KB
d42c285aa2 [docs] Add note about refs on stateless components (#8916)
* Add note about refs on stateless components

* Move info about refs in the stateless components to the main section

* Simplification of the part about refs and functional components

* Tweaks

* Move sections around

* Oops

* Rearrange more sections
2017-02-06 16:49:36 +00:00
António Nuno Monteiro
4313059702 Change the order between function declaration and object assignment (#8895)
This fixes #8894
2017-02-06 16:02:13 +00:00
Dmitry Zhuravlev-Nevsky
1b69a79136 Update higher-order-components.md 2017-02-04 03:35:06 +03:00
Ben Alpert
fa1087b42c Ensure first error is thrown if HostRoot catches two errors in commit phase (#8923)
Previously, we were overwriting capturedErrors with the second error and throwing that one.
2017-02-03 11:12:28 -08:00
Diego Muracciole
ad133f5b3d Add onToggle event to details tag (#8831)
* Add onToggle event to details tag

Fixes #8761

* Map onToggle event on ReactDOMFiberComponent

* Tweak doc

* Trap events on setInitialProperties for details tag
2017-02-03 10:25:09 +00:00
Andrew Clark
269555e35c Merge pull request #8921 from facebook/revert-8907-fiberproderrorcode
Revert "Loosen assertion so it matches any production error"
2017-02-02 15:24:04 -08:00
Andrew Clark
bd3070f774 Revert change to test
See: https://github.com/facebook/react/pull/8907#issuecomment-277111278
2017-02-02 15:22:28 -08:00
Andrew Clark
57d2d6d77d Merge pull request #8907 from acdlite/fiberproderrorcode
Loosen assertion so it matches any production error
2017-02-02 14:42:23 -08:00
Andrew Clark
87bc7cef2c Warn if unmounting a tree that was rendered by a different copy of React 2017-02-02 14:30:12 -08:00
Dan Abramov
7e8068b984 Move component base classes into a single file (#8918) 2017-02-02 20:24:39 +00:00
Andrew Clark
f4823295af Warn when rendering into React-rendered child that isn't a root 2017-02-02 12:18:18 -08:00
Andrew Clark
d47c21589b Warn when mounting into document.body 2017-02-02 12:18:18 -08:00
Andrew Clark
822587ea06 Add extra invalid element info to invariant message 2017-02-02 12:18:18 -08:00
Andrew Clark
ea2aa6e613 Fix messages so that they use the same template as Stack
The production error code system depends on the exact template string
that is passed to `invariant`. This changes the Fiber templates to
match the Stack ones.
2017-02-02 12:05:00 -08:00
Andrew Clark
02edc6bf18 Loosen assertion so it matches any production error
The exact error code isn't important.
2017-02-02 11:17:56 -08:00
Pontus Abrahamsson
55a18bca64 Update conferences.md (#8915)
* Update conferences.md

* Move confs around
2017-02-02 13:37:27 +00:00
Omid Hezaveh
79be3543dd Explain arbitrariness of ref name in callback (#8913)
* Explain arbitrariness of ref name in callback 

The sample code was confusing because it's not clear that "textInput" in this.textInput is an arbitrary name for the ref.

* Tweak wording
2017-02-02 13:33:12 +00:00
Dan Abramov
9e3a31b2c6 Fix indentation in tutorial (#8914) 2017-02-02 13:24:26 +00:00
Eduard
dc04ee87ae Update tutorial.md (#8896)
* Update tutorial.md

The status <div> used in Board can be deleted as well from render.

* Little tweaks
2017-02-01 18:12:00 -08:00
Tiago Fernandez
05f5bf6eb6 Link to CodePen editor rather than final result (#8849)
People want to see the final JS/CSS/HTML, and the final result is already displayed by CodePen.
2017-02-01 18:02:44 -08:00
Jeffrey Wan
3f5482ee20 Update tutorial.md (#8792)
* Update tutorial.md

* Fix quoting to be consistent
2017-02-01 17:42:19 -08:00
John Longanecker
b8f0522cc6 Lifting State Up more legible (#8691) 2017-02-01 17:31:01 -08:00
Andrew Clark
86fbb9d583 Merge pull request #8905 from acdlite/fiberfinddomnodeunmount
[Fiber] findDOMNode during componentWillUnmount
2017-01-31 16:05:05 -08:00
Andrew Clark
c158ff6179 Merge pull request #8908 from acdlite/fiberemptycomponent
[Fiber] Fix formatting of invalid element invariant
2017-01-31 16:03:54 -08:00
Andrew Clark
2afcf6e09f Fix formatting of invalid element invariant
Message is slightly different for functional and class components.
2017-01-31 15:29:53 -08:00
Andrew Clark
6545012af2 Merge pull request #8893 from gaearon/fix-dom-prod-test
Add process.cwd to the test process shim
2017-01-31 15:04:39 -08:00
Andrew Clark
10e5438422 Merge pull request #8906 from acdlite/warningnewline
Add missing newline to warning
2017-01-31 14:42:21 -08:00
Andrew Clark
6846ef9fb8 Add newline to warning 2017-01-31 14:41:14 -08:00
Andrew Clark
af7ae1be91 Don't swap the trees until after the first pass of the commit phase,
where componentWillUnmount is called, but before the second pass,
where componentDidMount/Update is called.
2017-01-31 14:39:52 -08:00
Andrew Clark
35ddd05da4 Merge pull request #8890 from acdlite/fiberfragmentinvariants
[Fiber] Throw on plain object children
2017-01-31 13:14:11 -08:00
Andrew Clark
73d27d755e Merge pull request #8897 from acdlite/fiberfixfinddomnode
[Fiber] Fix findDOMNode algorithm
2017-01-31 13:13:56 -08:00
Andrew Clark
2a0fb5b4aa Remove legacy React element warning 2017-01-31 11:46:30 -08:00
Andrew Clark
17ec96b014 Run test script 2017-01-31 11:44:35 -08:00
Andrew Clark
7daa90206d Add missing portal case to updateSlot switch statement 2017-01-31 11:44:35 -08:00
Andrew Clark
7af673afc1 Allow object as textarea child
Preserves Stack behavior. There's already a warning for this.
2017-01-31 11:44:35 -08:00
Andrew Clark
802c820545 Fallback to owner of returnFiber
Won't work if the returnFiber is a fragment. Not sure it matters;
warning will just be less descriptive.
2017-01-31 11:44:35 -08:00
Andrew Clark
3089db94ce Throw on invalid object type children
Same behavior as Stack
2017-01-31 11:44:30 -08:00
Andrew Clark
ba5b9c0af3 Add invariant
Defensive coding to prevent an infinite loop.
2017-01-31 11:35:10 -08:00
Dan Abramov
ea9e1575b7 Suppress lint warnings
Using [] is intentional because we don't want to trigger Babel plugin.
2017-01-31 19:30:26 +00:00
Andrew Clark
97f6786cba Fix findDOMNode algorithm 2017-01-31 10:24:03 -08:00
Dan Abramov
d6d129a1b2 Reassign process.env.NODE_ENV instead of shimming process 2017-01-31 16:28:20 +00:00
Marius Skaar Ludvigsen
d8450845fe #6049 add support for onCancel and onClose event (#6247) 2017-01-31 08:10:48 -06:00
Richie Thomas
469e68542b Added double newline delimiters to the following functions/files: (#8777)
* 'beginLifeCycleTimer' function of ReactDebugTool.js
            * 'bindAutoBindMethod' function of ReactClass.js
            * 'warnNoop' function of ReactServerUpdateQueue.js
            * 'getInternalInstanceReadyForUpdate' function of ReactUpdateQueue.js
            * 'warnNoop' function of ReactNoopUpdateQueue.js
            * 'getDeclarationErrorAddendum' function of ReactDOMComponent.js
            * 'getSourceInfoErrorAddendum' function of ReactElementValidator.js
            * 'getDeclarationErrorAddendum' function of instantiateReactComponent.js and ReactElementValidator.js
            * 'traverseAllChildrenImpl' function of traverseAllChildren.js
            * 'attachRef' function of ReactRef.js
            * 'mountIndeterminateComponent' function of ReactFiberBeginWork.js
            * 'createFiberFromElementType' function of ReactFiber.js
            * 'getDeclarationErrorAddendum' function of ReactDOMSelect.js
            * 'unmountComponentAtNode' function of ReactMount.js
            * 'getDeclarationErrorAddendum' function of ReactControlledValuePropTypes.js
            * 'checkRenderMessage' function of CSSPropertyOperations.js
            * 'getDeclarationErrorAddendum' function of ReactDomFiberSelect.js
            * 'getCurrentComponentErrorInfo' function in 'ReactElementValidator'
            * 'getDeclarationErrorAddendum' function in ReactDOMFiberComponent.js
2017-01-31 07:41:24 -06:00
Vladimir Kovpak
8bc5a87d04 Added undefined example (#8899)
Into section `Booleans, Null, and Undefined Are Ignored` I've added example with undefined.
2017-01-31 07:24:29 -06:00
Ben Alpert
64a47e9fb4 Don't crash Fiber with old devtools (#8900)
Typo.
2017-01-31 13:06:53 +00:00
Roman Liutikov
59aac010dd refer to object by name instead of function call context (#8892) 2017-01-30 18:32:26 -06:00
Senin Roman
466bb4ffb9 Fix incorrect markup for ie10 (#8886) 2017-01-30 18:32:07 -06:00
Dan Abramov
3195bcdbcb Add process.cwd to the test process shim 2017-01-30 21:48:05 +00:00
Maksim Shastsel
ec936dd848 Delete @nosideeffect annotation (#8882) 2017-01-30 21:42:17 +00:00
Dan Abramov
fb4c08baee Fix lint (#8888) 2017-01-30 17:46:07 +00:00
MICHAEL JACKSON
564fa64626 Update context example for react-router v4 beta (#8889)
* Update context example for react-router@4.0.0-beta.1

* Style nits
2017-01-30 17:36:47 +00:00
Dan Abramov
d8491ca73f Declare __REACT_DEVTOOLS_GLOBAL_HOOK__ for Flow (#8884) 2017-01-30 14:14:30 +00:00
Zac Braddy
cae2a6f9d3 Got rid of linting errors on windows machines and a number of linting warnings. (#8846) 2017-01-28 15:36:03 -08:00
Frank Yan
751d221172 Fix typo in EventPropagators.js (#8879) 2017-01-27 18:36:21 -06:00
Dan Abramov
d3e29d4e54 [Fiber] Support React DevTools (#8818)
* Initial React DevTools support for Fiber

* Record a newly failing irrelevant test

This is fine because we don't use it in Stack anyway (at least not that part), and we also rely on Set/Map in other parts of code.
The newly failing test is the one saying "it works without Map/Set".

* Explicitly check for Fiber DevTools support

This lets us ignore pre-Fiber DevTools instead of crashing them by injecting a different API.

* Track the roots in DevTools instead

* Lol Dan this is not how warnings work in our codebase

* Move injection to the renderer

* Notify DevTools about unmounts

* Make it work in production

* Fix lint and flow

* Fixups

* Address feedback
2017-01-27 22:50:35 +00:00
Paul O’Shannessy
3c75593692 [examples] Use react-standalone (#7669)
[examples] Use babel-standalone
2017-01-26 11:57:01 -06:00
Sebastian Markbåge
b26265718a Merge pull request #8840 from sebmarkbage/statelesscoroutines
[Fiber] Simplify coroutines by making yields stateless
2017-01-26 07:15:36 -08:00
Mitchel Humpherys
39472f1c3e installation.md: Add missing "as" (#8871) 2017-01-25 23:33:49 -06:00
Sebastian Markbåge
3f409df468 ReactElement is private to isomorphic React (#8868)
This fixes the build since this dependency is not reachable from React DOM.
2017-01-25 17:52:45 -08:00
Sebastian Markbage
975ad92e68 Don't bail to .child of coroutines
This should bail to stateNode instead.
2017-01-25 17:50:21 -08:00
Sebastian Markbage
754f72a175 Don't visit siblings of the coroutine when looking for yields
When visiting the yields, the root is the stateNode of the coroutine. If
its return value is wrong we'll end up at the alternate of the
workInProgress which will start scanning its children which is wrong.
2017-01-25 17:36:20 -08:00
Sebastian Markbage
e8500fb1c2 Add failing tests for coroutines
There are a few different issues:

* Updates result in unnecessary duplicate placements because it can't find the current fiber for continuations.
* When run together, coroutine update and unmounting tests appear to lock down in an infinite loop. They don't freeze in isolation.

I don't have a solution for this but just leaving it for future fixes.
2017-01-25 15:41:48 -08:00
Sebastian Markbage
fd8d5f7a8a Simplify coroutines by making yields stateless
Coroutines was kind of broken because it tried to do reparenting and
enabling state preservation to be passed along the coroutine. However,
since we couldn't determine which Fiber was "current" on a reified yield
this was kind of broken.

This removes the "continuation" part of yields so they're basically just
return values. It is still possible to do continuations by just passing
simple functions or classes as part of the return value but they're not
stateful.

This means that we won't have reparenting, but I actually don't think we
need it. There's another way to structure this by doing all the state in
the first phase and then yielding a stateless representation of the result.
This stateless representation of the tree can then be rendered in different
(or even multiple) locations.

Because we no longer have a stateful continuation, you may have noticed
that this really no longer represent the "coroutine" concept. I will
rename it in a follow up commit.
2017-01-25 15:41:47 -08:00
Sebastian Markbage
648d6e190c Swap .child and .stateNode in coroutines
It is slightly more useful this way because when we want to find host nodes
we typically want to do so in the second phase. That's the real tree where
as the first phase is more of a virtual part of the tree.
2017-01-25 15:41:47 -08:00
Brian Vaughn
88b6175cb1 Bumping package.json versions from 16.0.0-alpha.0 to 16.0.0-alpha.1 2017-01-25 12:14:00 -08:00
Andrew Clark
63edf30f5d Merge pull request #8797 from acdlite/fix-arrays
[Fiber] disableNewFiberFeatures bugfix: host component children arrays
2017-01-25 12:06:08 -08:00
Andrew Clark
ba1d3829bc Use multiple checks instead of forking the entire function
Easier to follow this way, and less chance the two paths will get
out of sync.
2017-01-25 12:05:32 -08:00
Andrew Clark
645ad6d261 Add test for mocked render functions
Treat them as if they return null
2017-01-25 11:52:48 -08:00
Andrew Clark
c0e5df66ec Make disableNewFiberFeatures = true the default when runnings tests
This exposed a few more cases that I missed.
2017-01-25 11:52:48 -08:00
Andrew Clark
5c4362dc5c Remove outdated TODO 2017-01-25 11:52:48 -08:00
Andrew Clark
1ac6be2677 Add test for iterables, too 2017-01-25 11:52:48 -08:00
Andrew Clark
16956ed640 disableNewFiberFeatures bugfix: host component children arrays 2017-01-25 11:52:48 -08:00
jddxf
a3ff8c3833 Improve tests (#8866)
* refactor one test suite to use jest's mock function

* keep the comment
2017-01-25 10:13:09 -06:00
Brandon Dail
2b113c527e Use correct optional paramater JSDoc syntax 2017-01-25 09:24:00 -06:00
lokson
facd67d000 [docs] forEachAccumulated params 2017-01-25 09:24:00 -06:00
Scott
4c6fec902f Add benchmarking tutorial (#8698)
* Add benchmarking tutorial

I've written what I hope is the simplest introduction to benchmarking React components. It's meant to be straightforward and easy to follow for beginners. If you agree that it would be helpful, I'd like to add it to the docs.
Would also welcome any and all feedback.

* Just put links together
2017-01-25 15:14:18 +00:00
Oscar Bolmsten
c2f94385a1 webpack 2 is now stable (#8859)
Remove notice about different webpack versions
Update webpack URLs
2017-01-25 14:56:52 +00:00
Edvin Erikson
0c7f21a705 Component -> Unknown (#8863)
Fix Flow issue and revert to showing "Unknown" in warnings for anonymous components
2017-01-25 14:49:19 +00:00
Edvin Erikson
5170db8e72 Remove unnecessary null (#8858)
* Remove unnecessary null

* always return string
2017-01-24 18:19:07 +00:00
Dan Abramov
7683211efd Fix Flow (#8857) 2017-01-24 13:45:49 +00:00
Brandon Dail
2be0583ed3 Update deprecation wording to be less aggressive 2017-01-24 00:18:23 -06:00
Brandon Dail
4bba89f047 Add deprecation tests to fiber test tracker 2017-01-24 00:18:23 -06:00
Brandon Dail
23deea0f02 Add test for deprecation warnings 2017-01-24 00:18:23 -06:00
Brandon Dail
2b7814f713 Deprecate React.createMixin
This API was never fully implemented. Since mixins are no longer considered part of the future React API, it will be removed.
2017-01-24 00:18:23 -06:00
Ben Alpert
046f7448d7 Two minor changes from internal (#8855) 2017-01-23 17:11:10 -08:00
Keyan Zhang
eb89bc4c30 Add a link to "State Updates are Merged" in the forms doc (#8851)
* Added a link to "State Updates are Merged"

* better inline links

* moved the explanation down

* Minor unrelated tweaks
2017-01-23 21:09:48 +01:00
mguidotto
b2b6d9daf7 Update conferences.md (#8841)
* Update conferences.md

* Update conferences.md

path fixed

* Changed capitalization to match the website and Twitter
2017-01-23 20:31:21 +01:00
OJ Kwon
f5662456e1 Update test setup Windows compatible (#8651)
- relates to #7849
2017-01-23 19:59:06 +01:00
Dan Abramov
ee6358bb7d Tweak RRM instructions to mention Yarn instead 2017-01-23 18:01:27 +00:00
Dan Abramov
beb2e0124d Clarify use of ES6 idiom in Forms doc 2017-01-23 17:59:44 +00:00
Justin Grant
fc302494b7 Reminder: strip quotes from attributes with JS code (#8806)
* Reminder: strip quotes from attributes with JS code

Web developers who are used to standards-compliant HTML and XML will, out of habit, put quotes around all attributes because the standards require them. Other templating systems like ASP.NET also require (or at least allow) quotes around attributes that contain code. This behavior will get users into trouble in JSX because a quoted attribute is always treated as a string literal, even if it contains curly-braced javascript code.  Let's add to the docs to help newbies evade this problem.

* Tweak wording
2017-01-23 18:09:35 +01:00
Ragnar Þór Valgeirsson
09b3ec5d3c Match eslint's line length settings (#8845) 2017-01-23 17:47:48 +01:00
SunHuawei
5494b267d9 Fix a typo (#8580) 2017-01-23 17:43:48 +01:00
Mark Pedrotti
f56cf66945 Replace 2 occurrences of string in type ReactTestRendererJSON (#8816)
* Replace 2 occurrences of string in type ReactTestRendererJSON

* restore string in ReactTestRendererFiber.js
2017-01-23 17:29:47 +01:00
Sebastian Markbåge
5659bd2a63 Polyfill requestIdleCallback when native is not available (#8833)
I introduce the ReactDOMFrameScheduling module which just exposes
rIC and rAF.

The polyfill works by scheduling a requestAnimationFrame, store the time
for the start of the frame, then schedule a postMessage which gets
scheduled after paint. The deadline is set to time + frame rate.
By separating the idle call into a separate event tick we ensure that
layout, paint and other browser work is counted against the available time.

The frame rate is dynamically adjusted by tracking the minimum time between
two rAF callbacks. This is not perfect because browsers can schedule
multiple callbacks to catch up after a long frame. To compensate for this
we only adjust if two consecutive periods are faster than normal.

This seems to guarantee that we will hit frame deadlines and we don't end
up dropping frames. However, there is still some lost time so we risk
starving by not having enough idle time.

Especially Firefox seems to have issues keeping up on the triangle demo
However, that is also true for native rIC in Firefox. It seems like more
render work is scheduled on the main thread pipeline and also that JS
execution just generally has more overhead.
2017-01-21 10:27:46 -08:00
Brian Vaughn
f546505e4e Support for ReactFeatureFlags.logTopLevelRenders timing (#8687)
Call `console.time` / `console.timeEnd` for the top level component when `ReactFeatureFlags.logTopLevelRenders` is enabled
2017-01-21 09:44:47 -08:00
Sebastian Markbåge
4f8c16a750 Read "current" props from the node instead of the Fiber (#8839)
It's not just events that read the current props. Controlled components
do as well. Since we're no longer updating the Fiber pointer during updates
we have to instead read from the node props to get the current props.

Since this method is no longer just used for events I renamed it.
2017-01-20 23:25:25 -08:00
EugeneGarbuzov
30c7c4fbe6 Corrected a typo. (#8837)
shoud -> should
2017-01-20 13:25:21 -06:00
Sebastian Markbåge
b354db22a9 [Fiber] Compute the Host Diff During Reconciliation (#8607)
* Allow renderers to return an update payload in prepareUpdate

This then gets stored on updateQueue so that the renderer doesn't need to
think about how to store this.

It then gets passed into commitUpdate during the commit phase.

This allows renderers to do the diffing during the time sliced path,
allocate a queue for changes and do only the absolute minimal work to
apply those changes in the commit phase.

If refs update we still schedule and update.

* Hack around the listener problem

* Diff ReactDOMFiber properties in prepareUpdate

We now take advantage of the new capability to diff properties early.
We do this by generating an update payload in the form of an array with
each property name and value that we're about to update.

* Add todo for handling wasCustomComponentTag

* Always force an update to wrapper components

Wrapper components have custom logic that gets applied at the commit phase
so we always need to ensure that we schedule an update for them.

* Remove rootContainerInstance from commitMount

No use case yet and I removed it from commitUpdate earlier.

* Use update signal object in test renderer

* Incorporate 8652 into new algorithm

* Fix comment

* Add failing test for flipping event handlers

This illustrates the problem that happens if we store a pointer to the
Fiber and then choose not to update that pointer when no properties change.
That causes an old Fiber to be retained on the DOM node. Then that Fiber
can be reused by the pooling mechanism which then will mutate that Fiber
with new event handlers, which makes them active before commit.

* Store current props in the RN instance cache and on the DOM node

This represents the current set of event listeners. By not relying on the
Fiber, it allows us to avoid doing any effects in the commit phase when
nothing changes.

This is a bit ugly. Not super happy how this all came together.
2017-01-19 21:56:15 -08:00
Dan Abramov
c6a7dc7f24 Preserve license headers from dependencies in minified build (#8803)
* Preserve license headers from dependencies in minified build

Fixes #8789.

* Bump minimal object-assign version
2017-01-20 02:29:06 +01:00
Keyan Zhang
06399b8ce3 Add "Handling Multiple Inputs" to Forms doc (#8552)
* added "Handling Multiple Inputs"

* renamed and added a codepen

* simplified the example
2017-01-17 22:19:46 -08:00
Brian Vaughn
16abcef937 Tweaked captured error log slightly based on feedback (#8785)
Tweaked captured error log slightly based on feedback. Normalized stack format/display for different browsers
2017-01-17 14:32:06 -08:00
Dan Abramov
935bdbec84 Ignore fixtures in Flow and ESLint 2017-01-17 19:26:27 +00:00
Rohan Nair
5d96162b57 Updating Thinking in React doc to replace refs with event handlers (#8815)
* Updating Thinking in React doc to replace refs

* Updating doc copy to reflect changes to example
2017-01-17 10:17:32 -08:00
Faheel Ahmad
c8a41672ed I -> we (#8817) 2017-01-17 10:01:40 -08:00
DQNEO
6308238498 use an easier word (#8809)
* use an easier word

The word `mandatory` is relatively difficult for people with ESL (English as a second language), so I propose an alternative word.
This would be much easier to understand.

* use simpler word
2017-01-17 10:00:11 -08:00
Jack Cross
bfd5b1878e Add Flow reminder to PR template (#8805)
* Added flow to PR template

* Added record-tests step to PR template and contribution docs

* Updated order of PR checks
2017-01-17 06:34:44 -08:00
Rich Harris
e69ff955f4 add docs for building with Rollup (#8799)
* add docs for building with Rollup

* Tiny unrelated fix
2017-01-17 05:55:49 -08:00
Toru Kobayashi
0758bb0035 Fix to work fiber debugger with npm start (#8811)
* FiberDebugger uses packages built in local

* Fix key warnings in FiberDebugger

* Remove react packages from package.json and yarn.lock for using pacakges built in local

* Remove fiber.js from `files` in package.json
2017-01-17 05:34:02 -08:00
Superlaziness
66540fdf16 fix HOC doc (#8802) 2017-01-16 06:49:01 -08:00
Tom Gasson
c77632791f Fix fiber/record-tests to work on windows (slash differences) (#8796) 2017-01-14 21:16:03 -06:00
Eric Churchill
cd4afca043 Add unit test to onlyChild to ensure onlyChild returns child element (#8667)
Add unit test to onlyChild to ensure onlyChild returns child element
2017-01-14 14:09:24 -08:00
Vladimir Tikunov
ebd83e809e Remove error ref to the 'render' function (#8781)
What is the `render` function of a functional component?
2017-01-14 13:36:55 -06:00
Dan Abramov
6a488913b9 [Fiber] Fix rendering SVG into non-React SVG tree (#8638)
* Add a test for rendering SVG into a non-React SVG tree

It is failing in Fiber.

* Add a test for rendering HTML into non-React foreignObject

It happens to pass in Fiber.

* Determine root namespace by container namespace, not just tag

A tag alone is not enough to determine the tree namespace.

* Skip the test that exhibits jsdom bug in non-createElement mode

jsdom doesn't give HTML namespace to foreignObject.innerHTML children.
This problem doesn't exist in the browsers.

https://github.com/facebook/react/pull/8638#issuecomment-269349642

We will skip this test in non-createElement mode considering
that non-createElement mounting is effectively dead code now anyway.
2017-01-14 05:11:51 -08:00
Brian Vaughn
7817eb08f3 Replaced an Update effect in complete phase with a Ref effect
Also removed an unnecessary conditional check and improved a flow cast.

Relates originally to PRs #8646 and #8685
2017-01-13 15:32:49 -08:00
Brian Vaughn
be0de3455b Log all Fiber errors w/ component stack (#8756)
A new module has been added (ReactFiberErrorLogger). This logs error information (call stack and component stack) to the console to make errors easier to debug. It also prompts users to use error boundaries if they are not already using them.

In the future, perhaps this will be injectable, enabling users to provide their own handler for custom processing/logging. For the time being, this should help with issues like this / #2461.
2017-01-13 14:45:56 -08:00
Brian Vaughn
c359df7d58 Merge pull request #8645 from bvaughn/add-failing-scu-current-props-test
Added memoization test for interrupted low-priority renders
2017-01-13 13:52:01 -08:00
Brian Vaughn
2fb07b9502 Added memoization test for interrupted low-priority renders
Test added to verify that a high-priority update can reuse the children from an aborted low-priority update if shouldComponentUpdate returns false.
2017-01-13 13:46:20 -08:00
Iurii Kucherov
20c4aac9ec Update higher-order-components.md (#8780) 2017-01-13 13:17:48 -08:00
Brian Vaughn
3bc5595dfd Merge pull request #8742 from bvaughn/stack-fiber-gcc-warning
Warn about missing getChildContext method
2017-01-13 08:45:29 -08:00
Piper Chester
c61148ca58 Fix typo (#8770) 2017-01-13 05:19:23 -08:00
Diego Muracciole
de8173e567 Small ReactPropTypes refactor (#8771) 2017-01-13 04:53:18 -08:00
Dan Abramov
5afd8cd704 Improve Fiber debugger (#8767)
* Simplify the hooks
* Capture completion at the right moment
* Animate the scroll with the fiber on the stack
* Better display priorities
2017-01-13 04:41:56 -08:00
Brian Vaughn
7a2e35b93b Improved error message wording for missing getChildContext() method 2017-01-12 17:11:53 -08:00
Brian Vaughn
e17cc98a89 Removed redundant gCC test 2017-01-12 16:58:36 -08:00
Brian Vaughn
4f08884b5d Dedupe missing getChildContext warning by component name 2017-01-12 16:58:36 -08:00
Brian Vaughn
c7f1abade5 Stack and Fiber warn about missing getChildContext method
Previous (probably unintentional) behavior of Stack was to allow components to define childContextTypes without also supplying a getChildContext property. This PR updates Fiber to (temporarily) mimic that behavior. It also adds warning messages to both Fiber and Stack (along with a test).

For the time being, Fiber components with a missing getChildContext method will return the parent context as-is, after warning.
2017-01-12 16:58:36 -08:00
Andrew Clark
199db638c4 Merge pull request #8655 from acdlite/fibermemoizepremptedwork
[Fiber] Move memoization to begin phase
2017-01-12 16:08:02 -08:00
Andrew Clark
d28ac9eea0 Merge pull request #8757 from acdlite/fiberfeatureflag
Add feature flag to disable Fiber-only features
2017-01-12 13:52:32 -08:00
Andrew Clark
9459bad912 Run test script and fix regressions
Fixes the case where there's an uncaught error and the root unmounts.
We implement this by rendering the root as if its child is null. Null is
not usually allowed at the top level, so we need to special case it.
2017-01-12 13:51:22 -08:00
Andrew Clark
c8adedc054 Warn if undefined is passed to top-level render
Moved the top-level check to ReactChildFiber like the other ones
2017-01-12 13:51:22 -08:00
Andrew Clark
397810f844 Top-level render only accepts a React element if feature flag is on 2017-01-12 13:51:15 -08:00
Ben Alpert
54ebcbcd18 Add test for state merging when sCU is false 2017-01-12 12:04:33 -08:00
Dan Abramov
fd1ef53711 [Fiber Debugger] Bring up to date (#8765)
* Ignore orphaned fibers in the debugger

* Remember last entered code via localStorage

* Update Create React App

* Minor fixes

* Dogfood Fiber
2017-01-12 11:55:59 -08:00
Andrew Clark
d17b9a13f8 Confirm that a shallow bailout does not drop work in the child
Includes a test that confirms that work that is bailed out before
completing can be reused without dropping the entire subtree.
2017-01-12 11:55:52 -08:00
Andrew Clark
1ed304fa87 Move memoization to begin phase
Currently we update the memoized inputs (props, state) during the
complete phase, as we go back up the tree. That means we can't reuse
work until of its children have completed.

By moving memoization to the begin phase, we can do a shallow bailout,
reusing a unit of work even if there's still work to do in its children.

Memoization now happens whenever a fiber's `child` property is updated;
typically, right after reconciling. It's also updated when
`shouldComponentUpdate` returns false, because that indicates that the
given state and props are equal to the memoized state and props.
2017-01-12 11:55:52 -08:00
Paul O’Shannessy
8835955218 Add error codes update to release process (#8749)
* Add error codes update to release process

* Update
2017-01-12 07:13:04 -08:00
Whien
3ec1da800d move blog post [Profiling Components with Chrome Timeline] into docs article (#8680)
* move blog post into docs article

* move to second section and changed description

* Minor tweak
2017-01-12 07:06:15 -08:00
俞火江
e240470cf1 fix failed tests on Windows #8737 (#8747)
* fix failed tests on Windows #8737

* Use regexp literal instead of `RegExp` constructor so that we don't need to bother with escaping special character like `\` and `.`.
Note that by removing the path separator in regexp, I've relaxed the matching condition a little.Since there's little chance we have files like `XXXReact.d.ts`,it should not matter.
2017-01-12 06:46:23 -08:00
Liangzhen Zhu
cb82bc37b6 fix typo (#8760)
It seems that the class name in comments should be CallbackQueue
2017-01-12 06:31:40 -08:00
Snowmanzzz(Zhengzhong Zhao)
2cb7637607 Update handling-events.md (#8762)
* Update handling-events.md

* Update handling-events.md
2017-01-12 06:30:43 -08:00
Andrew Clark
80cf21cae4 In DEV, allow treat auto-mocked render methods as if they return null
Consider deprecating this in the future.
2017-01-11 18:06:16 -08:00
Andrew Clark
204d3dd703 Throw if undefined is returned from a composite component 2017-01-11 18:01:44 -08:00
Andrew Clark
86280187d7 Disallow Fiber-only render return types when feature flag is on
Except for portals, which we use in some places.
2017-01-11 18:01:36 -08:00
Andrew Clark
bf117f82e1 Add feature flag to disable Fiber-specific features
We'll enable this in www in case we need to roll back to Stack.
2017-01-11 17:41:13 -08:00
Dan Abramov
3ec1779837 Make test that forbids arrays Stack-only 2017-01-11 17:11:43 -08:00
Dan Abramov
df0532b0c3 Remove unnecessary warning for invalid node
We have an invariant that checks the same case right afterwards.

The warning was originally added in #5884 with a distinct wording.

However it was later changed to the same wording as the invariant in #6008.

I don't see why we would want to have both since they're saying the same thing and with (almost) the same internal stack.
2017-01-11 17:11:02 -08:00
Dan Abramov
33c3121f43 Remove a duplicate test
This test is identical to "should warn when stateless component returns array" earlier.

It was moved from another file in #5884 so it likely survived by accident.
2017-01-11 17:10:25 -08:00
Dan Abramov
fdf0f435c7 Add a test for stateless components returning undefined
We have one for arrays but it is going to become Stack-specific.
2017-01-11 17:10:08 -08:00
Toru Kobayashi
beb5b74c54 [Fiber] Fix to render falsy value as dangerouslySetInnerHTML (#8652)
* [Fiber] Fix to render falsy value as dangerouslySetInnerHTML

* Add more cases and rename test for clarity
2017-01-11 13:19:50 -08:00
Dustan Kasten
2da35fcae8 [Fiber] Implement test renderer (#8628)
* ReactTestRenderer move current impl to stack dir

* ReactTestRenderer on fiber: commence!

* ReactTestRenderer: most non-ref/non-public-instance tests are passing

* Move ReactTestFiberComponent functions from Renderer to Component file

* test renderer: get rid of private root containers and root Maps

* TestRenderer: switch impl based on ReactDOMFeatureFlag.useFiber

* ReactTestRenderer: inline component creation

* ReactTestRenderer: return to pristine original glory (+ Fiber for error order difference)

* TestRendererFiber: use a simple class as TestComponentInstances

* Add `getPublicInstance` to support TestRenderer `createNodeMock`

* Rename files to end. Update for `mountContainer->createContainer` change

* test renderer return same object to prevent unnecessary context pushing/popping

* Fiber HostConfig add getPublicInstance. This should be the identity fn everywhere except the test renderer

* appease flow

* Initial cleanup from sleepy work

* unstable_batchedUpdates

* Stack test renderer: cache nodeMock to not call on unmount

* add public instance type parameter to the reconciler

* test renderer: set _nodeMock when mounted

* More cleanup

* Add test cases for root fragments and (maybe?) root text nodes

* Fix the npm package build

Explicitly require the Stack version by default.
Add a separate entry point for Fiber.

We don't add fiber.js to the package yet since it's considered internal until React 16.

* Relax the ref type from Object to mixed

This seems like the most straightforward way to support getPublicInstance for test renderer.

* Remove accidental newline

* test renderer: unify TestComponent and TestContainer, handle root updates

* Remove string/number serialization attempts since Fiber ensures all textInstances are strings

* Return full fragments in toJSON

* Test Renderer remove TestComponent instances for simple objects

* Update babylon for exact object type syntax

* Use $$typeof because clarity > punching ducks.

* Minor Flow annotation tweaks

* Tweak style, types, and naming

* Fix typo
2017-01-11 11:19:32 -08:00
Piper Chester
837835d7f3 Update index.html: add spaces between Web/React components (#8750) 2017-01-11 11:00:16 -08:00
Andrew Clark
1c43f94717 Merge pull request #8746 from acdlite/fiberrevertcommitinfo
[Fiber] Revert CommitInfo to avoid extra allocation
2017-01-10 17:44:25 -08:00
Andrew Clark
b59cb4ae01 Revert CommitInfo to avoid extra allocation
I added this when I thought we might support interleaved commits, but
we don't.
2017-01-10 17:14:53 -08:00
Tomáš Hromada
4a7e06bab7 Added more info about refs in the documentation (#8707)
* Update refs-and-the-dom.md

I want to propose some changes to the Refs and the DOM documentation page. 
- Make it clear that string refs are legacy. It seems that this information got lost during the transition to new docs and only some part stayed the same, which was confusing when first reading the docs.
- Clarify and explain that during render, if the ref callback is provided, it will get called twice, first with `null` and then with the rendered DOM element. Discussed in https://github.com/facebook/react/issues/4533 and first proposed docs change in PR #8333.

I've also planned on adding an example for passing the refs up the component chain based on something I've needed to solve myself (e.g. you want to connect two dynamic components by line in React, so you need to both use refs and propagate them up the chain), and while it would be great to read up on this in the docs, it may be too specific for this section; I'd be happy to hear any recommendations.

* Adds more specific information about the callback

* Moved the ref callback description to the Caveats section

* Fixed suggested nits

* Replace 'each render pass' with 'updates'

* Tweak the wording
2017-01-10 12:18:23 -08:00
Dan Abramov
bd23aa2712 Dedupe warnings about refs on functional components (#8739)
* Verify that functional component ref warning is deduplicated

It's not a big problem for string refs because the ref stays the same and the warning code path runs once per mount.

However, it is super annoying for functional refs since they're often written as arrows, and thus the warning fires for every render.

Both tests are currently failing since we're mounting twice, so even the string ref case prints warnings twice.

* Extract the warning condition to the top level

We don't want to run getStackAddendumByID() unless we actually know we're going to print the warning.

This doesn't affect correctness. Just a performance fix.

* Deduplicate warnings about refs on functional components

This fixes the duplicate warnings and adds an additional test for corner cases.

Our goal is to print one warning per one offending call site, when possible.

We try to use the element source for deduplication first because it gives us the exact JSX call site location.

If the element source is not available, we try to use the owner name for deduplication.

If even owner name is unavailable, we try to use the functional component unique identifier for deduplication so that at least the warning is seen once per mounted component.
2017-01-10 09:54:48 -08:00
Brian Vaughn
540ea9e2fe Replaced chalk.color.red with chalk.red 2017-01-10 08:45:56 -08:00
Dmitry Zhuravlev-Nevsky
280bcfa9f5 Fix single vs plural (#8738)
Maybe it's not very important, just misprint fix
2017-01-10 08:00:16 -08:00
Spen Taylor
c3ce14a373 [Docs] Replace 'mix in' in PureComponent notes (#8730)
* [Docs] Replace 'mix in' in PureComponent notes

* Style nit
2017-01-10 06:02:22 -08:00
Dan Abramov
7e47c1aa4a Bump react-noop-renderer version to fix CI 2017-01-10 13:41:31 +00:00
Dmitry Zhuravlev-Nevsky
65bf19029d Swap components (#8735)
It's better to delare component before using.
2017-01-10 02:48:53 -08:00
Andrew Clark
00be2e437f Merge pull request #8728 from acdlite/fibernocallbacklist
[Fiber] Remove callbackList field from Fiber
2017-01-10 00:21:42 -08:00
Andrew Clark
288a4c4d6d Reset invalid UpdateQueue fields when cloning from current
Similar to what cloneFiber does. No change in behavior, but it's more
consistent this way.
2017-01-09 17:14:09 -08:00
Andrew Clark
d4e971a266 Remove callbackList field from Fiber
Moves it to UpdateQueue instead so that we don't waste memory for
components that don't have update queues.
2017-01-09 17:10:10 -08:00
Brian Vaughn
378ef5e730 16.0.0-alpha.0 2017-01-09 16:45:56 -08:00
Brian Vaughn
24b8ba7340 Merge pull request #8723 from bvaughn/improve-unmasked-context-caching
Improve unmasked context caching
2017-01-09 15:33:20 -08:00
Andrew Clark
f1a49e8d6e Merge pull request #8710 from acdlite/fiberscheduleupdateoptimization
[Fiber] Stop bubbling priority on equal priority
2017-01-09 15:24:25 -08:00
Brandon Dail
a1dd107d7a Merge pull request #8589 from nhunzaker/browser-testing
Add basic testing page for browser quicks
2017-01-09 17:22:17 -06:00
Dustan Kasten
90294ead4c Warn for callback refs on functional components (Stack + Fiber) (#8635)
* Fiber: warn for refs on SFCs

* Stateless refs: update warning to use component stack

* Warn for function refs (stack and fiber)

* Add owner reference to ref warnings

* Centralize stack ref warnings in ReactRef.attachRef

* Fiber stateless comp ref warning should only do work when necessary

* ReactDebugCurrentFiber maybe FunctionalComponents should act this way instead

* (chore) scripts/fiber/record-tests

* Add component._compositeType to ReactInstance Flow definition

* Don't handle 'stack inside fiber' case in the warning

We don't have a test for it. It's easy to mess it up and print the wrong thing so instead of verifying it I'll just remove this bit.

* Revert the change to getCurrentFiberOwnerName

This happened to work, but it is just a coincidence. This change didn’t really match what the function was supposed to be doing.

I’m not sure what the correct fix would be yet so this commit breaks tests.

* Add component indirection to the tests using owner name

This passes in Stack. It helps ensure we supply the correct owner name.

* Invalid type invariant should read owner from element

This brings the Fiber behavior in line with how Stack does it. The Fiber test was passing accidentally but broke down in more complicated cases (such as when we have an <Indirection> between the owner and the failing element).

Now we can also remove the weird cases from getCurrentFiberOwnerName() that didn't really make sense but helped get the (incomplete) tests pass in the past.

* Fiber should throw on a string ref inside functional component
2017-01-09 15:09:18 -08:00
Brandon Dail
2dbff6e10c Updating paths in packaging fixtures README 2017-01-09 16:06:08 -06:00
Brandon Dail
2f8a3e5100 Use absolute paths for resolve.root in webpack packaging fixtures
Webpack requires absolute paths here
2017-01-09 15:59:47 -06:00
Brandon Dail
429da399e9 Move build fixtures to fixtures/packaging, updated paths 2017-01-09 15:55:25 -06:00
Brian Vaughn
e5a7b75846 Improve unmasked context caching
Only store cached masked/unmasked contexts on context consumers. Move all references to __reactInternal* cached attributes inside of ReactFiberContext.
2017-01-09 13:51:03 -08:00
Richie Thomas
b2cc91e83a Remove one extraneous backtick from line 116 of 'codebase-overview.md' (#8724). (#8726) 2017-01-09 14:06:37 -06:00
Stuart Harris
c78e403d7b Added React London conference, March 28th (#8722)
Thanks :-)
2017-01-09 09:28:20 -08:00
Brian Vaughn
67c16e3148 Merge pull request #8706 from bvaughn/dont-recreate-masked-context-unless-needed
Dont recreate maked context unless unmasked context changes
2017-01-09 08:45:01 -08:00
Nik Nyby
fa4f79f9fc docs: add missing period in shouldComponentUpdate doc (#8720) 2017-01-09 08:22:04 -08:00
Jirat Ki
fb7e49439f Add component stack to invalid element type warning (#8495)
* Show Source Error Addemden if __source available

* Add Parent Stack on invalid element type

* refactor to use normalizeCodeLocInfo

* Remove ( ) from addendum
2017-01-09 07:26:01 -08:00
Dan Abramov
fbfecd13ce Write a release guide (#8705)
* Write a release guide

* Style nit
2017-01-09 06:39:27 -08:00
Dan Abramov
6b1c86020d Add missing entry for #7750 to 15.4.2 changelog 2017-01-09 14:15:35 +00:00
Bruno Heridet
00846fd3a6 docs(hoc): fix typo Rambda → Ramda (#8712) 2017-01-08 10:26:46 -06:00
Andrew Clark
8ad0e0c25b Stop bubbling priority on equal priority
Unobservable perf fix. Previously we only stopped bubbling if the
priority was lower, but we can stop on equal priority, too.
2017-01-07 21:25:45 -08:00
Brian Vaughn
a682059757 Dont recreate maked context unless unmasked context changes
Doing so can lead to infinite loops if componentWillReceiveProps() calls setState()
2017-01-07 08:53:24 -08:00
Brandon Dail
2085542d30 Remove fixture react build files from git tracking 2017-01-06 16:27:59 -06:00
Nathan Hunzaker
3d6a63d3c6 Remove primitive dom fixture READMEs for some test cases 2017-01-06 17:22:44 -05:00
Nathan Hunzaker
3c53d314a0 Move build fixtures to fixtures/build 2017-01-06 17:17:03 -05:00
Nathan Hunzaker
c79b3f11fe Fix relative reference to build folder in DOM fixtures 2017-01-06 17:15:40 -05:00
Nathan Hunzaker
9d3ceb6895 Update readme for DOM Fixtures 2017-01-06 17:14:50 -05:00
Nathan Hunzaker
96171662aa Move current fixtures into dom folder 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
5e53c0cea4 Add missing semicolon 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
d585590650 Address lint issues. 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
565d63baa6 Remove trailing comma, causing crash in IE11 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
3a51db27f2 Fix some CORS issues in IE 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
2d75ae9fed Consolidate styles into single file 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
1d1dd60899 Patch in console for IE9 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
b006d05275 Test, not text. 🔤 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
c31297b6d9 Remove extraneous binds from some fixtures 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
85aa7eebfc Add test prompt message when no fixture is selected 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
f10a1a7c6f Copy local build before starting 2017-01-06 17:10:41 -05:00
Nathan Hunzaker
6de9ff2deb Remove babel include from react-loader 2017-01-06 17:10:41 -05:00
Brandon Dail
52a1ee492a Remove duplicate fixture components 2017-01-06 17:10:41 -05:00
Brandon Dail
5deb9826ca Use create-react-app for fixtures application
This moves the current fixture architecture to one based around create-react-app. There are a few important things to note:

* The react-loader.js script is always loaded before the bundle and will populate React and ReactDOM on the window. It is then read from the window by all components.
* The UI for the "React Sandbox" or "React Fixtures App" is also rendered with whatever version of React the user has selected. This means we dont have to deal with iframes or worry about multiple versions of React potentially interferring. But it also means that all components must be written using createClass to be fully backwards compatable. I tested back to 0.13.1 and it works fine.
2017-01-06 17:10:41 -05:00
Brandon Dail
bf235489bf Display value for controlled select and textarea 2017-01-06 17:10:30 -05:00
Nathan Hunzaker
f37ff31d2e Fix lint issues in react-loader 2017-01-06 17:10:30 -05:00
Nathan Hunzaker
187bcafe65 Update section on number inputs 2017-01-06 17:10:30 -05:00
Nathan Hunzaker
92fe3673ed Add select, textarea, and range input fixtures
Also write up section on number inputs
2017-01-06 17:10:24 -05:00
Nathan Hunzaker
05ace7365a Move new example changes to fixtures folder 2017-01-06 17:09:39 -05:00
Nathan Hunzaker
e86948fc0d Update input example readme 2017-01-06 17:08:23 -05:00
Nathan Hunzaker
65d4795a1a Make toggleable test cases 2017-01-06 17:08:23 -05:00
Nathan Hunzaker
bbb643fd8d Add React options loader. 2017-01-06 17:08:23 -05:00
Nathan Hunzaker
3d06fb742d Properly slice out question mark in query string 2017-01-06 17:08:23 -05:00
Nathan Hunzaker
49f74f1d93 Add basic testing page 2017-01-06 17:08:23 -05:00
Dan Abramov
f589274604 Fix formatting 2017-01-06 20:33:03 +00:00
Dan Abramov
6df0793d51 Add 15.4.2 changelog 2017-01-06 20:18:50 +00:00
Brandon Dail
0b958fae65 Point all Webpack links to 1.x documentation (#8697)
* Point all Webpack links to 1.x documentation

* Add back webpack production guide, add warning
2017-01-06 12:51:26 -06:00
Brian Vaughn
933805b9d1 Merge pull request #8704 from murtazahaveliwala/patch-3
Update rendering-elements.md
2017-01-06 10:17:10 -08:00
Murtaza Haveliwala
97701ad6bf Update rendering-elements.md
Updating text to be in sync with sample html
2017-01-06 23:32:26 +05:30
Murtaza Haveliwala
2cf475de4f Updated hello world explanation message (#8703)
Output text in explanation now in sync with code sample
2017-01-06 11:59:14 -06:00
Dan Abramov
7f0dc413a2 No longer a WIP, eh? 2017-01-06 14:17:13 +00:00
Dan Abramov
bf763fd1a5 Revert "Add es6-promisify"
This reverts commit c8cd133116475677f35cb166b476c4921f59bfbb.

It's not used in the code.
2017-01-06 06:00:09 -08:00
Dan Abramov
f91bff6264 Remove unused import 2017-01-06 06:00:09 -08:00
Ben Alpert
d8f166bd66 Tweaks to npm-publish task 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
441e74fa1f [rrm] Fix stable-prs command so it updates milestone correctly 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
8796a0e70f [rrm] Update version script to account for dep change 2017-01-06 06:00:09 -08:00
Christopher Chedeau
6db38a143c Abort if not on -stable branch 2017-01-06 06:00:09 -08:00
Christopher Chedeau
ad16ab519d Display the help at startup, otherwise it's hard to figure out what to do 2017-01-06 06:00:09 -08:00
Christopher Chedeau
7684c14d0c Create data/ folder instead of crashing 2017-01-06 06:00:09 -08:00
Christopher Chedeau
a0bc99409d Add es6-promisify 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
b763dc8778 [rrm] Rewrite stable-prs command
Now with
- better UX (can skip, handle each failed cherr-pick individually)
- easier to read code
- better error handling / cancellation
2017-01-06 06:00:09 -08:00
Paul O’Shannessy
7b4f3ea2e3 [rrm] Use git helper for all git commands 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
0fbe927486 [rrm] Create start-release command, create git utils
This does the essentials for starting a new release on the stable branch
2017-01-06 06:00:09 -08:00
Paul O’Shannessy
823030d26b [rrm] Update init command to use Promise style 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
14fd16b67b [rrm] Improve init & config loading experience 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
c9165e0dd1 [rrm] Update to account for new react-test-renderer package 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
c46dd23f4a [rrm] Add commands for npm access checking/granting 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
cfd782471b [rrm] Lint 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
e3a41edd83 [rrm] npm-publish command
This will publish all packages in build/packages/*.tgz to the "next" tag. If the current version is "stable" (doesn't trigger semver.prerelease()) then it will also update the "latest" dist-tag to point at that version.
2017-01-06 06:00:09 -08:00
Paul O’Shannessy
0e9aa2e9a9 [rrm] Add logging to execInRepo, dry-run option 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
114ec049d4 [rrm] stable-prs: update milestone on PRs 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
91f957cb1d [rrm] Move version reading up to app level 2017-01-06 06:00:09 -08:00
Paul O’Shannessy
a47041c0f7 Initial import of react-release-manager 2017-01-06 06:00:09 -08:00
Brandon Dail
8095ebaae7 [Fiber] Throw when attempting to unmount at an invalid node (#8688)
* Throw when attempting to unmount at an invalid node

* Remove extra character after invariant
2017-01-05 16:55:17 -08:00
Dan Abramov
ca2c71c0c5 Fix AMD and Brunch issues (#8686)
* Add manual build fixtures

* Inject ReactDOM into ReactWithAddons from ReactWithAddons

We used to read ReactDOM as a global inside ReactAddonsDOMDependenciesUMDShim.
This didn't work in AMD environments such as RequireJS and SystemJS.

Instead, I changed it so that ReactDOM gets injected into ReactWithAddons by ReactDOM itself.
This way we don't have to try to require it (which wouldn't work because AMD doesn't handle circular dependencies well).

This means you have to load ReactDOM first before using ReactDOM-dependent addons, but this was already the case before.

This commit makes all build fixtures pass.

* Memoize ReactDOM to avoid going into require on every access

* Add Brunch fixture

* Inline requires to work around Brunch bug

See #8556 and https://github.com/brunch/brunch/issues/1591#issuecomment-270742503 for context.
This appears to be a Brunch bug but we can keep a temporary fix until the next major.
2017-01-05 13:16:08 -08:00
Piotr Czajkowski
df0d2a5106 "Don't Mutate the Original Component" example and description mismatch (#8695) 2017-01-05 05:12:51 -08:00
Piotr Czajkowski
a52db12abf Higher-Order Components docs withSubscription() example fix (#8694) 2017-01-05 04:56:13 -08:00
Andrew Clark
39278c41e2 Merge pull request #8685 from acdlite/fiberrefeffect
[Fiber] Update refs even if shouldComponentUpdate returns false
2017-01-04 14:28:44 -08:00
Andrew Clark
2517a11875 Update refs even if shouldComponentUpdate returns false
Implemented using a Ref effect type.
2017-01-04 12:05:25 -08:00
Dan Abramov
0e6f784259 Replace Starter Kit with doc link (#8682)
* Replace Starter Kit with doc link

* https in Babel link
2017-01-04 09:39:01 -08:00
Andre Giron
60767630bc Fix typos (#8632)
* Fix typos

* Put back x in Latinx
2017-01-04 09:36:19 -08:00
Joel Sequeira
4fc4bd1214 Fix typo in Proposing a Change section in how-to-contribute.md (#8498)
* Fix typo in Proposing a Change section in how-to-contribute.md

Not sure if it was actually intended or was a typo but changed 'If you intend to change to the public API' --> 'If you intend to make a change to the public API'

* Simplify
2017-01-04 09:30:08 -08:00
Mateusz Burzyński
aa3fef9b67 [Docs] Fixed anchor links in Animations section (#8453) 2017-01-04 09:24:21 -08:00
Van der Auwermeulen Grégoire
8ce2ac0cdc Update state-and-lifecycle.md (#8424)
* Update state-and-lifecycle.md

Isn't  clock state and props the same in this example?

* Clarify
2017-01-04 09:18:52 -08:00
Devinsuit
315f62dc4a Update blog post link (#8421) 2017-01-04 09:15:09 -08:00
Mojtaba Dashtinejad
9b6cecd2cb [docs] Add a note about componentWillReceiveProps (#8234)
* Component Lifecycle In Depth documentation

* first steps to improve react component reference

* improved react component reference

- remove the component-lifecycle-in-depth

* add a note for usage of ReactDOM.findDOMNode

* one note on componentWillReceiveProps

* remove old useless images for lifecycle docs

* Tweak wording
2017-01-04 08:26:33 -08:00
Dan Abramov
8403a3e6a4 Nitpick: use FB style in doc 2017-01-04 15:59:32 +00:00
Karthik Chintapalli
6fa0b0a271 Fixed stray text appearing on top of the navbar at small screen sizes (#8681) 2017-01-04 04:48:53 -08:00
Brian Vaughn
41588058d4 Merge pull request #8679 from bvaughn/fix-react-conf-2017-name
Renamed React.js Conf to React Conf in conferences.md
2017-01-03 15:31:15 -08:00
Brian Vaughn
1ababda476 Renamed React.js Conf to React Conf 2017-01-03 15:27:23 -08:00
Brian Vaughn
b27cb2ca2b Merge pull request #8677 from bvaughn/add-callback-validation-to-dom-render
Add callback validation to fiber-based renderers
2017-01-03 14:57:42 -08:00
Brian Vaughn
8fbcd499bd Add callback validation to fiber-based renderers
Moved ReactFiberClassComponent validateCallback() helper function into a standalone util used by both fiber and stack implementations. Validation now happens in ReactFiberUpdateQueue so that non-DOM renderers will also benefit from it.
2017-01-03 12:10:06 -08:00
Andrew Clark
47f92b940f Merge pull request #8658 from acdlite/nullupdatetest
Should not re-render as the result of a null state update
2017-01-03 10:27:32 -08:00
Andrew Clark
d658ee8c11 Merge pull request #8661 from acdlite/fiberunbatchedupdates
[Fiber] Introduce API to opt-out of batching
2017-01-03 10:24:52 -08:00
Andrew Clark
ad7bcdf999 Use unbatchedUpdates to opt-out of batching
Reverses the effect of batchedUpdates by resetting the current
batching context.

Does not affect nested updates, which are always deferred regardless
of whether they are inside a batch.
2017-01-03 10:24:27 -08:00
Brian Vaughn
0402106058 Merge pull request #8671 from bonham000/update-docs
update to codebase-overview.md
2017-01-03 09:01:53 -08:00
Brian Vaughn
323125b252 Merge pull request #8673 from madeinfree/patch-1
fiber example typo
2017-01-03 08:58:41 -08:00
Brian Vaughn
962974cef0 Merge pull request #8674 from neeldeep/patch-1
Update conferences.md
2017-01-03 08:56:30 -08:00
neeldeep
2825519505 Update conferences.md 2017-01-03 19:23:55 +05:30
Whien
3b005a7e75 fiber example typo 2017-01-03 13:52:48 +08:00
Sean Smith
2447894008 update to codebase-overview.md 2017-01-01 15:27:57 -08:00
Andrew Clark
b79531eefe No nested updates
We may decide to provide this ability as an escape hatch in the future.
2016-12-30 11:30:40 -08:00
Andrew Clark
2af6d7a702 Should not re-render as the result of a null state update (Stack)
Stack now passes test added in previous commit.
2016-12-30 00:19:55 -08:00
Andrew Clark
5c927b902f Should not re-render as the result of a null state update
Fiber already happens to behave this way; this just adds a test.

TODO: Should we add this feature to Stack, too?
2016-12-29 23:31:48 -08:00
Andrew Clark
7dc5f91d88 Merge pull request #8641 from jddxf/remove-superfluous-check
remove superfluous check in while loop
2016-12-29 13:25:22 -08:00
Andrew Clark
9b015184b7 Merge pull request #8634 from acdlite/fibersyncmount
[Fiber] Sync mount and unmount
2016-12-29 13:11:57 -08:00
Andrew Clark
79f01b2425 prepareForCommit returns info object to be passed resetAfterCommit
The DOM renderer assumes that resetAfterCommit is called after
prepareForCommit without any nested commits in between. That may not
be the case now that syncUpdates forces a nested update.

To address, this changes the type of prepareForCommit to return a value
which is later passed to resetAfterCommit.
2016-12-29 10:39:24 -08:00
Andrew Clark
ce8c978d63 Disallow forced sync updates during begin phase
Stack allows this, but in Fiber it may cause an infinite loop. Instead
we'll print a warning and defer the update by giving it Task priority.
2016-12-29 10:39:18 -08:00
Andrew Clark
21f6d4145f syncUpdates prevents Synchronous priority from being downgraded to Task
Typically, a sync update is downgraded to Task priority if it's
scheduled within another batch of work, e.g. within a lifecycle like
componentDidMount. But syncUpdates should force sync updates to not
be downgraded to Task. This will cause performWork to be
called recursively.
2016-12-29 10:23:33 -08:00
Andrew Clark
8090cf59e3 Allow performWork to be called recursively
Currently we assume that performWork is never called recursively.
Ideally that is the case. We shouldn't rely on recursion anywhere
in Fiber.

However, to support the use of syncUpdates as an opt-in to forced-
synchronous updates, we need the ability to call performWork
recursively.

At the beginning of performWork, the state of the scheduler is saved;
before exiting, that state is restored, so that the scheduler can
continue where it left off. I've decided to use local variables to stash
the previous state. We could also store them in a record and push it to
a stack, but this approach has the advantage of being isolated to
performWork.
2016-12-29 10:23:33 -08:00
Andrew Clark
3926a3566f If an error is thrown and there's no nextUnitOfWork, it's fatal error
This can only be caused by a bug in the renderer, but we should handle
it gracefully anyway.

Added a TODO to change capturedErrors and failedBoundaries so that they
are sets of instances (stateNodes) rather than fibers, to avoid having
to check the alternate. (This outside the scope of this PR.)
2016-12-29 10:23:26 -08:00
Andrew Clark
ffbb86b361 Wrap top-level mount and unmount in syncUpdates
For legacy purposes. Only enabled in the DOM renderer. We can remove
this in a future release when we enable incremental-by-default.

This change is unobservable because syncUpdates actually schedules
Task updates when it is called from inside another batch. The correct
behavior is to recursively begin another batch of work. We will fix it
in a subsequent commit.
2016-12-28 20:41:40 -08:00
Brian Vaughn
df6ca0e2c1 Merge pull request #8646 from bvaughn/focus-side-effect
Renderers can queue commit effects for initial mount
2016-12-28 15:16:50 -05:00
Brian Vaughn
a10131304b Renderers can schedule commit-time effects for initial mount
The finalizeInitialChildren HostConfig method now utilizes a boolean return type. Renderers can return true to indicate that custom effects should be processed at commit-time once host components have been mounted. This type of work is marked using the existing Update flag.

A new HostConfig method, commitMount, has been added as well for performing this type of work.

This change set is in support of the autoFocus prop.
2016-12-28 15:03:08 -05:00
gitanupam
9e461c715c Changed webpack's hyperlink (#8650)
..to point to 2.x documentation instead of 1.x (and to be consistent with other links on the page)
2016-12-28 11:34:00 -06:00
gitanupam
86765baaef 'npm init' needed before installing react via npm. (#8649)
* 'npm init' needed before installing react via npm.

I was trying to install react in my django project directory and was getting warnings about package.json not being present. Started this SO post (http://stackoverflow.com/questions/41340909/npm-cant-find-package-json-when-installing-react/41340975#41340975) to figure it out. I think it'll be useful to others too if we add it in the documentation itself.

* Tweak instructions
2016-12-28 04:04:21 -08:00
Dan Abramov
6b73073557 Include owner in invalid element type invariant (#8637) 2016-12-27 08:41:23 -08:00
Dan Abramov
38ed61f4c4 Relax test about rendering top-level null (#8640) 2016-12-27 08:38:24 -08:00
Dan Abramov
119294dcae Validate that update callback is a function (#8639) 2016-12-27 08:38:10 -08:00
jddxf
b359be74a1 remove superfluous check in while loop 2016-12-25 09:41:47 +08:00
Eric Pitcher
3baa47ca7b Update conditional-rendering.md (#8636)
Stating the fact that component lifecycle methods will still fire as normal even though you return null from the render method.
2016-12-24 09:18:30 -08:00
Sebastian Markbåge
5d153c9dbe Don't call sCU with null props (#8633)
I missed this case in 8613 and it broke the triangle demo.
2016-12-22 15:47:10 -08:00
Ben Alpert
6e47f43e89 Fix typo 2016-12-22 12:44:28 -08:00
Ben Alpert
13980e6536 Fiber: Fix reentrant mounting in synchronous mode (#8623) 2016-12-22 11:34:35 -08:00
Dan Abramov
c978f789cc [Fiber] Push class context providers even if they crash (#8627)
* Push class context providers early

Previously we used to push them only after the instance was available. This caused issues in cases an error is thrown during componentWillMount().

In that case we never got to pushing the provider in the begin phase, but in complete phase the provider check returned true since the instance existed by that point. As a result we got mismatching context pops.

We solve the issue by making the context check independent of whether the instance actually exists. Instead we're checking the type itself.

This lets us push class context early. However there's another problem: we might not know the context value. If the instance is not yet created, we can't call getChildContext on it.

To fix this, we are introducing a way to replace current value on the stack, and a way to read the previous value. This also helps remove some branching and split the memoized from invalidated code paths.

* Add a now-passing test from #8604

Also rename another test to have a shorter name.

* Move isContextProvider() checks into push() and pop()

All uses of push() and pop() are guarded by it anyway.

This makes it more similar to how we use host context.

There is only one other place where isContextProvider() is used and that's legacy code needed for renderSubtree().

* Clarify why we read the previous context

* Use invariant instead of throwing an error

* Fix off-by-one in ReactFiberStack

* Manually keep track of the last parent context

The previous algorithm was flawed and worked by accident, as shown by the failing tests after an off-by-one was fixed.

The implementation of getPrevious() was incorrect because the context stack currently has no notion of a previous value per cursor.

Instead, we are caching the previous value directly in the ReactFiberContext in a local variable.

Additionally, we are using push() and pop() instead of adding a new replace() method.
2016-12-22 10:36:42 -08:00
Dan Abramov
c79af45f1e Update to Jest 18 (#8621) 2016-12-21 19:28:27 -08:00
Ben Alpert
efaa26eb50 Upgrade jest APIs to match www (#8536)
D4298654, D4298713
2016-12-21 19:07:40 -08:00
Brian Vaughn
f1e193b32e Merge pull request #8611 from bvaughn/shared-context-stack
Added ReactFiberStack shared by ReactFiberContext and ReactFiberHostContext
2016-12-21 18:50:34 -08:00
Brian Vaughn
d1e604004a Removed redundant calls to ReactFiberStack.reset() 2016-12-21 17:39:39 -08:00
Brian Vaughn
2f2a44007c Improved Flowtypes in response to code review feedback 2016-12-21 17:32:53 -08:00
Brian Vaughn
cb66f5c440 Merge pull request #8622 from bvaughn/preproccessor-jest-cching
Jest preprocessor better aware of error-codes/codes.json WRT caching
2016-12-21 17:12:17 -08:00
Brian Vaughn
b209804cfb Jest preprocessor better aware of error-codes/codes.json WRT caching 2016-12-21 16:58:33 -08:00
Brian Vaughn
ea6530d13a Removed exact object type for StackCursor Flow type
This was causing the 'react:extract-errors' Gulp taks to fail.
2016-12-21 16:48:14 -08:00
Brian Vaughn
e7a591ed57 ReactFiberStack cursor values are no longer corrupted on pop 2016-12-21 15:11:49 -08:00
Brian Vaughn
1148e827b9 Avoid reading the same StackCursor current multiple times 2016-12-21 15:11:49 -08:00
Brian Vaughn
6b51e037ca Avoid popping hosts that do not provide unique contexts 2016-12-21 15:11:49 -08:00
Brian Vaughn
0b7c5ff1a0 Tightened up Fiber | null type in ReactFiberStack to always require Fiber 2016-12-21 15:11:49 -08:00
Brian Vaughn
0c1fdfd41d Combined unwindContext and unwindHostContext into unwindContexts 2016-12-21 15:11:49 -08:00
Brian Vaughn
a0902fc306 Generic type added to StackCursor. Default emptyObject replaced with null. 2016-12-21 15:11:49 -08:00
Brian Vaughn
3d0cf47d26 Added ReactFiberStack shared by ReactFiberContext and ReactFiberHostContext
ReactFiberStack is the new underlying stack used by ReactFiberContext and ReactFiberHostContext. The goal is to simplify the 2 context managers and to add more errors/dev-warnings when we pop unexpected.
This changeset currently causes a lot of tests to fail (as we are currently popping too many times and/or in the wrong order). I'm pushing this branch now to share with Sebastian as he is working on a related cleanup pass at beginWork.
2016-12-21 15:11:49 -08:00
Dan Abramov
a27e4f3361 [Fiber] Make requestIdleCallback() and requestAnimationFrame() shims async (#8591)
* Add a failing test for recursion check

* Make requestIdleCallback() and requestAnimationFrame() shims async

They no longer need to be sync in tests because we already made DOM renderer sync by default.
This fixes a crash when testing incrementalness in DOM renderer itself.

* Style fix

* Fix lint
2016-12-21 14:04:05 -08:00
Ben Alpert
2a5fe4c2b0 Call refs and lifecycles on indeterminate components (#8614)
This was a bug because of the split between ClassComponent and IndeterminateComponent -- we didn't mark effects or push context when we come from an indeterminate component. Now they behave the same way.

The code is even clumsier than before but I'm pretty worried we'll screw these up in the future if we don't unify the paths.

Not many components exercise this path but Relay containers do so it's noticeable.
2016-12-21 13:51:59 -08:00
Sebastian Markbåge
4a05c242e8 Merge pull request #8613 from sebmarkbage/fiberrefactorbailout
[Fiber] Refactor bailoutOnFinishedWork
2016-12-21 13:22:20 -08:00
Ben Alpert
eca5b1d48e Improve error messages for invalid element types (#8612) 2016-12-21 13:17:34 -08:00
Sebastian Markbage
26c82cea72 Move other branches out of the bail out
This is the same thing as the previous commit but with class, root and portal.

I noticed host and portal now already covers this case in their branches
since pushHostContainer is always at the top.
2016-12-21 11:34:18 -08:00
Sebastian Markbage
9a210114e4 Move isHostComponent branches out of bailout
Since we only call bailout from within the host component branch now, we
can just move this to the branch where we already know that this is a
host component.

As part of this I noticed that we don't always push the host context so
I moved that to the beginning of the branch.
2016-12-21 11:34:18 -08:00
Sebastian Markbage
b7548b2030 Delete hasPendingUpdate
This is no longer needed. It is effectively covered by other branches
that tries to being merging the update queue which yields the same state
object as before if there is no work. That in turn bails out.

We can shortcut in the relevant paths if needed.
2016-12-21 11:34:18 -08:00
Sebastian Markbage
21dccad47f Move props equality check into each branch
Now we only bail out once we've entered each branch.

This has some repetition with regard to hasContextChanged but I'm hoping
we can just get rid of all those branches at some point since they're
mostly for backwards compatibility right now.
2016-12-21 11:34:18 -08:00
Sebastian Markbage
0907a49abd Add bailout to HostRoot
This doesn't need to compare props because it doesn't use props,
only state.
2016-12-21 11:34:13 -08:00
Sebastian Markbage
5a32fdb8e5 Compare memoized props in functional component branch
The functional component branch is a bit special since it has sCU in it.

The class component branch actually already covers this in a bit convoluted
way.

I will next replicate this check in each other branch.
2016-12-21 11:33:26 -08:00
Sebastian Markbage
b4b21486aa Move all the begin work stuff into their own helper functions
This just moves things around to continue the pattern that we already
started.
2016-12-21 11:33:26 -08:00
Sebastian Markbage
38a297d500 Always reset context before beginning new work
This consolidates the reset of context to one single place right before
any new work is started.

This place is burried in a bit of an awkward place but findNextUnitOfWork
happens right before any new work starts. That way we're guaranteed to have
an empty stack before we start anything new.

The benefit of this is that we don't have to rely .return being null when
entering beginWork but we also don't have to check it every time in the
hot path.
2016-12-21 11:33:26 -08:00
Andrew Clark
d47a3a36ee Merge pull request #8585 from acdlite/batchstateandcallback
Schedule state and callback at the same time
2016-12-21 13:24:08 -06:00
Andrew Clark
f4c0c99973 Remove enqueueCallback from updater API
This isn't being used anymore.

Also removes addCallback from ReactFiberUpdateQueue.
2016-12-21 13:03:39 -06:00
Andrew Clark
29c1e1deba Schedule state and callback in the same batch
Fixes an issue (in both Stack and Fiber) where enqueueSetState causes
a synchronous update that flushes before enqueueCallback is ever called.
Now enqueueSetState et al accept an optional callback so that both
are scheduled at the same time.
2016-12-21 12:54:19 -06:00
Andrew Clark
afd4a54d2a Merge pull request #8610 from acdlite/fiberfixrooterror
[Fiber] Handle errors thrown when committing root
2016-12-20 18:02:02 -08:00
Andrew Clark
15acbaa8e1 Handle errors thrown when committing root
Previously this caused an infinite loop.
2016-12-20 16:20:57 -08:00
Sebastian Markbåge
b49210f498 Update Flow to 0.37.0 (#8608)
Nothing really changes.
2016-12-20 11:09:03 -08:00
Andrew Clark
090e741c55 Merge pull request #8606 from acdlite/fiberhostrootupdatequeue
[Fiber] Queue top-level updates (take 2)
2016-12-19 21:36:25 -08:00
dfrownfelter
b106ca0c8e Delete fiveArgumentPooler (#8597) 2016-12-19 22:53:04 -06:00
Andrew Clark
470da6ea77 Add test for errors in host config while working on failed root
Test for a bug fixed in the previous commit that was causing an
infinite loop.
2016-12-19 18:46:13 -08:00
Andrew Clark
6c26e98ec2 Handle case where host environment throws when working on failed root
Otherwise you fall into an infinite loop where root fails -> host env
throws -> root fails...

This is a worst-case scenario that should only be possible if there's
a bug in the renderer.
2016-12-19 18:06:56 -08:00
Andrew Clark
da4ace152b Remove unmountContainer
Instead, renderers should pass null to updateContainer.
2016-12-19 16:33:25 -08:00
Andrew Clark
c6ccc19095 Use an UpdateQueue for top-level updates
...rather than mutate the pendingProps directly, which throws away any
previously scheduled work.
2016-12-19 16:33:16 -08:00
Andrew Clark
ab19dd0292 Merge pull request #8605 from facebook/revert-8584-fiberhostrootupdatequeue
Revert "[Fiber] Queue top-level updates"
2016-12-19 15:36:28 -08:00
Andrew Clark
0b37588171 Revert "[Fiber] Queue top-level updates" 2016-12-19 15:32:59 -08:00
Andrew Clark
ddc44b7add Merge pull request #8584 from acdlite/fiberhostrootupdatequeue
[Fiber] Queue top-level updates
2016-12-19 13:56:18 -08:00
Brian Vaughn
3c6d4bacdd Merge pull request #8594 from bvaughn/dont-warn-about-getInitialState-on-class-if-state-set
Don't warn about class components using getInitialState if state is set
2016-12-17 14:28:20 -08:00
Brian Vaughn
1b868cbd71 Don't warn about class component usage of getInitialState if state is also set
We warn about getInitialState() usage in class components because users may have accidentally used it instead of state. If they have also specified state though then we should skip this warning.

Context: https://twitter.com/soprano/status/810003963286163456
2016-12-17 11:16:27 -08:00
Brian Vaughn
a5e728747e Merge pull request #8590 from bvaughn/unexpected-context-pop
`bailoutOnLowPriority` pushes context to mirror complete phase context pop
2016-12-17 07:41:25 -08:00
Dan Abramov
70f704dca6 [Fiber] Nesting validation warnings (#8586)
* (WIP) Nesting warnings

* Remove indirection

* Add a note about namespace

* Fix Flow and make host context required

This makes it easier to avoid accidental nulls.
I also added a test for the production case to avoid regressing because of __DEV__ branches.
2016-12-16 18:57:58 -08:00
Andrew Clark
a9365b97e5 Remove unmountContainer
Instead, renderers should pass null to updateContainer.
2016-12-16 18:31:39 -08:00
Andrew Clark
d8ade83eb2 Use an UpdateQueue for top-level updates
...rather than mutate the pendingProps directly, which throws away any
previously scheduled work.
2016-12-16 16:30:28 -08:00
Andrew Clark
e1eccbfbb0 Merge pull request #8587 from acdlite/fiberupdatequeuefollowup
[Fiber] UpdateQueue follow-up improvements
2016-12-16 16:20:51 -08:00
Andrew Clark
7b6c94c767 Don't drop updates from queue when calling replaceState
We should be able to support passing a function to replaceState, which
receives the accumulation of all the previously applied state updates.
Which means we shouldn't drop those updates from the queue. Technically,
we could drop them only when an object is passed to replaceState, but
that seems like more trouble than it's worth.
2016-12-16 16:20:16 -08:00
Brian Vaughn
441cc5c82b bailoutOnLowPriority correct pushes context for ClassComponents to mirror complete phase context pop 2016-12-16 15:04:06 -08:00
Andrew Clark
f070aaa1b8 Remove confusing for-loop in favor of a helper function
This logic is hopefully easier to follow. Added more inline comments
to explain how the algorithm works.
2016-12-15 18:15:03 -08:00
Andrew Clark
dfe3d089cc Clean up some style nits and other code detritus in the update queue 2016-12-15 18:10:25 -08:00
Andrew Clark
ea622e52c2 Use warning instead of console.error 2016-12-15 17:34:24 -08:00
Andrew Clark
7fca464e7c Merge pull request #8538 from acdlite/fiberupdatequeue
[Fiber] Separate priority for updates
2016-12-15 16:41:53 -08:00
Andrew Clark
b8441ba955 Remove ForceUpdate effect
Go back to using a flag, instead. I removed it before because I thought
we might want to get rid of the top-level UpdateQueue type and put
the fields directly on the fiber, but since we're keeping UpdateQueue
we can put hasForceUpdate on there.
2016-12-15 16:35:54 -08:00
Andrew Clark
3a946fe094 Use 255 instead of infinity
Infinity is a floating point value.
2016-12-15 09:12:13 -08:00
Andrew Clark
496512f8b8 Update tests to not rely on key iteration order 2016-12-15 09:12:13 -08:00
Andrew Clark
e1b733fa83 Move priority context change to findNextUnitOfWork
...rather than changing it on every unit of work.
2016-12-15 09:12:13 -08:00
Andrew Clark
df9603ead8 Simplify test for whether we should flush a pending commit
We can just check if the deadline has expired.
2016-12-15 09:12:13 -08:00
Andrew Clark
eec431297a Priority context during reconciliation
setState inside render/cWRP should have the same priority as whatever
level is currently being reconciled.
2016-12-15 09:12:13 -08:00
Andrew Clark
e0981b8bc5 Handle setState inside an updater function
The update is scheduled as if the current processing update has already
been processed; if it has the same or higher priority, it will be
flushed in the same batch.

We also print a warning.
2016-12-15 09:12:13 -08:00
Andrew Clark
babace0c05 Add fast path for appending updates to the end of the queue
This is the most common case, so we should avoid scanning the entire
list to get to the end.
2016-12-15 09:12:13 -08:00
Andrew Clark
d7f89b8681 Don't rely on commit phase effect to clear updates
Instead clear updates on the work-in-progress during the begin phase.
Aborted updates are recovered by cloning from the current fiber.
2016-12-15 09:12:12 -08:00
Andrew Clark
ead8ab7e2d Add unstable_deferredUpdates
This is needed to get the triangle demo working.
2016-12-15 09:12:12 -08:00
Andrew Clark
20f00045d3 Apply pending updates in order of priority
The queue maintains a pointer to the last progressed update in the list.
Updates that come after that pointer are pending. The pointer is set to
the end of the list during reconciliation.

Pending updates are sorted by priority then insertion. Progressed
updates are sorted by the order in which they were applied during
reconciliation, which may not be by priority: if a component bails out
before the updates are committed, in the next render, the progressed
updates are applied in the same order that they were previously, even if
a higher priority update comes in.

Once a progressed update is flushed/committed, it's removed from
the queue.
2016-12-15 09:12:12 -08:00
Andrew Clark
bb844a03b2 Use lastProgressedUpdate pointer instead of firstPendingUpdate
We need to be able to access both, and since the list uses forward
pointers, it makes more sense to point to the one that comes first.
Otherwise to get the last progressed update you have to start at the
beginning of the list.
2016-12-15 09:12:12 -08:00
Andrew Clark
94011e98a6 Separate priority for updates
When resetting the priority in the complete phase, check the priority of
the update queue so that updates aren't dropped.

Updates inside render, child cWRP, etc are no longer dropped.

The next step is sort the queue by priority and only flush updates that
match the current priority level.
2016-12-15 09:12:12 -08:00
Andrew Clark
cb1ef03df9 Replace .hasForceUpdate with ForceUpdate effect
Removes another field from the update queue
2016-12-15 09:12:12 -08:00
Andrew Clark
6301086c35 Schedule callback effects while merging updates
This allows us to remove the hasCallback flag.
2016-12-15 09:12:12 -08:00
Andrew Clark
cbba5ef9cc Don't drop updates until they are committed
Restructures the update queue to maintain a pointer to the first
pending update, which solves a few problems:

- Updates that occur during the begin phase (e.g. in cWRP of a child)
aren't dropped, like they are currently. This isn't working yet because
the work priority is reset during completion. The following item will
fix it.
- Sets us up to be able to add separate priorities to each update in
the queue. I'll add this in a subsequent commit.
2016-12-15 09:12:12 -08:00
Dan Abramov
e36b38c1ca [Fiber] Fix some of the warnings (#8570)
* Implement component stack for some warnings in Fiber

* Keep Fiber debug source up to date

When an element changes, we should copy the source and owner again.
Otherwise they can get stale since we're not reading them from the element.

* Remove outdated TODOs from tests

* Explicitly specify Fiber types to include in the stack

Fixes an accidental omission when both source and owner are null but displayName exists.

* Fix mised Stack+Fiber test to not expect extra warnings

When we're in Fiber mode we don't actually expect that warning being printed.

* Warn on passing different props to super()

* Implement duplicate key warnings

We keep known keys in a set in development. There is an annoying special case where we know we'll check it again because we break out of the loop early.

One test in the tree hook regresses to the failing state because it checks that the tree hook works without a Set available, but we started using Set in this code. It is not essential and we can clean this up later when we decide how to deal with polyfills.

* Move ReactTypeOfWork to src/shared

It needs to be available both to Fiber and Isomorphic because the tree hook lives in Isomorphic but pretty-prints Fiber stack.

* Add dev-only ReactDebugCurrentFiber for warnings

The goal is to use ReactCurrentOwner less and rely on ReactDebugCurrentFiber for warning owner name and stack.

* Make Stack invariant messages more consistent

Fiber used a helper so two tests had the same phrasing.
Stack also used a helper for most invariants but hardcoded a different phrase in one place.
I changed that invariant message to use a helper which made it consistent with what it prints in Fiber.

* Make CSSPropertyOperations use getCurrentFiberOwnerName()

This gets mount-time CSS warnings to be printed.

However update-time warnings are currently ignored because current fiber is not yet available during the commit phase.

We also regress on HostOperation hook tests but this doesn't matter because it's only used by ReactPerf and it doesn't work with Fiber yet anyway. We'll have to think more about it later.

* Set ReactDebugCurrentFiber during the commit phase

This makes it available during updates, fixing the last failing test in CSSPropertyOperations.

* Add DOM warnings by calling hooks directly

It is not clear if the old hook system is worth it in its generic incarnation. For now I am just hooking it up to the DOMFiber renderer directly.

* Add client-side counterparts for some warning tests

This helps us track which warnings are really failing in Fiber, and which ones depend on SSR.
2016-12-15 08:36:58 -08:00
Brian Vaughn
ab72f626de Merge pull request #8560 from bvaughn/react-native-fiber
ReactNative fiber renderer
2016-12-14 20:05:17 -08:00
Brian Vaughn
5266ca9312 Added new fiber-based renderer for native dubbed ReactNativeFiber 2016-12-14 18:39:22 -08:00
Ben Alpert
ac241972bd mockImpl -> mockImplementation
D4329549
2016-12-14 14:21:51 -08:00
Ben Alpert
ba8f24ba99 Prepare new composite child before removing old (#8572)
This matches what we do in Fiber -- and doing it this way is the only way we can prepare new views in the background before unmounting old ones.

In particular, this breaks this pattern:

```js
class Child1 extends React.Component {
  render() { ... }
  componentWillMount() {
    this.props.registerChild(this);
  }
  componentWillUnmount() {
    this.props.unregisterChild();
  }
}

class Child2 extends React.Component {
  render() { ... }
  componentWillMount() {
    this.props.registerChild(this);
  }
  componentWillUnmount() {
    this.props.unregisterChild();
  }
}

class Parent extends React.Component {
  render() {
    return (
      showChild1 ?
        <Child1
          registerChild={(child) => this.registered = child}
          unregisterChild={() => this.registered = null}
        /> :
        <Child2
          registerChild={(child) => this.registered = child}
          unregisterChild={() => this.registered = null}
        />
    );
  }
}
```

Previously, `this.registered` would always be set -- now, after a rerender, `this.registered` gets stuck at null because the old child's componentWillUnmount runs *after* the new child's componentWillMount.

A correct fix here is to use componentDidMount rather than componentWillMount. (In general, componentWillMount should not have side effects.) If Parent stored a list or set of registered children instead, there would also be no issue.
2016-12-14 11:14:50 -08:00
Gaëtan Renaudeau
931cad5aae Fix test renderer unmount (#8512)
* [react-test-renderer] unmount the inner instances

Fixes https://github.com/facebook/react/issues/8459

* add a test for https://github.com/facebook/react/issues/8459

* add new test in tests-passing.txt
2016-12-14 10:57:21 -05:00
Brian Vaughn
3def431543 Merge pull request #8568 from bvaughn/top-level-context-push-pop
HostRoot no longer pops context provider during complete phase
2016-12-13 17:27:47 -08:00
Brian Vaughn
b4745ca72b HostRoot no longer pops context provider in complete phase
Also added an invariant warning to guard against context being popped too many times.
2016-12-13 17:26:19 -08:00
Andrew Clark
480e404fc8 Merge pull request #8528 from acdlite/callbacksemantics
Give setState callbacks componentWillUpdate semantics
2016-12-13 17:22:41 -08:00
Andrew Clark
97b7d0eff5 Test top-level callback when re-rendering with same element 2016-12-13 16:28:06 -08:00
Andrew Clark
a930f09dfe Give setState callbacks componentWillUpdate semantics
This matches the behavior in Fiber. Normally we would change Fiber
to match Stack to minimize breaking changes for the initial release.
However, in this case it would require too large a compromise to change
Fiber to act like Stack.
2016-12-13 15:50:33 -08:00
Sebastian Markbåge
bd425837a4 Merge pull request #8563 from sebmarkbage/enforcelowercasetags
Drop runtime validation and lower case coercion of tag names
2016-12-13 14:54:21 -08:00
Sebastian Markbage
6c1592f384 Pass type to the relevant host config methods
Instead of reading it from the DOM node.
2016-12-13 14:53:36 -08:00
Sebastian Markbage
db489a4ade Only do runtime validation of tag names when createElement is not used
We introduced runtime validation of tag names because we used to generate
HTML that was supposed to be inserted into a HTML string which could've
been an XSS attack.

However, these days we use document.createElement in most cases. That
already does its internal validation in the browser which throws. We're now
double validating it. Stack still has a path where innerHTML is used and
we still need it there. However in Fiber we can remove it completely.
2016-12-13 14:53:36 -08:00
Sebastian Markbage
3092f63c6b Warn if upper-case tags are used
In #2756 we ended up using toLowerCase to allow case insensitive HTML tags.
However, this requires extra processing every time we access the tag or
at least we need to process it for mount and store it in an extra field
which wastes memory.

So instead, we can just enforce case sensitivity for HTML since this might
matter for the XML namespaces like SVG anyway.
2016-12-13 14:53:29 -08:00
Ben Alpert
ec8b94e847 Disable coverage on PRs on Circle (#8569) 2016-12-13 14:27:25 -08:00
Brian Vaughn
369769aed4 Merge pull request #8558 from bvaughn/rename-initialize-core
Renamed InitializeJavaScriptAppEngine to InitializeCore
2016-12-12 21:32:53 -08:00
Dan Abramov
0f34bdc622 [Fiber] Remove array indirection in host context (#8544)
* Remove array indirection in host context

* Keep a single context stack with a null sentinel

This lets us keep subtrees separated without maintaining independent context arrays for subtrees.

* There is always exactly one null by the time we pop a portal

I was trying to be smart but didn't need to.

* Cache current context
2016-12-12 15:20:40 -08:00
Dan Abramov
ef532fd4a4 [Fiber] Fix portal bugs (#8532)
* Enable additional (failing) portal tests

* Fix portal unmounting

When unmount a portal, we need to unmount *its* children from itself.
This is similar to what we would do for a root if we allowed deleting roots.

* Skip portals when looking for host siblings

A portal is not part of that host tree despite being a child.

* Fix comment typo

* Add a failing test for portal child reconciliation

It is failing because portal bails out of update, seeing null in pendingProps.
It is null because we set pendingProps to nextPortal.children, which is null in this test.

* Fix the bug when switching to a null portal child

If pendingProps is null, we do a bailout in beginWork.
This prevents unmounting of the existing child when the new child is null.

We fix this by changing portal fiber's pendingProps to be the portal object itself instead of its children.
This way, it is never null, and thus doesn't cause a false positive in the bailout condition.

* Add a comment about HostPortal in getHostSibling

* Revert the fix because I don't know why it worked

unmountHostComponents() should have worked despite finding the wrong parent because it should have changed the parent when pushing and popping the portals.

* Don't call commitDeletion recursively

This leads to a "Cannot find host parent" bug because commitDeletion() clears the return field.
When we're inside the loop, we assign node.sibling.return to node.return but by this moment node.return has already been nulled.
As a solution we inline code from commitDeletion() without the nulling.

It still fails tests but for a different reason (unrelated bug).

* Skip portal children in commitNestedUnmounts()

We are currently already visiting them in commitUnmount() portal case since it's recursive.
This condition avoids visting them twice.

* Set node.child.return before going deeper

It doesn't seem to influence existing tests but we have this protection in all other similar places.
It protects against infinite loops.

* Revert "Fix the bug when switching to a null portal child"

This reverts commit ed9747deedf11455ba3eb65648007ab99c26ea58.

I'll solve this by using an array in place of null instead.

* Use [] for empty Portal pendingProps

This avoids a false positive bailout with pendingProps == null when portal is empty.
2016-12-12 14:18:55 -08:00
Brian Vaughn
cdb38c1478 Renamed InitializeJavaScriptAppEngine mock to InitializeCore. 2016-12-12 13:55:58 -08:00
Brian Vaughn
7b7c0e4af5 Renamed InitializeJavaScriptAppEngine to InitializeCore 2016-12-12 11:23:25 -08:00
Brian Vaughn
0a3256ac15 Merge pull request #8557 from bvaughn/add-create-text-instance-param
Add rootContainerInstance param to createTextInstance
2016-12-12 11:20:46 -08:00
Brian Vaughn
f8cb22ad83 Add rootContainerInstance param to createTextInstance.
This mirrors a recent change in params passed to  and cleans up a HACK currently required for the native fiber renderer to create text views.
2016-12-12 10:12:43 -08:00
comerc
92665e2cb1 Fix casing typo in jsx-in-depth.md (#8542) 2016-12-11 07:43:40 -06:00
Chris
39695dcd36 update example to use this.state (#8425)
- In the previous example, the code works even without using bind(this) in the constructor.
- the reason being handleClick doesn't even use `this` and its just calling the global function alert.
- this change make use of this via access this.state.
2016-12-11 07:41:48 -06:00
Sebastian Markbåge
14f05bfa89 ReactDOMFiber-test Rename portal -> usePortal (#8535)
Fixes lint since I used portal as a variable name.
We typically use a verb for functions.
2016-12-08 14:22:53 -08:00
Sebastian Markbåge
6c785ed524 Add unit tests for event bubbling in portals (#8509)
These bubble through the portal and up to the parent that rendered
the portal.
2016-12-08 13:51:21 -08:00
Sebastian Markbåge
3937bca8a2 Merge pull request #8491 from sebmarkbage/fibercurrenteventhandlers
[Fiber] Read Event Handlers from the "Current" Fiber
2016-12-08 13:49:51 -08:00
Dan Abramov
c87ffc0beb [Fiber] Support SVG (#8490)
* Test that SVG elements get created with the right namespace

* Pass root to the renderer methods

* Keep track of host instances and containers

* Keep instances instead of fibers on the stack

* Create text instances in begin phase

* Create instance before bailing on offscreen children

Otherwise, the parent gets skipped next time.
We could probably create it later but this seems simpler.

* Tweak magic numbers in incremental tests

I don't understand why they changed but probably related to us moving some work into begin phase?

* Only push newly created nodes on the parent stack

Previously I was pushing nodes on the parent stack regardless of whether they were already in current or not.
As a result, insertions during updates were duplicated, and nodes were added to existing parents before commit phase.
Luckily we have a test that caught that.

* Fix lint

* Fix Flow

I had to wrap HostContext API into a closure so that it's parameterizeable with I and C.

* Use the same destructuring style in scheduler as everywhere else

* Remove branches that don't seem to run anymore

I'm not 100% sure this is right but I can't get tests to fail.

* Be explicit about the difference between type and tag

I was confused by th HACK comment so I learned how DOM and SVG work with casing and tried to write a more descriptive comment.
It also seems like passing fiber.type into finalizeInitialChildren() is a potential problem because DOM code assumes tag is lowercase.
So I added a similar "hack" to finalizeInitialChildren() that is identical to the one we have prepareUpdate() so if we fix them later, we fix both.

* Save and restore host context when pushing and popping portals

* Revert parent context and adding children in the begin phase

We can address this later separately as it is a more hot path.
This doesn't affect correctness of SVG container behavior.

* Add a test for SVG updates

This tests the "jump" reuse code path in particular.

* Record tests

* Read ownerDocument from the root container instance

This way createInstance() depends on the innermost container only for reading the namespace.

* Track namespaces instead of creating instances early

While we might want to create instance in the begin phase, we shouldn't let DOM guide reconciler design.
Instead, we are adding a new concept of "host context". In case of ReactDOMFiber, it's just the current namespace.
We are keeping a stack of host context values, ignoring those that are referentially equal.
The renderer receives the parent context and type, and can return a new context.

* Pop child context before reading own context and clarify API

It wasn't quite clear from the API which context was being returned by the renderer. Changed the API to specifically ask for child context, and thus to pop it before getting the current context.

This fixes the case with <foreignObject> to which I intended to give SVG namespace.

* Give SVG namespace to <svg> itself

* Don't allocate unnecessarily when reconciling portals

We create stacks lazily so that if portal doesn't contain <svg>s, we don't need to allocate.
We also reuse the same object for portal host context state instead of creating a new one every time.

* Add more tests for edge cases

* Fix up math namespace

* Maintain a separate container stack

* Fix rebase mistakes

* Unwind context on errors

* Reset the container state when reusing the object

* Add getChildHostContext() to ReactART

* Record tests
2016-12-08 13:10:47 -08:00
Charlie Garcia
d77c42a26d Update CHANGELOG.md (#8518)
* Update CHANGELOG.md

* Update CHANGELOG.md
2016-12-08 12:07:53 -06:00
Ben Alpert
2161a6c92f Fix indentation for lint 2016-12-07 23:16:47 -08:00
Andrew Clark
f56eb89389 Add additional scheduling tests
Tests whether certain types of work can be performed after the deadline
has expired.
2016-12-07 23:09:08 -08:00
Andrew Clark
3a7844cabb Consolidate workLoop and deferredWork loop
Solves a few things:

- Moves code out of performWork into workLoop so that it can
be optimized.
- errorLoop (now clearErrors) is no longer called recursively.
- Removes a while (true) loop inside performWork (not that it really
matters for optimization, since performWork contains a try block and
will be deopted, anyway).
2016-12-07 23:09:08 -08:00
Andrew Clark
24a83a5eeb Extract commit phase passes into separate functions
By splitting these out, we ensure that they can be optimized by the
JS engine.
2016-12-07 23:09:08 -08:00
Andrew Clark
dcc17a966e Don't check for a pendingCommit on every iteration
Only check if we're in a deferred work batch and performUnitOfWork
returns null.
2016-12-07 23:09:08 -08:00
Andrew Clark
2508888a2b Errors thrown when detaching a ref should not interrupt unmount
If a ref throws while detaching, it should not prevent
componentWillUnmount from being called.

Additionally, errors thrown by removeChild should not be ignored, even
as the result of unmounting a failed subtree.
2016-12-07 23:09:08 -08:00
Andrew Clark
7e82214717 Error boundaries can only capture errors once per batch
Subsequent failures should propagate the error to the next boundary.
The conceptual model for this is

try {
  render();
} catch (error) {
  setStateToRecover();
  render();
}

Closes #8485
2016-12-07 23:09:08 -08:00
Andrew Clark
701d128fd1 Error recovery should have task priority
This uncovered a separate issue where some errors were being unscheduled
and rescheduled multiple times before flushing. Turns out we need to
check both a fiber and its alternate when determining if it represents a
failed unit of work. I didn't notice this before because we were
scheduling a new update on *every* boundary at the end of the commit
phase, not just the ones that captured an error during that commit. I
updated the unit tests to catch this in the future.
2016-12-07 23:09:08 -08:00
Andrew Clark
d4dd3408bd Remove tryComponentDidMount/Update in favor of commit phase try block
We still need tryComponentWillUnmount because deletion should be non-
interruptible.

Refactoring the commit phase to better handle errors also allows us
to switch between fast and slow versions of the work loop. The slower
version runs whenever there are captured errors; it must check each
unit of work to see if it has failed. The faster version runs in the
normal case where there are no errors. Whenever an error is thrown, we
switch from the fast work loop to the slow work loop.
2016-12-07 23:09:08 -08:00
Andrew Clark
db8539a47d Consolidate work loops
This makes it easier to track when we enter and exit a batch of work.

Further steps needed in this refactor:
- Get rid of tryComponentDidMount, tryComponentDidUpdate, etc. in
favor of the try-catch blocks that wrap each pass of the commit phase.
- Need to be able to switch between performing work that is possibly
failed (slower because it requires an extra check on each iteration) and
work that we know for sure has no errors.
2016-12-07 23:09:08 -08:00
Andrew Clark
5fcdebf712 Move commit phase outside of performUnitOfWork
This gives us the ability to complete a tree without having to commit it
within the same frame.
2016-12-07 23:09:08 -08:00
Brian Vaughn
9510ecfc5e Merge pull request #8521 from bvaughn/react-art-fiber
New fiber-based ReactART renderer
2016-12-07 18:35:48 -08:00
Ben Alpert
fccebad780 Don't set innerHTML if content is empty (#8526)
From D4296244:

> Each [...] had a component with innerHTML = '', causing us to go into HTML parsing code in the browser. Doing this takes 0.03ms per parse call which was 10x slower than skipping it.
2016-12-07 17:20:57 -08:00
Ben Alpert
4d71a9c580 Probably fix facts tracker 2016-12-07 16:04:47 -08:00
Brian Vaughn
81cb216288 Imported new ReactART fiber renderer
Split ReactART into stack and fiber targets. Added new ReactART test case for recently-fixed bug.
2016-12-07 15:35:53 -08:00
Brian Vaughn
9a3139121c Merge pull request #8520 from bvaughn/do-not-reset-inner-html-for-null-children
Do not reset inner html for null children
2016-12-07 15:35:13 -08:00
Brian Vaughn
bbdfc28002 Updated tests-passing 2016-12-07 15:34:32 -08:00
Sebastian Markbåge
343fb958f1 Add test for componentDidUpdate with a bailout in the middle (#8525)
This is one of the cases where Fiber diverges.
2016-12-07 15:14:32 -08:00
Liz
17f8e947fb 👏 designers are friends, not fodder for jokes (#8523) 2016-12-07 15:09:37 -08:00
Ben Alpert
29a1707911 Support parallelism on Circle (#8511) 2016-12-07 14:55:34 -08:00
Brian Vaughn
ae752dd550 Added additional test case for ReactFiberBeginWork reset-text 2016-12-07 13:54:39 -08:00
Ben Alpert
d8b591d584 Fix pull request detection on Circle 2016-12-07 13:45:06 -08:00
Brian Vaughn
f90e208849 Fixed linting error 2016-12-07 13:13:04 -08:00
Brian Vaughn
2533fa8d35 Do not reset innerHTML for elements with null children
This is required to support certain third party scripts as well as other fiber renderers (eg the new ReactART renderer)
2016-12-07 12:06:06 -08:00
Ben Alpert
6ca66f70ca Update facts-tracker for Circle (#8510) 2016-12-06 22:24:19 -08:00
Sebastian Markbåge
facce3d736 Use Portals to test batching across roots (#8508)
This doesn't work by default in Fiber, you have to opt-in with a Portal to
get the explicit ordering guarantees.
2016-12-06 13:46:36 -08:00
Sebastian Markbåge
48c7bbd980 [Fiber] Nits (#8507)
Some best practices.
2016-12-06 11:15:46 -08:00
Tom Occhino
2be0d93c77 Tweak Yarn installation to not run if it's already installed (#8496)
https://circleci.com/docs/install-and-use-yarn/
2016-12-04 11:00:30 -08:00
Sebastian Markbage
ee4984980e Get the "current" Fiber from each node along the path
This fixes the issue where using the .return pointer isn't guaranteed to
return the current Fiber so we might read the wrong props when we try
to get the current event.
2016-12-02 20:03:09 -08:00
Sebastian Markbage
2336b8183d Remove forwarding from tree traversal in EventPluginUtils
This is unnecessary forwarding since this is no longer injectable.
However, I'd like to use the injectable getInstanceFromNode from
TreeTraversal so this avoids a cyclic dependency.
2016-12-02 19:52:56 -08:00
Sebastian Markbage
910044a41d Add failing event handler test
When we perform an update to the event handler we properly update the
immediate Fiber pointer of a child to be the current. However, when we
bubble events we use the return pointer which is not guaranteed to point
to the current Fiber even if we start from the current.

This manifests itself when we bailout in a parent. So I made the tests
use a PureComponent to illustrate this scenario. There is already a failing
case but I'm adding another one too.
2016-12-02 19:33:24 -08:00
Tom Occhino
e44b526999 Add CircleCI badge to the Readme 2016-12-02 17:43:16 -08:00
Sebastian Markbåge
7169c515aa Fix lint (#8489) 2016-12-02 16:53:42 -08:00
Sebastian Markbåge
0723007e1e Merge pull request #8450 from sebmarkbage/fiberfinddomnode
[Fiber] Fix findDOMNode and findAllInRenderedTree
2016-12-02 16:34:46 -08:00
Ben Alpert
a104525e7f Only upload build if server exists (#8488) 2016-12-02 14:31:17 -08:00
Tom Occhino
153fe38403 Add circle.yml / CircleCI support (#8486) 2016-12-02 14:18:12 -08:00
Brandon Dail
33198b78c5 Merge pull request #8476 from AlanBreck/patch-1
Update reference-react.md
2016-12-02 09:16:39 -06:00
Brandon Dail
1cabbc2fd7 Merge pull request #8478 from lucas-aragno/add-return-to-render
Add return to render
2016-12-02 09:11:37 -06:00
Sebastian Markbage
a434f9e7af Fix findDOMNode and findAllInRenderedFiberTreeInternal
This strategy finds the current fiber. It traverses back up to the root if
the two trees are completely separate and determines which one is current.
If the two trees converge anywhere along the way, we assume that is the
current tree. We find the current child by searching the converged child
set.

This could fail if there's any way for both return pointers to point
backwards to the work in progress. I don't think there is but I could be
wrong.

This may also fail on coroutines where we have reparenting situations.
2016-12-01 21:21:05 -08:00
Sebastian Markbage
4fd1802ddf Additional findDOMNode tests
This is failing in Fiber without the fix. Because we have no deletions to rely
on in this case and the placement effects have already happened.
2016-12-01 21:03:24 -08:00
lucas
01eb94f04b Add return to render 2016-12-01 19:21:40 -03:00
Ben Alpert
361ce5c00b Add test for unmount/remount in a single batch (#8470)
Fails in Fiber.
2016-12-01 14:19:00 -08:00
Jacob Lamont
469d3c6461 Update reference-react.md 2016-12-01 14:35:48 -05:00
Dan Abramov
df9dc89333 Rename HostContainer => HostRoot, Portal => HostPortal (#8474) 2016-12-01 18:36:28 +00:00
Kurt Weiberth
7cd26024ce add dependencies to react-test-renderer and react-addons (#8467)
**What** and **Why**:

* When using npm version 2, `object-assign` and `fbjs` were not getting properly installed
* This PR adds `object-assign` and `fbjs` as explicit dependencies to both `react-test-renderer` and `react-addons`
2016-12-01 16:37:14 +00:00
Ben Alpert
981f461b70 Merge pull request #8463 from spicyj/travis
Update Travis config for new token
2016-11-30 21:03:01 -08:00
Ben Alpert
cb2927665c Fix insecure shell escaping in facts tracker 2016-11-30 21:02:44 -08:00
Andrew Clark
aa6279c41a Clear existing text content before inserting children (#8331)
Fixes a bug when updating from a single text child (or
dangerouslySetInnerHTML) to regular children, where the previous
text content never gets deleted.
2016-11-30 18:08:41 -08:00
Ben Alpert
06e8cedc0d Update Travis config for new token 2016-11-30 17:17:04 -08:00
Andrew Clark
e7eed5874f [Fiber] New error boundary semantics (#8304)
* Exit early in scheduleUpdate if a node's priority matches

This is a performance optimization and is unobservable. However, it
helps protect against regressions on the following invariants on which
it relies:

- The priority of a fiber is greater than or equal to the priority of
all its descendent fibers.
- If a tree has pending work priority, its root is scheduled.

* New error boundary semantics

- Recovering from an error boundary no longer uses Task priority by
default. The work is scheduled using whatever priority created the
error.
- Error handling is now a side-effect that happens during the
commit phase.
- The default behavior of an error boundary is to render null. Errors
do not propagate except when an boundary fails. Conceptually, this would
be like throwing an error from a catch block.
- A host container is treated like a no-op error boundary. The first
error captured by a host container is thrown at the end of the batch.
Like with normal error boundaries, the entire tree is unmounted.

* Fix broken setState callback test

* Add test for "unwinding" context when an error interrupts rendering

* Switch over primary effect types only

This avoids the need to create an export for every combination of bits.

* Only continue the work loop if the error was successfully captured

* Add more tests for incremental error handling

These tests are currently failing:

  ✕ catches render error in a boundary during partial deferred mounting
  ✕ catches render error in a boundary during animation mounting
  ✕ propagates an error from a noop error boundary during full deferred mounting
  ✕ propagates an error from a noop error boundary during partial deferred mounting
  ✕ propagates an error from a noop error boundary during animation mounting

The observed behavior is that unstable_handleError() unexpected gets called twice:

      "ErrorBoundary render success",
      "BrokenRender",
      "ErrorBoundary unstable_handleError",
  +   "ErrorBoundary render success",
  +   "BrokenRender",
  +   "ErrorBoundary unstable_handleError",
      "ErrorBoundary render error"

* Verify batched updates get scheduled despite errors

* Add try/catch/finally blocks around commit phase passes

We'll consolidate all these blocks in a future PR that refactors the
commit phase to be separate from the perform work loop.

* NoopBoundary -> RethrowBoundary

* Only throw uncaught error once there is no more work to perform

* Remove outdated comment

It was fixed in #8451.

* Record tests

* Always reset nextUnitOfWork on error

This is important so that the test at the end of performAndHandleErrors() knows it's safe to rethrow.

* Add a passing test for unmounting behavior on crashed tree

* Top-level errors

An error thrown from a host container should be "captured" by the host
container itself

* Remove outdated comment

* Separate Rethrow and Noop scenarios in boundary tests

* Move try block outside the commit loops
2016-11-30 16:54:20 -08:00
Ben Alpert
705c9bcfd2 Refs between fiber and stack (#8458)
I feel gross. Better ideas welcome.
2016-11-30 12:17:03 -08:00
Ben Alpert
545a193ef9 Fix isFiberMounted exports (#8465)
This got messed up in a merge conflict. It's only used for one invariant in renderSubtreeIntoContainer.
2016-11-30 12:04:00 -08:00
Dan Abramov
b1c988d0de Add tests for recovery from errors thrown in the reconciler (#8462)
Test that errors in the reconciler can be caught by error boundaries, and that we can still schedule updates if they are uncaught.
2016-11-30 17:00:14 +00:00
Dan Abramov
623f608aab [Fiber] Make bad element type message same as in Stack (#8460)
* Make bad element type message same as in Stack

This makes Fiber emit the same message as Stack (aside from the missing owner information).

* Add a separate test verifying error includes owner name

Fiber currently doesn't pass it. This is just to keep track of it as a todo.
2016-11-30 16:29:42 +00:00
Ben Alpert
6110c58584 Fix reordering of bailed out children (#8457) 2016-11-29 14:57:04 -08:00
cloudy1
150e4e8be6 Update tutorial.md (#8328)
* Update tutorial.md

fix "unknown: Unexpected token" in "codepen.io".

* tweaks per suggestion
2016-11-29 13:00:33 -08:00
Andrew Clark
ce3b7ca475 Add a document on higher-order components (#7869) 2016-11-29 10:47:54 -08:00
Ben Alpert
16bf429029 Fix fiber feature flag for ReactDOMProduction-test (#8451) 2016-11-28 23:36:05 -08:00
Ben Alpert
cbe59521af Add test for updating parent state in cWRP (#8448)
Fails in Fiber.
2016-11-28 19:05:24 -08:00
Ben Alpert
492057c76f Fix context getting (#8407) 2016-11-28 18:33:46 -08:00
Ben Alpert
a98e8227b8 Update release checklist (#8389) 2016-11-28 17:57:37 -08:00
Sebastian Markbåge
f634b813e1 Handle Bailed Out HostText update and MultiChildText test (#8371)
This handles the case where a host text bails out. In that case we need to
reuse its previous memoizedProps. We should also only schedule an actual
update if it did actually change its text content.

I updated the unit test to ignore comment nodes if we're using Fiber.
2016-11-28 17:26:49 -08:00
Dan Abramov
c74034589e [Fiber] Support iterables (#8446)
* Add iterable cases to MultiChildReconcile test

Stack currently supports rendering iterables, but Fiber does not.

Previously we didn't have any public API tests for iterables. We have tests for traverseAllChildren() which is shared between React.Children and Stack. However Fiber doesn't currently use it, and likely won't. So this commit is a first step towards actually testing iterable support via public API. The next step will be to port traverseAllChildren() tests to test React.Children API instead.

* Implement iterable reconciliation in Fiber

This uses the same exact algorithm as array reconciliation but uses iterator to step through.

This gets reconcile tests to pass again but introduces a regression in ReactMultiChildText case which uses Maps as children. It passed before because Maps were ignored, but now it's failing because this actually runs the Map code path in Fiber. We can throw early in this case when we want to follow up on this.

* Rewrite traverseAllChildren() tests against React.Children API

This function was used in React.Children and Stack.

The corresponding reconciliation functionality is being tested by ReactMultiChild tests.

So we can move these tests to ReactChildren and test its public API.
2016-11-28 23:44:56 +00:00
Ben Alpert
f1f07c4a23 Use latest instance when restoring controlled state (#8443) 2016-11-28 14:00:50 -08:00
Ben Alpert
a1feccd9e8 Record tests (#8444) 2016-11-28 11:37:21 -08:00
Sebastian Markbåge
a63cee8e24 Merge pull request #8441 from sebmarkbage/movefromstack
Move shared files out of stack folder
2016-11-28 10:59:11 -08:00
Sebastian Markbage
2faca7c13e Use public API in React Mount 2016-11-28 10:55:36 -08:00
Sebastian Markbage
af618cb84c Move setInnerHTML/setTextContent to shared 2016-11-28 10:55:36 -08:00
Sebastian Markbage
e2b9882a79 Move tests out of the Stack folder
So that we can share them with Fiber.

Also Server Rendering tests.
2016-11-28 10:55:28 -08:00
Daniela Borges
5545d43bc4 remove output field from debugger (#8440) 2016-11-28 18:19:49 +00:00
Brandon Dail
6947db1529 Use a closure to bind argument to callback in ReactErrorUtils (#8363)
* Use a closure to bind gaurded callback

This way the fake event isn't being implicitly passed into the event handler

* Add tests for ReactErrorUtils

Add fiber test report

Linting fixes
2016-11-28 16:54:57 +00:00
Christopher Chedeau
e24ec4a1b4 test 2016-11-26 17:08:10 -08:00
Christopher Chedeau
00c3ee40c2 Do not forward stderr 2016-11-26 16:53:05 -08:00
Dan Abramov
e34b995f84 Fix portal unmounting (#8422)
We used to terminate the search on host nodes, and then use the nested unmount algorithm.
However this means we didn't unmount portals inside the host nodes.

We will probably need to restructure this somehow but for now I just added a recursive call to unblock myself.
2016-11-25 21:43:56 +00:00
Dan Abramov
9c87506ad9 Update Flow to 0.36 (#8420) 2016-11-25 16:25:09 +00:00
Dan Abramov
a4dd68fb3d Add a test for nested portals (#8416) 2016-11-24 18:43:45 +00:00
Sebastian Markbåge
0ba8434a33 [Fiber] Remove output field (#8406)
* Remove output field

The idea was originally that each fiber has a return value. In practice
most of what we're modelling here are void functions and we track side
effects instead of return values.

We do use this for coroutines to short cut access to terminal yields.
However, since this can be nested fragments we end up searching the tree
anyway. We also have to manage this in transferOutput so it ends up being
as expensive. Maybe we can save some traversal for updates when coroutine
branches bail out but meh.

* Unmount child from the first phase of a coroutine
2016-11-24 10:03:14 -08:00
Fatih
2c17f47ac2 fix typo 'miss-configured' to 'misconfigured' (#8412) 2016-11-24 14:52:53 +00:00
brillout
8d291e91e6 remove dead link (#8411) 2016-11-24 14:35:48 +00:00
Sebastian Markbåge
7d2be2c9a7 Merge pull request #8400 from sebmarkbage/fibercontainerchildren
[Fiber] Update root children using appendChild/insertBefore/removeChild
2016-11-23 18:09:50 -08:00
Ben Alpert
8791325db0 Finish ReactGenericBatching (#8405) 2016-11-23 17:40:20 -08:00
Sebastian Markbage
ea3420471f Split initial children out of createInstance
The goal of this is to avoid passing an opaque data structure that needs
to be recursively searched by the host.

I considered having some helper for doing the recursion but I figured it
might be helpful to let the reconciler move this around. For example we
might want to create an instance in beginWork and add to it as we go.
This would let us avoid traversing the tree twice and would solve the IE11
perf issue.

So instead, we create the instance first then call appendChild. I could
just call the normal one but I figured that I would make a special one
just in case. For example if you wanted to perform commits on a separate
thread from creation. This turned out to be useful in ReactNoop where I
can avoid searching the array for an existing one since I know the child
isn't there already. (Although splitting placement into insertion/move
might be better.)

Finally, we need the ability to update an instance after all the children
have been insertion. Such as `<select value={...} />`. I called this
finalizeInitialChildren.
2016-11-23 17:38:35 -08:00
Dan Abramov
024e2a0259 Remove recursion from unmounting portals (#1) 2016-11-23 17:38:35 -08:00
Sebastian Markbage
fde18a4562 Assert that we always find a parent for DOM mutations 2016-11-23 17:38:35 -08:00
Sebastian Markbage
78add2dc63 Update root children using the appendChild/insertBefore/removeChild methods
This removes updateContainer and instead uses the regular child mutation
methods to insert into the root container and portals.

Since we're no longer clearing out the container DOM in updateContainer
we have to do that manually during initial mount. This now works on a
document and one of the tests end up unmounting the body when you render
into the document so I had to work around that bit since we don't yet
properly support rendering into the document root.
2016-11-23 17:38:35 -08:00
Ben Alpert
13cb540bda Lint 2016-11-23 17:31:41 -08:00
Ben Alpert
c5b6601536 Fix traversal up when unmounting (#8404)
Previously you could get an alternate when following .return in unmountHostComponents and this could revisit a node twice.
2016-11-23 16:07:25 -08:00
Ben Alpert
af659a2544 Re-record 2016-11-23 15:22:35 -08:00
Ben Alpert
1095d3f965 Preserve scroll position when restoring focus (#8401)
This misbehavior is particularly egregious because of our current strategy for updating a container in Fiber, but regardless -- if we restore focus to an offscreen node (ex: because it was reordered among its siblings) then we should not scroll the page to reveal it.

We could check the `overflow` computed style values before saving the scroll positions but that's unlikely to be any faster.
2016-11-23 14:55:17 -08:00
Sebastian Markbåge
224bdd8883 Remove config.beginUpdate (#8402)
I only used this to visualize changes when there were bugs in the
incremental reconciliation. We don't need it anymore.
2016-11-23 14:44:17 -08:00
Ben Alpert
53cdc4b288 Cleanup after #8353 (#8403) 2016-11-23 14:43:52 -08:00
Ben Alpert
caa01d498d Fix renderSubtreeIntoContainer with non-context-provider parent (#8399) 2016-11-23 14:23:45 -08:00
Ben Alpert
0c885af183 Restore DOM selection and suppress events (#8353)
This makes Draft mostly work.
2016-11-23 13:43:00 -08:00
Ben Alpert
7ac2044bce Fix queueing updates in cWM/cWRP when batching (#8398)
I tried to add a temporary check for the correct state in https://gist.github.com/spicyj/338147e989215b6eeaf48a6ce2d68d93 and run our test suites over it, but none of our existing test cases would have triggered that invariant. The new one I added does.
2016-11-23 13:00:49 -08:00
Sebastian Markbåge
7ef856aa36 Change the behavior to always fail childContextTypes if there is a method (#8391)
Even if that method returns falsy values.
2016-11-23 10:59:49 -08:00
Paul O’Shannessy
a3ba48bf72 Fix browser bundle for AMD (#8374)
* Fix browser bundle for AMD

* Final fix for standalone browser build.

Much more scientific than the rest so it should stick.

* Throw when we can't find code we need to replace.
2016-11-22 17:16:45 -08:00
Sebastian Markbåge
6beb87eb73 Merge pull request #8365 from sebmarkbage/fiberdom
[Fiber] Fix more tests
2016-11-22 16:19:15 -08:00
Sebastian Markbage
d71bd59a4e Passing disabled events 2016-11-22 16:16:47 -08:00
Sebastian Markbage
475a6492c7 Utilize the backtracking during events to figure out if a Fiber was unmounted
We're walking backwards up to the root to find the parent so that we can
propagate events further up to nested React parents. If we don't find a
root, that means that the tree was unmounted and we shouldn't send any
events to it.
2016-11-22 16:16:47 -08:00
Sebastian Markbage
a481016883 Preserve the original object when using replaceState
When we use only replace state we don't need to clone the object.
2016-11-22 16:16:46 -08:00
Sebastian Markbage
a489e3f057 Disable one irrelevant test for Fiber
We don't use transaction objects.
2016-11-22 16:16:46 -08:00
Sebastian Markbage
826e90f5a0 Don't test for comments in empty components for Fiber
Fiber doesn't use comments in empty components.
2016-11-22 16:16:46 -08:00
Sebastian Markbage
7dd8fc549e Implement the same search strategy in ReactTestUtils as findDOMNode
This was supposed to fix an issue in refs-test but instead it revealed that
this strategy is broken.

The problem is that Placement effect is not sufficient when the insertion
is completed since the effect flag is reset then and the previous tree
has no effects in it to indicate that this is the wrong tree.
2016-11-22 16:16:46 -08:00
Sebastian Markbage
be2ec3d5b8 Fix findDOMNode for empty children
If there is no child there is nothing to tell us that this was the
workInProgress branch. Therefore, we need to look at the other branch
if there are children in it to see if *that* was the workInProgress branch.
2016-11-22 16:16:46 -08:00
Sebastian Markbage
977357765b Drop "previous style" copy from Stack to bring it inline with Fiber
We've already been warning for mutating styles so now we'll freeze them
in DEV instead. This isn't as good because we don't have more specific
warnings than the generic error that doesn't even fire in sloppy mode.

This lets Fiber pass the same tests.
2016-11-22 16:16:46 -08:00
Sebastian Markbage
9ceed8d69b Track inputs after setting its properties
This used to be done at the end of the transaction but I made it synchronous.

For this to work it needs to be applied after we have already set the .type
property since it is read by inputValueTracker.
2016-11-22 16:16:45 -08:00
Sebastian Markbage
075f3043a7 Update the internal Fiber on the DOM node to always be the current
We need this to safely extract the current event listeners from the props.
Unfortunately, we are still not safe to use the return pointer since it
may not point to the current tree when the Fiber is reused. So this is not
fully done yet.
2016-11-22 16:16:45 -08:00
Sebastian Markbage
7149a26eba Allow EventListener to traverse up the tree until it hits the root
We use this to find the root node so that we can look for outer React
subtrees if this is nested.
2016-11-22 16:16:45 -08:00
Benoit Girard
9da0bf53f7 Include ReactDebugTool from inside __DEV__ to save 1.5KB (#8322) 2016-11-22 16:08:45 -08:00
Sebastian Markbåge
4358ff08bf Nit in regexp (#8388) 2016-11-22 16:06:31 -08:00
Sebastian Markbåge
f38c355cba [Fiber] Make server rendering tests pass (#8372)
* Use the public ReactDOMServer in tests

We need this because it runs the injection.

* Let Fiber skip react data attributes and comments in SSR tests

This markup is testing implementation details rather than behavior.
2016-11-22 16:03:50 -08:00
Ben Alpert
c7129ce1f0 Stopgap fix for element disabling (#8387)
Fix for #8308. This is a bad hack -- EventPluginHub.getListener isn't even DOM-specific -- but this works for now and lets us release 15.4.1.
2016-11-22 14:39:30 -08:00
Dan Abramov
6434c37649 [Fiber] Add ReactDOMFiber.unstable_createPortal() (#8386)
* [Fiber] Add ReactDOMFiber.unstable_createPortal()

While #8368 added a version of `ReactDOM.unstable_renderSubtreeIntoContainer()` to Fiber, it is a bit hacky and, more importantly, incompatible with Fiber goals. Since it encourages performing portal work in lifecycles, it stretches the commit phase and prevents slicing that work, potentially negating Fiber benefits.

This PR adds a first version of a declarative API meant to replace `ReactDOM.unstable_renderSubtreeIntoContainer()`. The API is a declarative way to render subtrees into DOM node containers.

* Remove hacks related to output field
2016-11-22 22:08:13 +00:00
Ben Alpert
8334bb088a Lint (#8385) 2016-11-22 12:04:40 -08:00
Richard Maisano
b59fb796ea Add a couple missing SVG tags to DOM Elements docs (#8383)
My first contribution to React!

While upgrading a React project, I found some suspect SVG that needed updating, so I dug in after checking the docs. I knew that support for some SVG properties had been added (namely `xmlns` and `xmlnsXlink`), but I noticed them missing from the reference's attribute list. This pull request updates `reference-dom-elements.md` by adding said properties.
2016-11-22 18:50:11 +00:00
Ben Alpert
cb6da8e922 Fiber: renderSubtreeIntoContainer (#8368) 2016-11-22 09:57:13 -08:00
Dan Abramov
f686218268 Revert "Stop relying on variable hoisting" (#8381) 2016-11-22 15:19:45 +00:00
Linus Unnebäck
93042c277e Stop relying on variable hoisting (#8380)
Only declare the variable once in this scope, instead of declaring them multiple times in the same scope.

This fixes #8318, even though it might technically be a shortcoming in Rollup.
2016-11-22 15:18:10 +00:00
Mikhail Osher
e958cdbd36 Fix object spread operator (#8378)
Object spread operator performs shallow copy of object's arguments, so it should be placed before new properties are assigned.
2016-11-22 15:01:23 +00:00
Simen Bekkhus
e64510ab21 Fix link to PureComponent in docs (#8375) 2016-11-22 11:09:07 +00:00
Robin Ricard
9334b771c2 Change test assertion depending on a feature flag (#8306)
Instead of a private API (see https://github.com/facebook/react/pull/8150#discussion_r88280994)
2016-11-22 00:17:13 +00:00
Ben Alpert
3438d503db Make findDOMNode generic (#8348) 2016-11-21 17:13:26 +00:00
Evan Scott
77c890dfa2 Update all Jest packages to 17.x (#8327)
* Update all Jest packages to 17.x, cache babel-jest transforms

* Remove the caching

Looking at the other builds it doesn't seem to actually be that necessary.  The bottleneck is executors, not build time.

* Remove unnecessary package, fix fiber test runner

* Regenerate yarn lockfile
2016-11-20 16:10:08 +00:00
Michael Sinov
501ac150f6 update react-without-es6.md (#8351) 2016-11-19 18:19:16 +00:00
Tom Occhino
dfdff2b61a Move all dev *Hook tests and ComponentTreeTestUtils to expectDev (#8350) 2016-11-18 18:53:48 +00:00
Sebastian Markbåge
0deb71223d Fix ReactDOMFiberSelect to set the initial values (#8349)
I forgot that the normal properties route doesn't do this. We also have
to make sure that the order is 1) insert children (options), 2) set
multiple 3) update the options.
2016-11-18 18:52:15 +00:00
Sebastian Markbåge
6741703fbf Merge pull request #8347 from sebmarkbage/fiberdom
[Fiber] Handle controlled components
2016-11-18 18:35:26 +00:00
Dan Abramov
12ef47ba8f Merge pull request #8346 from shubheksha/docs/improve-state-and-lifecycle
Improved sections of state and lifecycle docs
2016-11-18 18:24:27 +00:00
Dan Abramov
a0044be99d Minor changes, make it more verbose 2016-11-18 18:24:15 +00:00
Sebastian Markbage
c1daa6f2c1 Record tests and fix BrowserEventEmitter test to not crash jest 2016-11-18 18:08:40 +00:00
Sebastian Markbage
e06b335588 Add some Flow types to inputValueTracking
Not perfect but better.
2016-11-18 17:59:37 +00:00
Sebastian Markbage
9b6738805a Exclude data-reactroot from tests when using Fiber 2016-11-18 17:59:36 +00:00
Sebastian Markbage
6e04bd758e Apply @spicyj's SelectEventPlugin fix
This fixes some tests with Fiber since we no longer rely on Stack
internals for this.
2016-11-18 17:59:36 +00:00
Sebastian Markbage
632ae806e8 Give wrappers the raw props object
Wrappers operate on the raw props object instead of the processed one.

We should probably clean this up a bit since it is very confusing and
unnecessary allocations to have two separate objects for props.
2016-11-18 17:59:36 +00:00
Sebastian Markbage
a2ca759dfd Handle controlled components in Fiber
We need to adjust inputValueTracking a bit to handle the fact that
Fiber attaches wrapper state on nodes.
2016-11-18 17:59:36 +00:00
Sebastian Markbage
cd0f963fa3 Fix up Flow annotations to be a bit more explicit where the unsoundness is 2016-11-18 17:59:36 +00:00
Shubheksha Jalan
730dae1df6 Improved sections of state and lifecycle docs 2016-11-18 22:14:27 +05:30
Dan Abramov
57f0cf376f Merge pull request #8345 from shubheksha/docs/improve-introducing-jsx
Improved some sections of the introducing JSX docs
2016-11-18 16:20:48 +00:00
Dan Abramov
c47340acfb Small nit: add a sentence about readability back 2016-11-18 16:20:17 +00:00
Shubheksha Jalan
e4432c7f76 Improved some sections of the introducing JSX docs 2016-11-18 21:09:34 +05:30
Sebastian Markbåge
751b76e351 Merge pull request #8319 from sebmarkbage/fiberdom
[Fiber] Fork ReactDOMComponent
2016-11-18 13:39:50 +00:00
Dan Abramov
919aa36d69 Merge pull request #8339 from nolanlawson/patch-1
Update 2016-11-16-react-v15.4.0.md
2016-11-18 12:27:16 +00:00
Dan Abramov
1c861a0d48 Merge pull request #8332 from gaearon/prod-dev
[Docs] Expand Installation and clarify why use bundlers
2016-11-18 12:26:22 +00:00
Dan Abramov
0b1d56399b Nits 2016-11-18 12:26:06 +00:00
Dan Abramov
c91cc4d11a Nit 2016-11-18 12:25:23 +00:00
Sebastian Markbage
7246659f4d Consistent method vs function 2016-11-18 12:20:25 +00:00
Sebastian Markbage
836331ba5f Wire up ReactDOMFiberComponent in ReactDOMFiber
We'll need to do the DOM injection now.
2016-11-18 12:01:22 +00:00
Sebastian Markbage
61a1a50955 Split mountComponent into create and set initial properties
This lets us insert children in between these two steps.
2016-11-18 00:26:26 +00:00
Sebastian Markbage
4b017507e2 Don't pass the Fiber around instead use the DOM node
To avoid exposing the implementation details of fibers we'll just pass the
DOM node around instead. We'll attach any additional wrapper state on it.
We don't have to do it that way. We can also just invert the relationship
and put the node in the wrapper state.

I'll probably just get rid of the wrapper object and just put them as
expandos on the DOM.
2016-11-18 00:26:26 +00:00
Sebastian Markbage
e962e97f75 Satisfy Flow by assuming value is an array for multi-select 2016-11-18 00:26:26 +00:00
Sebastian Markbage
6dc04b73a7 Assert that this is a script tag
Also, use a fixed string for the HTML since this is always a script tag.
2016-11-18 00:26:26 +00:00
Sebastian Markbage
e58b050773 Pass the tag explicitly instead of reading it from the internal instance 2016-11-18 00:26:26 +00:00
Sebastian Markbage
2defc83f34 Stop using host parent/container internal objects
Instead we extract the namespace from the root element.
2016-11-18 00:26:26 +00:00
Sebastian Markbage
d2888a7dea Get rid of server side support for <option />
We read the wrapper state during initial mount for server rendering support
but Fiber doesn't use it and we don't need it. We also can't because we
haven't yet completed the parent that has the selected.

I will need to remember to always insert children before setting the
selected value on the parent <select />. That way the DOM will deal with
the `selected` property of option properly.
2016-11-18 00:26:26 +00:00
Sebastian Markbage
2ef2a8e6f5 Pass props explicitly instead of getting them off currentElement
We don't store currentElement and I'm trying to get rid of accessing the
Fiber directly inside the host config.
2016-11-18 00:26:25 +00:00
Sebastian Markbage
e42842f2cd getCurrentOwnerName
Instead of passing around the owner and the internal fiber everywhere we
can set current owner during each commit. That way we have it available
globally where ever we need it.

That way we don't have to pass it as a DEV only argument nor expose the
internal representation to the host config.

This doesn't actually get the current owner yet. Will do that in a follow
up.
2016-11-18 00:26:25 +00:00
Sebastian Markbage
43f07779c4 We only need the root attribute for warnings and server-side rendering
We don't need this for Fiber yet. We can possibly add an expando to check
if this is rendered with React or not.
2016-11-18 00:26:25 +00:00
Sebastian Markbage
a1645322a7 Lint issues
Most dead code
2016-11-18 00:26:25 +00:00
Sebastian Markbage
3a856091be Add some Flow and get rid of the typecheck annotations 2016-11-18 00:26:25 +00:00
Sebastian Markbage
aea55609bf No need for unmounting DOM components
We'll stop tracking the input value tracking. We'll also stop uncaching the
node because we can just let the garbage collector take care of that. This
makes it easier to release components in trees that never mounted.

This also removes an invariant error which is covered by unit tests.
This is necessary to separate regardless because we don't want this to
fire for a component that was started but was thrown away because it never
mounted. We can come back to that later.
2016-11-18 00:26:25 +00:00
Sebastian Markbage
77de47e378 Stop tracking event listeners on DOM nodes
Basically, we don't need to remove the event listeners because we can just
check if something is still mounted when they fire instead. We'll rely on
garbage collection to clean them up.
2016-11-18 00:26:25 +00:00
Sebastian Markbage
e1ed610740 Remove the notion of transactions
We don't need to wait for the commit phase to start listening to events
since we have the node.

Next we'll stop unlistening to events too and instead just check isMounted.
2016-11-18 00:26:24 +00:00
Sebastian Markbage
7cd26b9c71 Manage children inside DOM properties
Fiber manages children separately so we don't need to do it here.
However, we special case the text content children and
dangerouslySetInnerHTML.

This reveals a bug that we currently don't handle the case where we switch
from dangerouslySetInnerHTML or text children to element children, because
child insertions are handled before the parent updates. We could possibly
handle this case by removing all nodes before the first host child but
that is a bit unfortunate.
2016-11-18 00:26:24 +00:00
Sebastian Markbage
7c5ec42350 Remove _domID
Not used by Fiber
2016-11-18 00:26:24 +00:00
Sebastian Markbage
4073dc79d7 Remove instrumentation and nesting warning
The nesting warning isn't as important now that we use createElement and
I don't want to deal with this just yet.
2016-11-18 00:26:24 +00:00
Sebastian Markbage
447e0a12b5 Get rid of the previousStyleCopy
We have warned about not mutating styles already. At this point we can just
freeze the style object in DEV.

That way we can read it from the previous props object without storing
another copy of it.

Also delete the associated warning.
2016-11-18 00:26:24 +00:00
Sebastian Markbage
151094ce03 Rely on lazy listeners 2016-11-18 00:26:24 +00:00
Sebastian Markbage
82e1d7dac3 Remove child nodes flag
We're always eager in Fiber.
2016-11-18 00:26:24 +00:00
Sebastian Markbage
c8d877a4c4 Remove rootNodeID
We only use this to determine if something is mounted or not but I don't
think we really need to.
2016-11-18 00:26:24 +00:00
Sebastian Markbage
e34e8974db Remove markup related paths 2016-11-18 00:26:24 +00:00
Sebastian Markbage
ec178acf15 Turn ReactDOMFiberComponent into a singleton
And turn on Flow.
2016-11-18 00:26:23 +00:00
Sebastian Markbage
9c3e9fbb05 Fork ReactDOMComponent and the wrappers to Fiber
From now on any change to these have to be replicated to these files.

I will next start changing the implementation to work with Fiber.
2016-11-18 00:26:23 +00:00
Nolan Lawson
1ff4158fa0 Update 2016-11-16-react-v15.4.0.md
Edge and IE11 both show user marks and measures in the Dev Tools, so it's technically not accurate to say that only Chrome has this feature.
2016-11-17 15:53:41 -08:00
Tom Occhino
32f5b034ed Upgrade ESLint and dependencies, fix new lint errors, switch Travis to Yarn (#8309)
* Update ESLint to 3.10.2

Also pull in fbjs for extending properly, per @zpao. This also disables consistent-return, which has about 80 failing cases in React currently. If we'd like to turn this back on, we should do it separately and fix all the call sites properly (rather than just adding 'return undefined;' everywhere, which adds no value.

Fixes to all existing lint errors plus an update for yarn.lock to follow.

* Update yarn.lock after the eslint update.

* Fix all new eslint failures

Unfortunately I had to add three eslint-disable-next-line instances. All have explanations inline.

* Switch Travis to use yarn instead of npm
2016-11-17 22:16:44 +00:00
Dan Abramov
bd529a0237 Merge pull request #8335 from lacker/newlink
add link to useful doc
2016-11-17 19:09:04 +00:00
Ben Alpert
8ecb248e6d Make numerical refs work in Fiber (#8334) 2016-11-17 18:56:33 +00:00
Kevin Lacker
02966c7945 add link to useful doc 2016-11-17 10:49:02 -08:00
Dan Abramov
3d52856bb6 Update installation instructions on the blog 2016-11-17 16:05:49 +00:00
Dan Abramov
db140c887f Explain Installation in more detail 2016-11-17 15:55:56 +00:00
Dan Abramov
862cedee94 Merge pull request #8317 from marcysutton/master
docs(forms): add missing labels to forms doc
2016-11-17 14:25:03 +00:00
Dan Abramov
3186a8b984 Tweak examples 2016-11-17 14:23:20 +00:00
Kevin Lacker
ad347a3b92 include the version number in the header (#8315) 2016-11-16 16:26:21 -08:00
Marcy Sutton
e08be27b0c fix(a11y): add missing labels to forms doc
Showing how to create a form without labeling inputs is an accessibility anti-pattern. This change adds labels to the examples to address that. Codepen may still need to be updated depending on how that example is created.
2016-11-16 14:32:42 -08:00
Dave Voyles
b20b99eb26 Clarity on constructor of Board object for tutorial.md (#8224)
* Update tutorial.md

Is it possible to be more clear here?
 This implies that we are removing the constructor from GAME, and not board (which is what I believe the author is trying to say).
It took me several reads to understand. 

With this edit, it is now clear that the adjustment is being made to -Board- and not to -Game-

* also remove "for Board earlier"
2016-11-16 13:24:45 -08:00
Tanner
6cbdf90f19 Remove spread operator (#8273)
* Remove spread operator

I believe what was meant here was to express that you would create the new player object with all the previous properties of the existing player object in addition to now updating the score value. That being said, this is a simple example, and the player object clearly has no other values. Objects are not (by default) iterable using this operator, so this little piece does more harm than good. I believe the new example to be much clearer.

* Using Object.assign()

* Tweak wording
2016-11-16 11:59:16 -08:00
Sebastian Markbåge
aca2e04036 Merge pull request #8232 from sebmarkbage/treetraversal
Add support for Fibers in ReactDOMComponentTree and ReactTreeTraversal
2016-11-16 16:59:32 +01:00
Sebastian Markbage
4e2688db4a Extract event listener from memoizedProps on Fiber instances
This makes some basic events work with Fiber.

This is however not a complete solution since we may be reading the wrong
Fiber.
2016-11-16 15:56:13 +00:00
Sebastian Markbage
b3af02a3cd Add Fibers to ReactTreeTraversal
This traverses parent based on the type of internal instance it is passed.
If it is a Fiber it may have to traverse multiple steps until it finds a
HostComponent.

This will allow us to use the event system with Fiber.
2016-11-16 15:43:55 +00:00
Sebastian Markbage
57cc182f26 Add Fibers to ReactDOMComponentTree
This adds precaching to ReactDOMFiber. I.e. adding a handle from the DOM
node to the internal Fiber. This means that we need to expose an internal
handle to the reconciler.

We use duck typing to figure out if it is a Fiber or Stack instance.

The new failing tests are failing because this is now able to actually
fire events onto Fibers and then the result of those events are
incorrect where as they were ignored before.
2016-11-16 15:42:39 +00:00
tomocchino
d1a003ee72 Update website for 15.4.0
(cherry picked from commit 5ce8853ccb)
2016-11-16 14:51:47 +00:00
tomocchino
66ee428a61 Update Changelog & Readme for 15.4.0
(cherry picked from commit 443683525f)
2016-11-16 14:51:38 +00:00
Dan Abramov
203d3fb25e Merge pull request #8293 from gaearon/154-post
Add 15.4.0 blog post
2016-11-16 14:45:26 +00:00
Dan Abramov
e8c07b0a45 Add 15.4.0 blog post 2016-11-16 14:36:20 +00:00
Tom Occhino
9589c726da Fix a line-length warning (#8298)
Test Plan: npm run lint / yarn run lint
2016-11-16 10:33:16 +00:00
Sebastian Markbåge
dde670fd36 Reapply Check for event listener in props instead of bank (#8292)
* Reapply Check for event listener in props instead of bank (#8192)

This reverts the previous revert.

* Don't throw on falsy event listeners

Some code relies on passing null. This restores the earlier behavior.
2016-11-15 18:16:27 +01:00
Dan Abramov
4029ccd650 Merge pull request #8272 from gaearon/fiber-context
[Fiber] Initial implementation of context
2016-11-15 17:14:12 +00:00
Dan Abramov
2397f1fce6 Use empty object if context does not exist
This matches Stack behavior.
Had to rewrite a test that used Simulate because Fiber doesn't support events yet.
Also changed tests for componentDidUpdate() since Fiber intentionally doesn't pass prevContext argument.
2016-11-15 16:35:00 +00:00
Dan Abramov
1e42c1833c Add explicit tests for intermediate components 2016-11-15 16:08:15 +00:00
Dan Abramov
fd8c8038f0 Update passing tests 2016-11-15 14:49:54 +00:00
Dan Abramov
a6ee5b876a Memoize merged child context when possible
We can avoid recreating the merged context object if the context provider work was reused. This is essential to avoid allocations for deep setState() calls.
2016-11-15 14:41:59 +00:00
Dan Abramov
299009c41f Add test cases for context below and above setState 2016-11-15 13:23:29 +00:00
Andrew Clark
4528cddf51 Removes UpdateQueueNode.callbackWasCalled (#8290)
Tracking this isn't necessary.
2016-11-15 09:52:05 +00:00
Brandon Dail
024f62ecfe Merge pull request #8277 from qiuyuntao/master
docs: delete unnecessary brackets
2016-11-14 17:37:02 -06:00
Brandon Dail
cdcbf2f39b Update reference-react-dom.md (#8285)
Add missing closing bracket
2016-11-14 17:35:32 -06:00
Dan Abramov
137029be31 Catch first error from setState callbacks (#8287)
* Catch first error from setState updaters

* Minor style tweaks
2016-11-14 18:27:38 +00:00
Dan Abramov
eedca6f641 Disable memoized props bailout when context might have changed 2016-11-14 18:24:32 +00:00
Dan Abramov
56e1c126c5 Move context handling back into Begin and Complete phases
As per discussion, this is better because then this code only runs for the class type of work. We will still need to fix bailouts for deep setState calls.
2016-11-14 16:22:10 +00:00
Dan Abramov
f9e1bc9c97 Move context management into scheduler
It is error-prone to push and pop context in begin or complete phases because of all the bailouts. Scheduler has enough knowledge to see if pushing is necessary because it knows when we go inside or outside the tree.
2016-11-14 13:32:09 +00:00
Dan Abramov
c22b7a001c Add a failing test for context when reusing work
We mistakingly forget to push the context if the parent is being reused but the child is not.
2016-11-14 13:32:09 +00:00
Dan Abramov
4ba0eb9158 Add a test for recursive context 2016-11-14 13:32:09 +00:00
Dan Abramov
e6a0de5463 Fix bad ops.length assignment in tests 2016-11-14 13:32:09 +00:00
Dan Abramov
b8cca3711e Update passing tests 2016-11-14 13:32:09 +00:00
Dan Abramov
a05d1abee8 Minor style tweaks 2016-11-14 13:29:42 +00:00
Dan Abramov
12bee76ff7 Implement basic support for context 2016-11-14 13:29:42 +00:00
Dan Abramov
9a42f8a0c5 Update passing tests 2016-11-14 13:22:47 +00:00
Ben Alpert
4aa9cfb6ba Change warnings to use expectDev 2016-11-14 13:22:41 +00:00
Dan Abramov
69fc4d32b5 Minor style tweaks 2016-11-14 12:56:11 +00:00
Dan Abramov
c8451bd0d8 Catch first error from setState updaters 2016-11-14 12:55:59 +00:00
Anastasia A
3a7b3b070b Update reference-react-dom.md
Add missing closing bracket
2016-11-14 10:33:07 +03:00
Ben Alpert
64cba04bf9 Build infra for tracking dev-specific failures (#8228)
I'll plan to change all of our console.error and component-tree expects to expectDev. It's a little annoying that we need to make sure tests don't throw (see my change to normalizeCodeLocInfo) but any alternative would seem to require two separate test runs or a much more cumbersome syntax.
2016-11-13 14:00:07 -08:00
Dan Abramov
c6f10e2cee Change a test to be relevant in Fiber (#8281)
Fiber supports fragments so we will use undefined instead.
This test is then valid both in Stack and in Fiber.
2016-11-13 10:40:21 -08:00
yuntao.qyt
41b4d3958c docs: delete unnecessary brackets 2016-11-13 16:29:18 +08:00
Ankeet Maini
077822e9d0 Handles risky callbacks on setState. Fixes #8238 (#8242)
* Handles risky callbacks on setState. Fixes #8238

* Updates try-catch to cover `callback` when context is not present.

* Updates code to trapErrors instead of swallowing them.

* Fixes flow errors

* Incorporates review comments

* Traps only the first error.

Removes `callbackWasCalled` and updates fiber tests.
2016-11-12 12:51:36 -08:00
Samuel Scheiderich
9d201918bf Add freenode #reactjs link to support.md (#8270)
* Add freenode #reactjs link to support.md

* Changed irc link to http webchat link.
2016-11-11 13:21:46 -08:00
Dan Abramov
b9f65d9b1d Fix reactComponentExpect.toBeDOMComponentWithChildCount(0) regression (#8271)
This should fix 3e2680411e (commitcomment-19788988).
2016-11-11 17:26:19 +00:00
Sebastian Markbåge
4804518c26 Handle nested controlled events (#8251)
I came up with a contrived case of where nested controlled events could
fire within the same batch - but on different targets.

I think we came to the conclusion that controlled values typically cannot
use preventDefault so it is ok that they don't flush until after the event
has finished. So therefore we accumulate a queue of all the nested targets
within a batch and then restore state on all of them.

I'm still skeptical that this is the correct way to do controlled values.
The reason we have to do them in a single event loop is because when you
type, the sequence of values that get accepted or not can matter. I wonder
if there is a scenario we can come up with where you can fire multiple
inner events in an event loop and end up with batching causing problems.

This effectively just reimplements asap again but with no allocations for
a single target and no closure allocations.
2016-11-11 16:49:59 +00:00
Michele Bertoli
53e45e78e4 Make the Shallow Rendering example clearer (#8269)
* Make the Shallow Rendering example clearer

I was reading through the documentation, and I found that the `render` call on the `renderer` was missing.

* Use a regular function to define MyComponent
2016-11-11 15:34:11 +00:00
Brandon Dail
e43aaab254 Use _hostContainerInfo to track test renderer options (#8261)
* Use _hostContainerInfo to track test renderer options

The transaction is not available when unmounting or updating the
instance, so we track it using _hostContainerInfo

* Throw if hostContainerInfo is not populated in getPublicInstance

* Linting fixes

* Remove transaction from ref lifecycle code path

We don't need to pass the transaction around anymore since we store the
test options on _hostContainerInfo instead

* Remove unused argument
2016-11-11 14:35:18 +00:00
Dan Abramov
da021ca4ae Use ReactDOM.unstable_batchedUpdates in Fiber tests (#8263) 2016-11-10 21:28:49 +00:00
Dan Abramov
a9fa135fd8 [Fiber] Fix reactComponentExpect (#8258) (#8257)
* Add more reactComponentExpect tests

* Implement reactComponentExpect in Fiber
2016-11-10 21:27:07 +00:00
Dan Abramov
3e2680411e [Fiber] Fix reactComponentExpect (#8258)
* Add more reactComponentExpect tests

* Implement reactComponentExpect in Fiber
2016-11-10 21:19:57 +00:00
Ben Alpert
67dcc5861c Flow 0.34 (#8259) 2016-11-10 11:52:32 -08:00
Dan Abramov
e612826650 Revert "temporary compatibility fix" (#8256)
This reverts commit bba0d992d8.
2016-11-10 16:03:22 +00:00
Eoin Hennessy
6ce8f1f93c Refactor precacheChildNodes slightly (#8018)
This ‘fixes’ a bizarre IE9 script engine issue. #7803
2016-11-10 16:02:48 +00:00
Shuhei Kagawa
fa4710fe51 Correct a method param in Implementation Notes (#8252) 2016-11-10 14:19:27 +00:00
Satoshi Nakajima
3e708497d2 Replaced old refs with new callback refs (#8254) 2016-11-10 14:13:56 +00:00
Arni Fannar
f4059e5e5b Update refs-and-the-dom.md (#8250)
Since a lot of projects use [airbnb eslint config](https://www.npmjs.com/package/eslint-config-airbnb) where [this rule](http://eslint.org/docs/rules/no-return-assign) is enabled (and its a good rule) some people might get confused when they are trying this out in their project.
2016-11-09 14:45:21 -08:00
Guilherme Oenning
b847226ec4 fix broken docs links (#8163)
* fix broken links to outdated code

* another broken links to outdated code

* update hash commit & folder structure to current
2016-11-09 18:06:35 +00:00
jddxf
8267e1152e #8021 (#8241)
Fix gulp tasks: eslint and flow error on Windows
2016-11-09 16:51:02 +00:00
Ville Immonen
3668a2e678 Remove string ref from function component example (#8244)
Refs can't be attached to stateless functional components.
2016-11-09 16:38:36 +00:00
Toru Kobayashi
d0a8d8b951 [Fiber]Warn when shoulcComponentUpdate returns undefined (#8243)
* [Fiber]Warn when shoulcComponentUpdate returns undefined

* Remove unnecessary fallback
2016-11-09 16:30:41 +00:00
Sebastian Markbåge
84b8bbdfc9 Fixed batching reentrant controlled events (#8240)
If a controlled target fires within another controlled event, we should not
restore it until we've fully completed the event. Otherwise, if someone
reads from it afterwards, they'll get the restored value.

Not super happy with this particular solution.
2016-11-08 17:42:53 -08:00
Andrew Clark
f829e2f1f1 Meant to commit these changes with #8206... oops. 2016-11-08 13:47:31 -08:00
Kevin Lacker
3a09f4bf30 forms breakup 2016-11-08 21:38:03 +00:00
Andrew Clark
c33230e563 Merge pull request #8206 from acdlite/fibertasklifecycleupdates
[Fiber] Updates from inside componentDidMount/Update should have Task priority
2016-11-08 13:28:29 -08:00
Andrew Clark
d9d4ad60c5 Updates from inside componentDidMount/Update should have Task priority.
This is only observable in incremental mode.
2016-11-08 13:27:31 -08:00
Samer Buna
e25d899d23 Remove unnecessary findDOMNode calls (#8198) 2016-11-08 21:15:01 +00:00
Nate
2317fcaccb Fix typos in Shallow Rendering Documentation (#8226)
* Fix typos in Shallow Rendering Documentation

* Fix another occurrence
2016-11-08 20:29:27 +00:00
Keyan Zhang
46609cb95c Fix error codes (#7999)
* took codes.json from the 15-dev branch

* fixed react:extract-errors task in gulpfile

* generated error codes

* Revert "generated error codes"

This reverts commit b8f3aeed9d8f0d469edd5f6623fa6090930594d8.

* Added a README for the error code system
2016-11-08 20:20:46 +00:00
iurii kucherov
a0c510adaf Cleanup ReactErrorUtils (#8145)
Remove 'b' argument from Flow annotation
2016-11-08 20:16:20 +00:00
Sebastian Markbåge
b2eaafaf3b Revert "Check for event listener in props instead of bank (#8192)" (#8239)
This reverts commit a878c3056d.

The previous stuff that this builds on didn't successfully land fully. Since I
want to measure this in isolation, I'll revert this for now.
2016-11-08 11:32:54 -08:00
Kevin Lacker
d885894c6e Docs: add a bunch of redirects (#8137)
* add a bunch of redirects

* add more redirects
2016-11-08 19:32:02 +00:00
Robert Haritonov
ccf6f5922e Add React Amsterdam 2017 (#8235)
We've recently announced the dates for our next React Amsterdam edition, looking forward on adding it to the list.
2016-11-08 09:20:22 -06:00
Sebastian Markbåge
a878c3056d Check for event listener in props instead of bank (#8192)
This just reads events from the props instead of storing them in a
listener back.

I had to rewrite a bunch of tests to cover this model.
I removed the tests that just test the adding and removing over listeners
since there is no equivalent behavior anymore.
2016-11-07 20:36:58 -08:00
Sebastian Markbåge
2f893b5914 Revert normalized text node fix (#8231)
This reverts the implementation in 33325ad009.

I didn't mean to merge the implementation since it is incorrect and incomplete.
I meant to just merge the unit test.
2016-11-07 18:27:58 -08:00
Sebastian Markbåge
75691af209 Rerun tests (#8230)
* Ensure that we're listening to all onChange dependencies for controlled inputs

When there is no onChange event handler, we should still listen to it to
ensure controlled values get reset.

There is warning associated with this but the prod behavior should still be
respected.

* Rerun tests
2016-11-07 16:49:43 -08:00
Sebastian Markbåge
a93ab6b1af Ensure that we're listening to all onChange dependencies for controlled inputs (#8229)
When there is no onChange event handler, we should still listen to it to
ensure controlled values get reset.

There is warning associated with this but the prod behavior should still be
respected.
2016-11-07 16:47:10 -08:00
Sebastian Markbåge
a92b83033a Fix lint in ReactUpdates (#8225)
I was a bit too trigger happy.
2016-11-07 13:35:17 -08:00
Sebastian Markbåge
90878df08d Use explicit pass for restoring controlled state instead of asap (#8176)
* Use explicit pass for restoring controlled state instead of asap

This gets rid of the first class ReactUpdates.asap scheduling. Instead of
scheduling a first class function to invoke later, I introduce an explicit
phase for restoring controlled state after dispatching events.

We assume that the deepest event target is the thing that needs its state
restored.

* Drop special cases for onChange in wrappers

We're now not using anything special about onChange handling in the
wrappers. Yay!
2016-11-07 13:31:33 -08:00
Ben Alpert
75ff12e984 Run fiber tests just once on Travis (#8221)
Consolidate facts tracking with the other script.
2016-11-07 11:43:29 -08:00
Ben Alpert
c4b9330f2a Hide detailed failure output in scripts/fiber/record-tests (#8214)
![image](https://cloud.githubusercontent.com/assets/6820/20033841/a55fefa4-a367-11e6-99c0-44dfe38e1db7.png)
2016-11-07 11:43:02 -08:00
Ben Alpert
84c57ddc6d Fix errors in ReactNativeMount (#8223) 2016-11-07 11:42:39 -08:00
Robin Ricard
33325ad009 [Fiber] Attempt to fix ReactDOMTextComponent test in Fiber (#8146)
* Attempt to fix ReactDOMTextComponent test in Fiber

Obviously, some tests pass but the reconciliation is still incomplete on this in Fiber.

Those changes just ignore reconciliation Comments while asserting (this fixes 2 tests already) but now shows that Fiber lacks some reconciliation features.

* Transmit a parentInstance to commitTextUpdate

This is done in case a Node#normalize() was performed on the parent instance and that the TextInstance got desolidarized from the parent. We provide the parent known by the parent Fiber to reattach the DOM node in this case.

* Added a more complex case around split nodes

This test does not assume one split node substitution alone but also some non-split nodes.

* Fiber supports split text nodes

This is done by suppressing nodes appearing during the split. this is based by comparing against the old value known by the Fiber.

* Simplify siblings cleaning in commitTextUpdate

No need to assert instanceof Text since the length comparator will work correctly.

* Ensure non-text nodes won't be removed

* Fix flow for Fiber Text reconciliation additions

Mostly define types as optionals. Respects the strict DOM API around Node & Element.

* Append at any stack stage only if necessary

The direct parent of the TextNode fiber may not contain the host node. We have to go through the hierarchy. However, since this work may be expensive, we only do it if absolutely necessary!

* Use tag & ReactTypeOfWork to find an HostComponent

* Addfailing scenario when running Node.normalize()

It happens when non-text-elements are added in the mix. @sebmarkbage seems to have an idea on how to fix it. This is just a repro of the bug!

* Register failing/passing fiber tests
2016-11-07 11:39:52 -08:00
Sebastian Markbåge
95334fada0 Track if SelectEventPlugin is attached on a per document basis (#8190)
This gets rid of the global flag on if something has listened to onSelect
and instead reads the isListening map if all the events are covered.
This is required if we want to attach events locally at roots.

Could be slower perf wise to handle events. An alternative solution would
be to attach a special flag on the listener map for the document so we
don't have to check the full dependency list.

However, my favorite solution would be to just eagerly attach all event
listeners (except maybe wheel). Then we don't have to do any of this stuff
on a per element basis.
2016-11-07 11:30:34 -08:00
Alex Baumgertner
5166a1b446 Fix method markdown highlight (#8218) 2016-11-07 11:57:23 -06:00
Ben Alpert
f705adb599 Re-record tests 2016-11-05 14:59:22 -07:00
Ben Alpert
ef99e7e096 Call setState callbacks enqueued in cWM (#8207)
Also fixes return value of ReactNativeMount and moves that callback to be after cDM instead of after all updates.
2016-11-05 14:38:24 -07:00
Ben Alpert
5f49b63bde Move setState callback to right after didUpdate (#8204)
It's much easier to do it this way in Fiber and there shouldn't be much observable difference.
2016-11-05 14:37:43 -07:00
Robin Ricard
ba6b53afba [Fiber] Complete ES6 Class related errors support (#8156)
* Print a warning in fiber for lacking render method

* Reject initial non-object state in Fiber

Rejects Arrays, Strings & Numbers. Allows nulls.

* Centralize fiber checks on ES6 Classes

* Add classic & instance property checks on fiber

- check the absence of getInitialState & getDefaultProps as methods
- check the absence of propTypes & contextTypes at instance-level

* Convert to normalized React `warning` calls

* Support lifecycle typo detection in fiber

* Get the complete warnings from the existing code

* Only check classInstance once

Avoid rechecking while resuming

* Can warn component while resuming but only once

This is achieved by tracking the warning state in the Fiber structure.

* Remove warning deduplication

* Factor name retrieval in a getName helper

* Use invariant instead of throw

* Read inst.state only once for the invariant

* Fix condition on the instance state

* Register failing/passing fiber tests
2016-11-05 11:19:48 -07:00
Brandon Dail
e644faa610 Correctly render placeholder for textarea in IE11 (#8020)
* Check if textContent should be set for textarea

shouldSetNodeTextContent returns whether a node.textContent should be
updated. Currently it only covers one case, which is to avoid setting
the textContent if the text is empty and a placeholder exists.

* Only set node.value if it's equal to initialValue

In IE11 textContent is populated when the placeholder attribute is set.
Without this check, we end up setting node.value equal to the
placeholder text, causing the textarea to actually render with the text
inside.

This check makes sure that textContent is equal to our expected
initialValue, which should be the case when using defaultValue.

* Remove placeholder/textarea check, use contentToUse instead
2016-11-05 11:47:54 -05:00
Martin Hochel
346d50e2ba support slot attribute on DOM elements for V1 shadowDom named slots p… (#8061)
* support slot attribute on DOM elements for V1 shadowDom named slots projection

Closes #7784

* fix(test): fix lint errors
2016-11-05 11:34:54 -05:00
Andrew Clark
c1cca0c7d8 Don't need to keep track of rootsWithUncaughtErrors
Just give it NoWork priority and findNextUnitOfWork will handle the rest
2016-11-04 17:58:57 -07:00
Andrew Clark
c0c2455643 Merge pull request #8210 from gaearon/fiber-error-boundaries-fatal
[Fiber] Make error handling more resilient
2016-11-04 17:41:04 -07:00
Andrew Clark
ef14324441 Remove unscheduleWork
We can use the existing unscheduling logic in findNextUnitOfWork.
2016-11-04 17:37:09 -07:00
Dan Abramov
c80f390823 Make error handling more resilient
* Ensure that errors in one root don't prevent work on another root
* Fix an issue where boundary state change would get ignored in incremental mode
2016-11-04 23:35:50 +00:00
Dan Abramov
e2be9830b8 Create a separate test file for incremental error handling 2016-11-04 19:48:36 +00:00
Andrew Clark
4266f08e48 [Fiber] "Task" priority for error boundaries and batched updates (#8193)
* Refactor scheduling functions and introduce Task priority

There was lots of duplication across all the scheduling functions. I
think we're far enough along that we can start trying to clean some
stuff up.

Also introduces a new priority level provisionally called Task priority.
This is for work that completes at the end of the current tick, after
the current batch of work has been committed. It's different from
Synchronous priority, which needs to complete immediately.

A full implementation of Task priority will follow. It will replace
the current batching solution.

* Implement Task priority

Task priority is similar to Synchronous priority. Both are flushed in
the current tick. Synchronous priority is flushed immediately (e.g. sync
work triggered by setState will flush before setState exits), where as
Task is flushed after the current batch of work is committed.

Currently used for batchedUpdates and nested sync updates. Task should
also be used for componentDidUpdate/Mount and error boundary work. I'll
add this in a later commit.

* Make error boundaries use Task Priority

I have all but one error fixed. Not sure how tricky the last one is,
but I'm cautiously optimistic. Pushing to show my current progress.

* Remove recursion from handleErrors

Changed the algorithm of handleErrors a bit to ensure that boundaries
are not revisited once they are acknowledged.

* Add incremental error boundary test

Discovered an edge case: a noop error boundary will break in incremental
mode unless you explicitly schedule an update.

* Refactor error boundaries in Fiber

* Simplify trapError() calls

The existing logic was written before we had a proper error handling system.

* Remove unnecessary flags

* Prevent performTaskWork recursion

* Be stricter about preventing recursion
2016-11-04 19:40:50 +00:00
Ben Alpert
f4a42b872b Fiber: Fix reconciling after null (#8202)
Before, this code was bailing out after encoutering a null child because it thought it was out of old children. Seen when reconciling [null, <span />, <Image />] with [null, <span />, <Image />] in XUISelector.
2016-11-03 23:56:29 -07:00
Sebastian Markbåge
b20e3afbf5 Move Safari onClick hack into ReactDOMComponent (#8189)
This is already where we trap non-bubbling events. We also already branch
on the tag type so we know if it is interactive or not.

This will let us get rid of the didPutListener and willDeleteListener
abstractions.

I use a simple onclick = emptyFunction to avoid the need for a bookkeeping
map.
2016-11-03 15:26:23 -07:00
Brent Vatne
09ce083c4c Add Agent Conference to conferences docs (#8196)
* Add Agent Conference to conferences docs

* Move Agent Conference to upcoming conferences
2016-11-03 15:18:48 -05:00
Dan Abramov
857672f7e7 Update passing tests 2016-11-03 14:41:39 +00:00
Andrew Clark
29dbbc31c9 UpdateQueue fixes
- Incorrect comparison when computing hasUpdate
- isReplace should be a property of the node, not the queue
2016-11-02 23:00:00 -07:00
Sebastian Markbåge
3410ecadd1 ES import -> require (#8185)
Not all of our downstream build chains don't support ES imports yet.
2016-11-02 13:48:29 -07:00
Dan Abramov
c894679b75 [Fiber] Schedule animation regardless of deferred work (#8187)
* Remove comments about implementation details

* Schedule animation regardless of deferred work
2016-11-02 20:46:20 +00:00
Dan Abramov
eb674e47c8 [Fiber] Add tests for scheduling inside callbacks (#8186)
* Add tests for scheduling inside callbacks

* Don't test implementation details
2016-11-02 20:11:27 +00:00
Andrew Clark
75f4ab2206 Merge pull request #8127 from facebook/fibersynchronouswork
[Fiber] Use synchronous scheduling by default
2016-11-02 12:46:38 -07:00
Dan Abramov
95084bedbb Fix lint by removing unneeded type import 2016-11-02 12:45:15 -07:00
Andrew Clark
c3ab541e0f New effect type: Callback
This solves the problem I had with enqueueSetState and enqueueCallback
being separate.
2016-11-02 12:40:21 -07:00
Andrew Clark
2182b69004 batchedUpdates tests
Covers some bugs I encountered while working on this feature.

Introduces a syncUpdates API to ReactNoop. Is this something we'd want
to expose to the reconciler?
2016-11-02 12:40:21 -07:00
Andrew Clark
da45010cb7 Remove first-class function
Instead we'll branch on the priority level, like in scheduleWork.
2016-11-02 12:40:21 -07:00
Andrew Clark
3121e051a8 At the end of a batch, perform any sync work that was scheduled 2016-11-02 12:40:21 -07:00
Andrew Clark
26731ea967 unstable_batchedUpdates should return value of callback 2016-11-02 12:40:21 -07:00
Andrew Clark
2e5e88c750 Don't need defaultPriorityContext
Turns out this isn't necessary. Simpler to keep it as one field.
2016-11-02 12:40:21 -07:00
Andrew Clark
b41883fc70 unstable_batchedUpdates
Implements batchedUpdates and exposes as unstable_batchedUpdates. All
nested synchronous updates are automatically batched.
2016-11-02 12:40:21 -07:00
Andrew Clark
d153b1e27b Enqueue update and callback simultaneously
Without this fix, in non-batched mode, the update is scheduled first and
synchronously flushed before the callback is added to the queue. The
callback isn't called until the next flush.
2016-11-02 12:40:21 -07:00
Andrew Clark
ecf468e556 Batch nested updates when in sync mode
Almost working...
2016-11-02 12:40:21 -07:00
Andrew Clark
78aef38bfa Add config to enable sync scheduling by default
I'll turn this on in ReactDOMFiber once I figure out batchedUpdates.
2016-11-02 12:40:20 -07:00
Andrew Clark
7b9ae92058 Updates should use the same priority context as top-level render
A bit of restructuring so that setState uses whatever the current
priority context is, like top-level render already does.

Renamed defaultPriority to priorityContext, and added a new variable
called defaultPriorityContext. Having two separate variables allows the
default to be changed without interfering with the current context.
2016-11-02 12:40:20 -07:00
Andrew Clark
a07f5eede0 Synchronous work 2016-11-02 12:40:20 -07:00
Andrew Clark
ab920970ae Ensure first iteration of performAnimationWork loop has right priority
I don't think this actually changes any behavior because of the way
findNextUnitOfWork works, but I think this is easier to follow.
2016-11-02 12:40:20 -07:00
Dan Abramov
2b26ea614d Fix the build (these tests were renamed) 2016-11-02 19:28:26 +00:00
Dan Abramov
99be3781ef [Fiber] Add more tests for scheduling (#8183)
* Add more tests for scheduling

* Remove ambiguous terms
2016-11-02 17:49:22 +00:00
Sebastian Markbåge
e5d85fbe04 Remove pendingUpdate optimization in ReactDOMSelect (#8175)
This removes an optimization that avoids call update on ReactDOMSelect
twice in an onChange event.

2601b6a0b0 (commitcomment-19643403)

None of the other controlled components do this. The only reason to do it
here is because of the loop.

I'd like to remove this because I'd like to remove all the side-effects
that happen in onChange, other than user defined behavior. I'd also like to
get rid of state that track sequences. It is easier if everything is just
diffing.

Alternatively I can store the previous value that we processed and only
reprocess if the value has changed. However, that would requires the array
for multiple values to be immutable and I don't think we enforce that
right now.

In Fiber, I believe that we'll be able to batch both these updates into a
single commit.
2016-11-01 18:54:20 -07:00
Sebastian Markbåge
576542d0cf Handle the radio button case completely in the asap case (#8170)
Instead of scheduling individual callbacks to asap, we schedule one and
then do all the work in that one.

I'm doing this for architectural refactoring reasons.

Nevertheless, I'm adding a contrived unit test that this fixes. :)
2016-11-01 18:54:11 -07:00
Tetsuharu OHZEKI
33ac5e8e4b [Fiber] Assign ReactTypeOfSideEffect to ReactFiber.Fiber.effectTag correctly (#8173)
The type of `ReactFiber.Fiber.effectTag` is `TypeOfSideEffect`.
Thus we should assign `ReactTypeOfSideEffect.NoEffect` value instead of
`ReactPriorityLevel.NoWork` even if they are same values.
2016-11-01 23:24:55 +00:00
Dan Abramov
1a49b5f563 [Fiber] Fix infinite loop in scheduler and add more tests (#8172)
* Make test more complete

* Add a failing test for scheduling in reverse order

It hangs forever because we don't clear next pointer when unscheduling a root. Therefore, when it's scheduled again, it brings all its previous chain with it, potentially creating a cycle.

* Clear the next pointer when unscheduling a root

Fixes a potential infinite cycle when we reschedule a root.

* Add new tests to Fiber test tracker
2016-11-01 17:44:57 +00:00
Dan Abramov
ab02a03cad [Fiber] Add some scheduling tests (#8171)
* Extend ReactNoop to handle multiple roots

This lets us test scheduling between the roots.

* Add a few first tests for scheduler
2016-11-01 14:35:01 +00:00
Ben Alpert
08b4cc53b8 Track passing/failing tests in fiber (#8169)
* Work around jest toEqual bug in ReactTreeTraversal

![image](https://cloud.githubusercontent.com/assets/6820/19879640/1cd7595a-9fb2-11e6-94ac-8c38bdfc90d3.png)

* Track passing/failing tests in fiber

Run scripts/fiber/record-tests to re-record, then check git diff to see what you changed.
2016-10-31 23:26:38 -07:00
Yura Chuchola
abeae306e5 Update forms.md (#8136)
The component Form in "Uncontrolled Radio Button" example doesn't need state, because it does not used in render() method.
2016-10-31 17:35:20 -07:00
Sebastian Markbåge
34fd4f4aa0 Kill ReactLink, LinkedStateMixin, valueLink and checkedLink (#8165)
This should be safe because we've been warning for this. The LinkedStateMixin is technically exposed on React.addons without a warning but presumably you wouldn't be using it without a valueLink or checkedLink.

I do this primarily to clear up what the custom onChange listeners are doing.

Renamed the final prop type helper to ReactControlledValuePropTypes.
2016-10-31 16:45:01 -07:00
Damien Soulard
f53854424b update-unknown-warning-page - add a reason for the warning (#8131)
* update-unknown-warning-page - add a reason for this warning

* Minor tweaks
2016-10-31 13:01:06 +00:00
Skasi
abf37ea484 Remove duplicated word in doc (#8157)
Gets rid of an obsolete word in the documentation for "State and Lifecycle":

"Consider the ticking clock example from the one of the previous sections."
->
"Consider the ticking clock example from one of the previous sections."
2016-10-31 11:42:02 +00:00
bel3atar
980cb01a84 add missing verb (#8139)
`why is an` should be `why it is an`
2016-10-31 11:41:43 +00:00
Dan Abramov
264bed13ba [Fiber] Miscellaneous fixes to get more tests passing (#8151)
* Reset current owner when handling an error

* Make string ref deletion tests accept null

* Relax requirements on ref and render interleaving
2016-10-30 22:15:34 +00:00
Dan Abramov
c567b6e618 Remove use of reactComponentExpect in our tests (#8148) 2016-10-30 00:44:33 +01:00
Dan Abramov
c17bf38035 Get a few more Fiber tests passing (#8149)
* Get a few more Fiber tests passing

* Fix Flow and wrap in __DEV__
2016-10-30 00:43:34 +01:00
Robin Ricard
6d747a7426 [Fiber] Fix tests for Fiber in ReactElement-test (#8150)
* Test Fiber internals differently in ReactElement

Instead of being able to access the owner's instance via getPublicInstance(), we use the Fiber's stateNode. (Fiber does not have methods, it's just a structure!)

* Fix isCompositeComponentWithType for fiber

In ReactTestUtils.isCompositeComponentWithType, we provide a way to walk through Fiber's internals in place of using _currentElement.type. We keep support for non-fiber though.

* Test fiber reconciler consistently

Use typeof instance.tag to test if we're using the fiber reconciler

* Remove unnecessary comment
2016-10-30 00:42:59 +01:00
Dan Abramov
928541dc9e [Fiber] Fix TestUtils.findAllInRenderedTree (#8147)
* [Fiber] Fix TestUtils.findAllInRenderedTree

* Add a comment about coroutines
2016-10-29 22:02:13 +01:00
Lee Sanghyeon
f29a7bac0e Update codebase-overview.md (#8142)
* Update codebase-overview.md

Fix the broken source code URL in 'Event System' section.

* Update codebase-overview.md

Re-fix link name
2016-10-29 13:01:41 +01:00
Maksim Shastsel
9dc7a9594a Add support for node v7 (#8135) 2016-10-29 11:24:12 +01:00
Andrew Lo
1efb7a4e35 In the community support doc, I noticed that the React Facebook (#8138)
page link is broken since it's missing '.com'.
2016-10-29 00:31:01 +01:00
Andrew Clark
1152ced3dc Merge pull request #8133 from gaearon/error-boundaries-more
[Fiber] Error boundaries should handle errors independently
2016-10-28 14:58:54 -07:00
Dan Abramov
ed11b35302 The issue with tests is solved now 2016-10-28 21:48:37 +01:00
Dan Abramov
d8441cd725 Handle multiple errors in boundaries 2016-10-28 21:22:59 +01:00
Dan Abramov
c08469a7d6 Add tests verifying we don't swallow exceptions 2016-10-28 21:22:59 +01:00
Dan Abramov
f51abe0b55 Add a failing test for multiple independent boundaries
Now that commits are treated as atomic, it is possible that componentDidMount, componentDidUpdate, or componentWillUnmount threw in multiple places during the commit. We need to make sure we notify all affected boundaries of the first errors in them.
2016-10-28 21:22:58 +01:00
Dan Abramov
bd3c90ac6f Add more tests for error boundaries 2016-10-28 21:22:58 +01:00
Gant Laborde
6825773882 Organize and add confs (#8129)
Upcoming proximity followed by past chronological.
2016-10-28 11:21:21 -07:00
mfijas
4bca777131 Updated tutorial.md (#8054)
Fixed method name (renderStep -> renderSquare).
Removed <li>'s key to present the warning described below the code fragment.
2016-10-28 10:28:44 -07:00
Dan Abramov
3c6abbfff7 [Fiber] Error Boundaries (#8095) 2016-10-28 10:29:14 +01:00
Sebastian Markbåge
308e0b7786 Merge pull request #8128 from sebmarkbage/fiberdom
[Fiber] Some early refactoring to be able to reuse the event system
2016-10-27 23:18:43 -07:00
Sebastian Markbage
ea47782aaa Create ReactGenericBatching injection wrapper around BatchedUpdates
This moves calls that don't know if they're in a Fiber or Stack
context to use ReactGenericBatching.batchedUpdates.

The corresponding one will be injected from either the stack
reconciler and/or the fiber reconciler if they're loaded at the
same time.

This lets them share the event system when they're both used
at once.

This can also be useful for libraries that call
unstable_batchedUpdates today but don't know which renderer to
use.
2016-10-27 18:57:30 -07:00
Sebastian Markbage
2f8d1689db Refactor ResponderEventPlugin to not rely on _rootNodeID
Instead of relying on IDs, we now use instances for everything so
this should be reflected by the test.

This still has a _rootNodeID to store the listeners which I will
remove next.
2016-10-27 18:54:15 -07:00
Eugene
0e23880d22 Update reference-react-component.md (#8126)
line 320: For example, this code ensures that the `color` prop is a string
2016-10-27 19:25:43 +01:00
Rick Beerendonk
346dcaacfa Add React Remote Conf 2016. (#8094)
Add video links to some conferences.
2016-10-27 11:25:14 -07:00
Sebastian Markbage
2633a4284f Move more files into stack reconciler
CallbackQueue and Transaction are specific to the stack
reconciler.
2016-10-27 11:04:23 -07:00
Dan Abramov
e1b140225a Clarify how transition props work (#8124) 2016-10-27 14:21:34 +01:00
Ivan Zotov
b3b13919c7 Improve devtools image size for the tutorial (#8114) 2016-10-27 13:54:18 +01:00
Andreas Möller
1e126c29dd Fix: Remove unneeded else branches from documentation examples 2016-10-27 13:12:37 +01:00
Dan Abramov
a4b9abff42 Consistent CodePen links in docs 2016-10-27 13:06:09 +01:00
Ivan Zotov
6fec6507ed Fix lint errors (#8113) 2016-10-27 13:03:32 +01:00
Varun Bhuvanendran
603b7194dc added word break (#8120) 2016-10-27 13:01:51 +01:00
Lewis Blackwood
dba8f25854 Correct usage of formatName() function in docs (#8122)
The code section above these changes defines a `formatName` function
that expects a parameter `user`. The code section containing these
changes incorrectly called `formatName(user.name)`. For those following
along with CodePen, this section should correctly call
`formatName(user)`.
2016-10-27 13:01:04 +01:00
Josh Perez
6eebed0535 Shares debugID information across modules (#8097)
Prior to this, React was using a nextDebugID variable that was locally
scoped to both `instantiateReactComponent` and `ReactShallowRenderer`.
This caused problems when the debugIDs would collide, the `itemMap` in
`ReactComponentTreeHook` would be overwritten and tests would fail
with the message "Expected onBeforeMountComponent() parent and
onSetChildren() to be consistent".

This change shares the debugID with both modules thus preventing any
collisions in the future.
2016-10-27 10:31:10 +01:00
王晓勇
e3688d1fa3 Update forms.md (#8121) 2016-10-27 10:26:31 +01:00
Andrew Clark
e031e0be3c Merge pull request #8118 from facebook/fiberpurecomponent
[Fiber] PureComponent
2016-10-26 21:13:43 -07:00
Andrew Clark
59c94648c4 PureComponent in Fiber
Passes existing PureComponent tests
2016-10-26 21:02:39 -07:00
Dan Abramov
cc3dc21be0 Tweak Forms 2016-10-27 02:02:29 +01:00
Eric Nakagawa
552033e33b Docs update - Additional (#8115)
* Reapplied fixes to updated docs from master

* Reapplied fixes to Forms, removed ES2016 function includes()

* Missing carriage return

* Adding back some line breaks

* Making requested changes.

* Making space changes

* Fixed typo and removed unnecessary hyphen.

* Reworded select, and highlighted line

* Fixed string styles

* Refactored <label> to use htmlFor

* Another refactor of <label>

* Removed name prop from radiobutton
2016-10-27 00:14:08 +01:00
Eric Nakagawa
47e665a2fc Forms Update (#8112)
* Reapplied fixes to updated docs from master

* Reapplied fixes to Forms, removed ES2016 function includes()

* Missing carriage return

* Adding back some line breaks

* Making requested changes.

* Making space changes
2016-10-26 13:45:25 -07:00
Toru Kobayashi
2ef12084e4 [Fiber] Add top level render callbacks into ReactDOMFiber and ReactNoop (#8102)
* [Fiber] Add top level render callbacks into ReactDOMFiber and ReactNoop

* [Fiber] Support multiple render callbacks

* [Fiber] `this` in render callbacks are public instances

* [Fiber] commitLifeCycles move to behind the effectTag check
2016-10-26 13:19:19 -04:00
Alex Katopodis
2ba571c246 Fix typo in reconciliation.md (#8110) 2016-10-26 17:13:55 +01:00
Lutz Rosema
42465eefed Use const instead of var (#8107)
It clarifies that `history` and `current` won't be reassigned.
2016-10-26 15:20:09 +01:00
Andrew Clark
d5eff3b0eb [Fiber] String refs and owner tracking (#8099)
* Implement string refs using callback closures

* Merge Fiber type to avoid Flow intersection bugs

Still one remaining type error that I'm not sure how to fix

* Fix Flow issue with an unsafe cast

* Fix missing semicolon

* Add a type import I missed earlier
2016-10-26 14:37:32 +01:00
Jae Hun Lee
ce2dee32fd Update lists-and-keys.md (#8090)
There is mismatching variable name both definition and usage.
In line 156, an argument name called item is change to match the usage in line 158.
2016-10-26 14:17:21 +01:00
Toru Kobayashi
d49dfe7da4 Fix an argument name of TestUtils.renderIntoDocument (#8104) 2016-10-26 13:44:46 +01:00
Sebastian Markbåge
7bcad0a6aa Merge pull request #8083 from sebmarkbage/fiberfinddomnode
[Fiber] Implement findDOMNode and isMounted
2016-10-26 02:52:20 -04:00
Sebastian Markbåge
51e1937dd6 Merge pull request #8028 from sebmarkbage/nodidupdateforbailout
[Fiber] Don't call componentDidUpdate if shouldComponentUpdate returns false
2016-10-25 18:21:40 -04:00
Sebastian Markbage
46bde58486 Don't call componentDidUpdate if shouldComponentUpdate returns false
This fix relies on the props and state objects being different
to know if we can avoid a componentDidUpdate. This is not a great
solution because we actually want to use the new props/state
object even if sCU returns false. That's the current semantics
and it can actually be important because new rerenders that are
able to reuse props objects are more likely to have the new props
object so we won't be able to quickly bail out next time.
I don't have a better idea atm though.
2016-10-25 15:21:05 -07:00
Sebastian Markbåge
3d48139dd7 Merge pull request #8096 from sebmarkbage/fiberdom
Merge React[DOM/Native]TreeTraversal
2016-10-25 17:52:16 -04:00
Sebastian Markbage
8df7afc689 Merge React[DOM/Native]TreeTraversal
These two implementations are identical. Except for some
invariants for some reason.

Since this relies on an implementation detail of the internal
component tree rather than an implementation detail of the
renderer, we might as well merge them and remove the injection.
2016-10-25 14:37:46 -07:00
Sebastian Markbage
8e2d7f8d27 Add tests for findDOMNode on fragment and text
These are new features that aren't covered by existing tests.

It is now possible to use findDOMNode to find a text node.

When a component returns a fragment, it will search to find the
first host component just like element.querySelector does.
2016-10-25 13:59:34 -07:00
Sebastian Markbage
d5752aca0d findDOMNode when a component is not yet mounted or unmounted
First we need to check if a component subtree is mounted at all.

If it is, we need to search down the fiber for the first host
node. However, we might be searching the "work in progress"
instead of current.

One realization is that it doesn't matter if we search work in
progress or current if they're the same. They will generally be
the same unless there is an insertion pending or something in
the alternate tree was already deleted. So if we find one of
those cases, we switch to look in the alternate tree instead.
2016-10-25 13:59:34 -07:00
Sebastian Markbage
1914f94041 Handle unmounted and not-yet-inserted subtrees in isMounted
There are two cases where we have a Fiber that is not actually
mounted. Either it is part of a tree that has not yet been
inserted or it is part of a tree that was unmounted.

For the insertion case, we can check the parents to see if there
is any insertion effect pending along the parent path.

For deletions, we can now check if any of the return pointers
is null without actually being the root.
2016-10-25 13:59:34 -07:00
Sebastian Markbage
1376048bd9 Clear effectTag and return pointers after side-effects
This will let us use these pointers to reason about a tree.
Whether if it is "current" or "work in progress".
2016-10-25 13:59:33 -07:00
Sebastian Markbage
2e040fc2c1 Implement isMounted for Fiber
This is the naive implementation that doesn't cover the case
where it has completed but not yet committed. It also doesn't
deal with unmounts since they currently don't clean up the item
in the ReactInstanceMap.
2016-10-25 13:59:33 -07:00
Sebastian Markbage
298d0c3e05 Implement findDOMNode for Fiber
This is the naive implementation that doesn't cover the case where there are
two diverging fibers, or if this tree is unmounted.
2016-10-25 13:59:31 -07:00
Sebastian Markbåge
e3131c1d55 Merge pull request #8086 from sebmarkbage/fiberdom
[Fiber] Reorganize files for DOM renderer to make overlap between fiber/stack clearer
2016-10-25 15:56:30 -04:00
Sebastian Markbage
a3fb0310ca Reorganize files
This is just moving a bunch of DOM files.

It moves things into dom/stack and dom/fiber respectively. The
dom/stack folder remains split into client/server.

Mainly the shared folder is now my best guess for files that
we can reuse in fiber. Everything else will get forked or
reimplemented.

Also moved the event system out of renderers/shared/stack and
into renderers/shared/shared.
2016-10-25 10:54:14 -07:00
Sebastian Markbåge
ea8cf7fbff Delete child when the key lines up but the type doesn't (#8085)
When keys line up in the beginning but the type doesn't
we don't currently delete the child. We need to track that this
fiber is a not a reuse and if so mark the old one for deletion.
2016-10-25 12:51:53 +01:00
Dan Abramov
225325eada Add Fiber Debugger (#8033)
* Build react-noop as a package

This lets us consume it from the debugger.

* Add instrumentation to Fiber

* Check in Fiber Debugger
2016-10-25 08:36:37 +01:00
Sebastian Markbage
b26168cadb DefaultEventPluginOrder -> DOMEventPluginOrder
This is not a generic plugin order. It's DOM specific. Unlike
say DefaultBatchingStrategy which is used by Native too.
2016-10-24 19:59:04 -07:00
Sebastian Markbage
4ba8bef19a Split DefaultInjection into two files
This splits DefaultInjection into one with all the properties
and event configuration and a separate one for the things that
are relevant to he stack reconciler.

That way we can reuse the property and event system for Fiber
without pulling in all the other stuff.
2016-10-24 19:44:55 -07:00
Sebastian Markbage
b0ccf62ea3 Get rid of ReactInjection
We don't use this indirection. It'll easier to break these apart
without it.
2016-10-24 19:16:56 -07:00
Dan Abramov
265ab83667 Respect state set in componentWillMount() on resuming (#8079)
When resuming creating new instance after resuming work, we should set the `state` on the newly creating instance rather than the old one.
2016-10-25 00:21:56 +01:00
Sergey Rubanov
9626c838cb Add npm v4.0.0 support (#8082) 2016-10-24 23:57:12 +01:00
Constantin Gavrilete
82d592a0fa removed duplicated 'the' (#8081) 2016-10-24 17:34:58 -05:00
Sebastian Markbåge
06e3b03132 Merge pull request #8078 from sebmarkbage/rmcomment
Remove copypasta comment
2016-10-24 13:49:51 -04:00
Sebastian Markbage
7991a00dcc Remove copypasta comment
Caught by @gaearon
2016-10-24 10:49:10 -07:00
Antti Ahti
954a70e591 Remove deprecated function from tests (#6536)
This has been deprecated since 2013 so it's about time to remove it.
2016-10-24 18:46:38 +01:00
Dan Abramov
14156e56b9 Strip PropTypes checkers in production build (#8066)
* Strip PropTypes in production build

* Revert "Warn if PropType function is called manually (#7132)"

This reverts commit e75e8dcbeb.
2016-10-24 18:43:31 +01:00
Dan Abramov
e1ee94ca17 Add more highlighting to docs (#8076)
* Tweak JSX in Depth

* Add highlighting to Refs and the DOM

* More tweaks
2016-10-24 15:48:46 +01:00
Toru Kobayashi
6cdc610bcc [Fiber] Add types for ReactFiber and ReactChildFiber (#8072)
* Add Types for ReactFiber

* Add Types for ReactChildFiber
2016-10-24 14:20:44 +01:00
Marcio Puga
6fa1ddbdb4 Fix typos (#8067) 2016-10-24 13:50:04 +01:00
Ashish
8333b891e4 Docs : Fix createClass reference (#8073)
Currently react.createClass is wrongly referenced to #react.createclass. Changed it to #createclass!
2016-10-24 13:34:17 +01:00
Sebastian Markbåge
69d725f764 Merge pull request #8055 from sebmarkbage/fiberclassname
Accept className in ReactDOMFiber
2016-10-23 17:04:03 -04:00
Dan Abramov
156639241e Remove references to createClass in createElement docs (#8064) 2016-10-23 15:48:58 +01:00
Dan Abramov
46eca10046 Link to lifecycle methods from Context doc (#8062) 2016-10-23 14:35:23 +01:00
Andrew Poliakov
4e98dba6d3 Update tutorial.md, Taking Turns (#8058) 2016-10-23 13:49:55 +01:00
Alireza Mostafizi
e527b3a464 Update handling-events.md (#8057) 2016-10-23 13:44:29 +01:00
William Hoffmann
29f5da8de4 Fix typo (#8056) 2016-10-23 13:44:08 +01:00
Giuseppe
74026fd9ea Docs replace reference to 'getInitialState' with 'state' instance property in "Thinking in React" (#8059) 2016-10-23 13:41:37 +01:00
Sebastian Markbage
51f1205fb4 Accept className in ReactDOMFiber
This isn't a complete solution to all attributes. It's just that
we run a lot of unrelated unit tests by testing className so
we need it for the tests.
2016-10-22 17:57:33 -07:00
Jason Grlicky
952bdca020 Fix for typos (#8046) 2016-10-22 16:50:24 -07:00
Jun Kim
284a96b9a6 Fix illogical code in tutorial.md (#8048)
The tutorial wants to throw a 'warning' and explains about 'key' of React's list, but it throws nothing since there is sensible key.
"key={move}" should be removed, and added after explaining about key.
2016-10-22 16:49:07 -07:00
Diego Muracciole
461a74115c Injected Host Component classes are not being considered by the reconciler (#8050)
* Consider Host Component classes when creating a new internal instance

* Remove unused tagToComponentClass & injectComponentClasses from ReactHostComponent
2016-10-22 17:28:37 -05:00
Phil Quinn
cf37402338 correct order of params in documentation (#7989) 2016-10-22 21:59:54 +01:00
Brad Vogel
01753cde85 "take part in" is the correct saying (#8013) 2016-10-22 21:57:57 +01:00
Sebastian Markbåge
57f07777ef Fix relative link in Hello World (#8041)
* Fix relative link in Hello World

This links https://facebook.github.io/docs/installation.html which redirects to https://code.facebook.com/

* Update hello-world.md

* Fix link
2016-10-22 21:56:53 +01:00
Oskari Mantere
38c22252f4 Replace vars with let and const (#8051) 2016-10-22 21:55:29 +01:00
Avinash Kondeti
6810627a91 Fix: updated with new docs links (#8049) 2016-10-22 21:53:52 +01:00
Jun Kim
37f94bd3bb Fix typo in tutorial.md (#8047)
changges -> changes
2016-10-22 21:52:29 +01:00
Taeho Kim
a5ff2f1e9c Fix typo in new tutorial code (#8045) 2016-10-22 21:46:51 +01:00
Nathan Hardy
f7cb6cbe15 Fix erroneous '}' in JSX examples (#8043) 2016-10-22 21:45:29 +01:00
Cody Reichert
4d3c5ea23c Fix anchor link for displayName (#8040) 2016-10-22 21:44:51 +01:00
Ragnar Þór Valgeirsson
7340fa9d93 Convert the Number component to ListItem (#8039)
* Convert the Number component to ListItem

* Add updated example CodePen

Also fixes typos.
2016-10-22 21:44:28 +01:00
BEAUDRU Manuel
54dfe0b43c Wrong library name reference in tutorial.MD (#8038)
* Update tutorial.md

Seems like you are talking about immutable.js and not immutability.js which doesn't exist :)

* Capitalize Immutable.js
2016-10-22 21:43:15 +01:00
Ben Alpert
fa82e3e9d6 Update website on Travis when only new files are added (#8037)
This build didn't commit the new files because no existing files were changed:

https://travis-ci.org/facebook/react/jobs/169622664

This should work better.
2016-10-22 21:41:29 +01:00
Christopher Chedeau
4812f26915 Update components-and-props.md
fb indent style
2016-10-21 18:30:25 -07:00
Christopher Chedeau
eb118b7037 Update react-without-jsx.md
Facebook codestyle
2016-10-21 14:30:35 -07:00
Dan Abramov
d1a61ee7f4 Fix redirects 2016-10-21 22:02:30 +01:00
Dan Abramov
1f818f2740 Minor doc tweaks 2016-10-21 21:47:43 +01:00
Kevin Lacker
455d2d1b48 New Documentation 2016-10-21 20:59:08 +01:00
Sebastian Markbåge
8cac523bea Merge pull request #8029 from sebmarkbage/fiberreturnfromtoprender
Quick fix to the return top level problem
2016-10-21 14:59:01 -04:00
Sebastian Markbage
6e7c89ed8a Quick fix to the return top level problem
This doesn't deal with the fact that work is usually deferred
so this will return null for first render (except in sync tests).
It also doesn't deal with top levels being fragments etc.
It doesn't deal with the host instance type being a wrapper
around the public instance. This needs to be unified with refs
and findDOMNode better.

However, this does expose that we reactComponentExpect and
ReactTestUtils doesn't work very well with Fiber.
2016-10-21 11:58:40 -07:00
Sebastian Markbåge
9b1b40ca93 Merge pull request #8015 from sebmarkbage/fiberclassinit
[Fiber] Add more life-cycles
2016-10-21 14:57:51 -04:00
Sebastian Markbage
37ca3874af Add unit tests for aborted life-cycles
This tests the life-cycles when work gets aborted.
2016-10-21 11:57:24 -07:00
Sebastian Markbage
c862ba719e Fallback to current props if memoizedProps is null
If work has progressed on a state update that gets resumed
because of another state up, then we won't have an new
pendingProps, and we also won't have any memoizedProps because
it got aborted before completing. In that case, we can just
fallback to the current props.

I think that they can't have diverged because the only way they
diverge is if there is new props.

This lets us bail out on state only updates in more cases which
the unit tests reflect.
2016-10-21 11:57:24 -07:00
Sebastian Markbage
b72c27ce5d Don't schedule NoWork as the next work
We currently only filter out "NoWork" in the beginning of this
function. If the NoWork root is after the one with work it will
show up in the second loop. There's probably a more efficient
way of doing this but this works for now.

This showed up in this PR because a new unit test gets unblocked
which ends up with this case.
2016-10-21 11:57:24 -07:00
Sebastian Markbage
a87ec42f2a Add more life-cycles to Fiber
This refactors the initialization process so that we can share
it with the "module pattern" initialization.

There are a few new interesting scenarios unlocked by this.
E.g. constructor -> componentWillMount -> shouldComponentUpdate
-> componentDidMount when a render is aborted and resumed.
If shouldComponentUpdate returns true then we create a new
instance instead of trying componentWillMount again or
componentWillReceiveProps without being mounted.

Another strange thing is that the "previous props and state"
during componentWillReceiveProps, shouldComponentUpdate and
componentWillUpdate are all the previous render attempt. However,
componentDidMount's previous is the props/state at the previous
commit. That is because the first three can execute multiple
times before a didMount.
2016-10-21 11:57:24 -07:00
Toru Kobayashi
a6728f961c [Fiber] Add unit tests for ReactDOMFiber (#8016) 2016-10-21 00:44:23 -04:00
Sebastian Markbåge
4132cc4d3e Fix lint with yarn (#7997)
I couldn't figure out how to do this yarn alone so I ended up
just manually hacking the yarn to force a downgrade of babylon
to 6.8.0 since otherwise it gets resolved to 6.12.0 which is
broken.
2016-10-20 17:49:40 -04:00
Ben Alpert
a8beab3341 Fix captured/bubbled in ReactNativeTreeTraversal (#8019)
Follow-up to #7741. Added a test for RN event bubbling that fails before the fix.
2016-10-20 11:17:06 -07:00
Sebastian Markbåge
a5195102d4 [Fiber] Some setState related issues (#8010)
* Use the memoized props/state from the workInProgress

We don't want to use the "current" props/state because if we have
started work, then pause and continue then we'll have the newer
props/state on it already. If it is not a resume, it should be the
same as current.

* Deprioritize setState within a deprioritized tree

Currently we flag the path to a setState as a higher priority
than "offscreen". When we reconcile down this tree we bail out
if it is a hidden node. However, in the case that node is already
completed we don't hit that bail out path. We end up doing the
work immediately which ends up committing that part of the tree
at a higher priority.

This ensures that we don't let a deprioritized subtree get
reconciled at a higher priority.

* Bump idx in unit test

This proves that this number is actually deprioritized.
2016-10-19 13:32:37 -04:00
Toru Kobayashi
3d7869ab0e [Fiber] Add a unit test for ReactTopLevelText (#8001) 2016-10-18 14:39:49 -04:00
Dan Abramov
9bfa45bd2d Update Flow and fix issues (#8006) 2016-10-18 15:26:40 +01:00
Dan Abramov
75367673cf Fix Haste header (#8005) 2016-10-18 14:06:08 +01:00
Andrew Clark
663d4a539b Merge pull request #8000 from piperchester/patch-1
Fix grammatical error
2016-10-17 21:26:22 -07:00
Piper Chester
31f5edc492 Fix grammatical error 2016-10-17 21:13:33 -07:00
Sebastian Markbage
fae3e5308b Use memoizedState in componentDidUpdate
We forgot to clone this value so it didn't work before.
This is covered by existing tests in ReactDOMProduction.
2016-10-17 16:21:06 -04:00
Sebastian Markbage
685d65bfb6 No duck typing on the root
The root is always a host container.
2016-10-17 16:21:06 -04:00
Sebastian Markbage
bc5dfd5358 Break out some Class Component logic into separate module
Refactors the class logic a bit.

I moved scheduleUpdate out into the scheduler since that's where
the scheduling normally happens. I also moved it so that we can
rely on hoisting to resolve the cycle statically.

I moved the updater to a new class component file. I suspect we
will need a bit of space in here since the class initialization
code is quite complex.

The class component dependency is currently fixed in BeginWork
so we can't move complete or commit phase stuff to it. If we need
to, we have to initialize it in the scheduler and pass it to the
other phases.
2016-10-17 16:21:06 -04:00
Sebastian Markbage
9c25538e13 Fix resuming bug
If we abort work but have some completed, we can bail out if
the shouldComponentUpdate returns true. However, then we have
a tree that is low priority. When we bailout we currently use
the "current" tree in this case. I don't think this is right.
I'm not sure why I did that.

Similarly, when we complete we use the "current" props if we
didn't have pending props to do. However, we should be using
the memoized props of that tree if it is a pending work tree.

Added a unit test that covers these two cases.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
e59e5b280f Invoke all null ref calls before any new ref calls
This reorganizes the two commit passes so that all host
environment mutations happens before any life-cycles. That means
that the tree is guaranteed to be in a consistent state at that
point so that you can read layout etc.

This also lets us to detach all refs in the same pass so that
when they get invoked with new instances, that happens after it
has been reset.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
3717b71c64 Resolve ref callbacks
During the deletion phase we call detachRefs on any deleted refs.

During the insertion/update phase we call attachRef on class
and host components.

Unfortunately, when a ref switches, we are supposed to call all
the unmounts before doing any mounts. This means that we have to
expact the deletion phase to also include updates in case they
need to detach their ref.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
c44c7eaa1b Fire componentDidMount/componentDidUpdate life-cycles
These happen in the commit phase *before* the setState callback.

Unfortunately, we've lost the previous state at this point since
we've already mutated the instance. This needs to be fixed
somehow.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
90993c5324 Call componentWillUnmount during deletion phase
While we're deleting nodes, we need to call the unmount
life-cycle. However, there is a special case that we don't want
to keep deleting every host node along the way since deleting the
top node is enough.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
a98aba4d73 Always override priority level when visiting children
It is not possible for a child to have a higher priority level
than we're reconciling at, unless we intentionally want to
down-prioritize it.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
43645a6586 Reset effect list when we recompute children
We only use the effect list when we reuse our progressed children.
Otherwise it needs to reset to null.

In all other branches, other than bailoutOnLowPriority, we
revisit the children which recreates this list.

We should also not add fibers to their own effect list since it
becomes difficult to perform work on self without touching the
children too. Nothing else does that neither.

Since that means that the root isn't added to an effect list we
need to special case the root.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
1d437dc9ad Remove beginWork shortcut
This shortcut had a bug associated with it. If beginWork on this
child returns null, then we don't call completeWork on that fiber.

Since removing this short cut adds another time check, we have to
add a single unit of time in tests to account for the top level
call now taking one more unit.

This was also the only recursive call in all of fiber so it's nice
to get rid of it to guarantee that a flat stack is possible.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
5de2821372 Move child updates to use the reconciled effects
Instead of passing the full list of children every time to
update the host environment, we'll only do inserts/deletes.

We loop over all the placement effects first and then later
we do the rest.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
442ab71fc7 Append deletions to the effect list
First clear any progressed deletions for any case where we start
over with the "current" set of children.

Once we've performed a new reconciliation we need to add the
deletions to the side-effect list (which we know is empty because
we just emptied it).

For other effects, instead of just adding a fiber to an effect
list we need to mark it with an update. Then after completion
we add it to the the effect list if it had any effects at all.

This means that we lose the opportunity to control if a fiber
gets added before or after its children but that was already
flawed since we want certain side-effects to happen before others
on a global level.

Instead, we'll do multiple passes through the effect list.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
901691eb92 Tag the fiber with the kind of side-effect that was applied to it
This allow us to track what kind of side-effect this was even
though we only have a single linked list for all side-effects.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
e9e645a9b1 Deletion tracking
When we reconcile children we need to track the deletions that
happen so that we can perf side-effects later as a result. The
data structure is a linked list where the next pointer uses the
nextEffect pointer.

However, we need to store this side-effect list for reuse if we
end up reusing the progressedChild set. That's why I add a
separate first/last pointer into this list so that we can keep it
for later.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
0dc840a2b9 Fast path for create child
When we don't have any previous fibers we can short cut this path
knowing that we will never have any previous child to compare to.

This also ensures that we don't create an empty Map in this case.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
3979bb9e24 Don't track side-effects unless needed
We don't need to track side-effects for a parent that has never
been mounted before. It will simply inject all its children when
it completes.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
cccc4ae2c6 Add index field to each fiber
We use this to track the index slot that this Fiber had at
reconciliation time. We will use this for two purposes:

1) We use it to quickly determine if a move is needed.

2) We also use it to model a sparce linked list, since we can have
null/false/undefined in our child set and these take up a slot for
the implicit key.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
edaf08fcfe Fiber child reconciliation
This implements the first step to proper child reconciliation.
It doesn't yet track side-effects like insert/move/delete but has
the main reconciliation algorithm in place.

The goal of this algorithm is to branch early and avoid rechecking those conditions. That leads to some duplications of code.

There are three major branches:

- Reconciling a single child per type.
- Reconciling all children that are in the same slot as before from the beginning.
- Adding remaining children to a temporary Map and reconciling them by scanning the map.

Even when we use the Map strategy we have to scan the linked list to line up "same slot" positions because React, unlike Inferno, can have implicit keys interleaved with explicit keys.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
13f01be64f Enable text updates in ReactNoop
We'll enable updating of text nodes. To be able to test that we
need the text nodes to be mutable. They're currently just strings
in the Noop renderer so this makes them an object instead.

That exposed a bug in ReactFiberCommitWork for text nodes.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
362e56a1c1 Add comment about bug in yields
This needs to be fixed somehow. The reconciler could know if you
are mounting this continuation into the same spot as before and
then clone it. However, if the continuation moves, this info is
lost. We'd try to unmount it in one place and mount the same fiber
in another place.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
c3310d3e32 Fix MultiChild tests so they work with Fiber
Dropped the unnecessary use of findDOMNode.
Dropped unnecessary arrow functions.
Math.random() -> id counter, since this used to be
non-deterministic which is not ideal for unit tests.

getOriginalKeys() used to rely on implementation details
to scan that the internal data structure maintained its
structure, however, since that is unobservable we don't
need to test the internal data structure itself. We're
already testing refs and dom structure which is the only
observable effect of the reorder.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
8d3a58de62 Silence Fiber warning when the feature flag is on
When the feature flag is on, we should silence the warning since
we're explicitly testing it. This is needed when running unit
tests with the flag on.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
cafa7b284a Add Text node types
These nodes rendering into Text nodes in the DOM.

There is a special case when a string is a direct child of a host
node. In that case, we won't reconcile it as a child fiber. In
terms of fibers, it is terminal. However, the host config special
cases it.

It is kind of unfortunate that we have to special case this kind
of child in the HostConfig. It would be nice to unify this with
other types of child instances. Text nodes have some weird special
cases, but those special cases tend to *vary* by environment.
They're not the same special cases so not sure how valuable it is
to have a special protocol and special types for it.
2016-10-17 16:17:30 -04:00
Sebastian Markbage
e0a305350b Add Fragment fiber type
We currently treat nested arrays as a unique namespace from top
level children. So that these won't share key namespaces. This
adds a new fiber type that will represent the position of a
fragment.

This is only used for nested arrays. Even if you return an array
from a composite component, we don't need this since they share
namespace with a single top level component.

This still doesn't implement the complete reconciliation
algorthim in child fiber. That's coming later.
2016-10-17 16:17:30 -04:00
Dan Abramov
7b7eddcc72 Add @preventMunge directives to classes (#7994) 2016-10-17 21:07:17 +01:00
Dan Abramov
c2d5833e98 Ignore root docs folder in Flow config
Otherwise Flow finds obscure files in docs/vendor.
Seems like you'd only get them if you have a local checkout of docs Ruby dependencies.
This explains why Travis didn't fail.
2016-10-17 16:12:07 +01:00
Dan Abramov
f33f03e357 Support passthrough updates for error boundaries (#7949)
* Initial pass at the easy case of updates (updates that start at the root).

* Don't expect an extra componentWillUnmount call

It was fixed in #6613.

* Remove duplicate expectations from the test

* Fix style issues

* Make naming consistent throughout the tests

* receiveComponent() does not accept safely argument

* Assert that lifecycle and refs fire for error message

* Add more tests for mounting

* Do not call componentWillMount twice on error boundary

* Document more of existing behavior in tests

* Do not call componentWillUnmount() when aborting mounting

Previously, we would call componentWillUnmount() safely on the tree whenever we abort mounting it. However this is likely risky because the tree was never mounted in the first place.

People shouldn't hold resources in componentWillMount() so it's safe to say that we can skip componentWillUnmount() if componentDidMount() was never called.

Here, we introduce a new flag. If we abort during mounting, we will not call componentWillUnmount(). However if we abort during an update, it is safe to call componentWillUnmount() because the previous tree has been mounted by now.

* Consistently display error messages in tests

* Add more logging to tests and remove redundant one

* Refactor tests

* Split complicated tests into smaller ones

* Assert clean unmounting

* Add assertions about update hooks

* Add more tests to document existing behavior and remove irrelevant details

* Verify we can recover from error state

* Fix lint

* Error in boundary’s componentWillMount should propagate up

This test is currently failing.

* Move calling componentWillMount() into mountComponent()

This removes the unnecessary non-recursive skipLifecycle check.
It fixes the previously failing test that verifies that if a boundary throws in its own componentWillMount(), the error will propagate.

* Remove extra whitespace
2016-10-15 18:13:56 +01:00
Héctor Ramos
1b7066ed6f Separate Ruby and Python instructions 2016-10-14 15:11:27 -07:00
Héctor Ramos
175fc4ae9b Add Windows-specific instructions 2016-10-14 15:10:16 -07:00
Sebastian Markbåge
fda7a673c1 Fix whitespace in headers (#7980)
The script that strips providesModule is very sensitive.

Test plan:

Searched for providesModule in build. No more.

reactComponentExpect used to have problems too but doesn't seem
to anymore. Don't know why.
2016-10-14 17:46:34 -04:00
Dan Abramov
14ec2c0c46 Add 15.4.0 RC3 to Downloads 2016-10-14 20:21:05 +01:00
Héctor Ramos
b59a8d94cc Add link to gulpjs 2016-10-13 15:48:16 -07:00
Dustan Kasten
91aa538221 build: strip @providesModule from output modules (#7968)
FB tools such as Flow and Jest are having issues finding duplicate modules
now that React internal modules are duplicated across packages.
2016-10-13 16:19:11 -04:00
CT Wu
836a054719 Fix a typo in the doc (#7969) 2016-10-13 16:58:57 +01:00
Nathan Hunzaker
0d20dcf910 Fix uncontrolled input decimal point "chopping" on number inputs, and validation warnings on email inputs (#7750)
* Only assign defaultValue if it has changed.

* Improve comment about reason for defaultValue conditional assignment
2016-10-13 08:20:14 -05:00
Giorgio Polvara
823dd3d65f Fix typo (#7953) 2016-10-12 21:29:37 -05:00
Sebastian Markbåge
f38e0cb6ac Check in yarn.lock file (#7957)
Because we have to keep up with the latest hotness
https://yarnpkg.com/
2016-10-12 16:07:25 -04:00
Ujjwal Ojha
575727100a Fix typo (#7909) 2016-10-12 09:49:56 -05:00
Kevin Huang
b728fa0c17 Add warning for shady-dom use with rendered react components in DEV (#7911)
* Add warning for shady-dom use with rendered react components in DEV

* Make shady dom warning emit only once regardless of number of components

* Use didWarnShadyDom as warning argument & add missing shadyRoot check to ReactDOMComponent

* Add check for shady dom test to run only when createElement flag is true

* Pass false to warning in shadyDom warning check

* Add consistent DOM phrasing for shady DOM warnings

* Reference component name in shady DOM warning if it exists

* Add check for if owner exists in shady dom warning

* Add test for named component using createClass for shady DOM warning

* Clean up named component test for shady DOM warning

* Fix trailing comma linting issue on named shady DOM warning test
2016-10-12 10:13:50 +01:00
Kevin Huang
3b708728b0 Declare type var higher up in mountComponent() in ReactDOMComponent for reuse (#7944) 2016-10-12 10:12:15 +01:00
Islam Sharabash
b77a96e496 Inject the previous batching strategy when rendering to string (#7930)
Before this change calling renderToStringImpl would inject
ReactDefaultBatchingStrategy after completion, even if a custom batching
strategy was injected before. This makes renderToStringImpl keep a reference to
the batching strategy before it runs and reinject it afterwards.
2016-10-11 12:57:22 -05:00
Colin Wren
7aa621daee Fix typo in more-about-refs.md (#7933) 2016-10-11 11:56:34 +01:00
Alex Babkov
deb4a5abee Typo fixes in codebase-overview.md (#7938) 2016-10-11 11:55:06 +01:00
Aesop Wolf
f00fbbd1ce Update codebase-overview.md (#7934)
Fix typo
2016-10-11 01:14:05 +01:00
Dan Abramov
d0cc73a957 Add Implementation Notes and amend Codebase Overview (#7830)
* Add more to Codebase Overview

* WIP

* Start a reconciler overview

* Add a few more sections

* todo

* WIP

* Finish it

* Whitespace

* Minor tweaks

* Minor tweaks
2016-10-10 17:29:48 +01:00
Toru Kobayashi
83381c1673 use npm-run-script in PULL_REQUEST_TEMPLATE (#7913) 2016-10-07 14:23:37 +01:00
Paul O’Shannessy
077d660a27 Fix npm package builds (#7888)
* Ensure lib/ is packaged for react-test-renderer

* Run npm pack from right working directory

We were running this on the original packages not the compiled ones, resulting in missing files
2016-10-05 15:32:38 -07:00
Sophia
2a2dd7689f removing parent/child references in props section of tutorial (#7887) 2016-10-05 22:29:55 +01:00
Tyler Buchea
e5b197cd94 Update README.md to use jsx for syntax highlighting (#7884)
Github now supports jsx syntax highlighting in their markdown documents. So I have updated the main README.md to use jsx instead of js.
2016-10-05 14:13:11 -05:00
Michael O'Brien
48ea2d4743 Update comment to refer to correct method name (#7873) 2016-10-04 22:53:26 +01:00
Dan Abramov
7b10b2b88d Update the homepage with ES6 (#7868)
* Update the homepage with ES6

* Avoid array spread and stale state
2016-10-04 19:33:09 +01:00
Kateryna
c9ec4bc445 Fix initial state example for Recat.createClass (#7867)
In the example there was a typo with setting initial state using `getInitialState` method
2016-10-04 18:43:49 +01:00
Toru Kobayashi
30067fa8ca Fix confusing variable names (#7863) 2016-10-04 12:53:29 +01:00
ankitml
eddcee9884 Use ES6 in Language Tooling doc 2016-10-04 12:51:42 +01:00
Toru Kobayashi
85b0377bfd Refactor ShallowRenderer (#7739)
* Separate ReactShallowRenderer from TestUtils

* Use ES classes to ReactShallowRenderer
2016-10-04 12:28:06 +01:00
KeicaM
f96237cdb8 Update 04-multiple-components.md (#7861)
added missing map bracket
2016-10-04 12:19:44 +01:00
Steve Mao
957f663513 simplify npm link script a little bit (#7862)
We don't need to remove the folders before linking the modules
2016-10-04 12:12:12 +01:00
Ben Alpert
be63afcb64 Make sure .createElement({}) warns (#7857)
This is common when forgetting to export anything from a file.
2016-10-03 17:24:57 -07:00
Marcelo Alves
23cd77b683 Fix minor typo in closing H1 tag (#7855) 2016-10-03 19:07:56 -05:00
Paul O’Shannessy
92c84a6f37 Fix UMD bundles, making safe to use as required modules (#7840) 2016-10-03 15:49:10 -07:00
Ben Alpert
f88c1d38be Update remarkable to 1.7.1 (#7851)
Fixes a subtle XSS hole.
2016-10-03 14:22:06 -07:00
ankitml
a6445a18f9 Keyed Fragment of AddOns ported to ES6 2016-10-03 21:45:27 +01:00
Alex Zherdev
1b02c731ce Add-Ons: Animation updated with ES6 examples 2016-10-03 21:30:22 +01:00
Rafael Angeline
9174c29acc Reusable Components ES6 Update 2016-10-03 21:02:32 +01:00
gillchristian
f5f1769583 Docs to ES6: Displaying data example. 2016-10-03 19:21:44 +01:00
hkal
f6fdfd1bf0 Add unknown property warning for use of autofocus (#7694) 2016-10-03 09:51:44 -05:00
Mark Penner
dae3043897 Fixes #7824 (#7832) 2016-09-30 19:03:49 -07:00
Eric Douglas
e32196222b Update babel link (#7837) 2016-09-30 13:39:23 -07:00
Ivan Zotov
16ac141f44 Fix mistakes in the codebase overview (#7834) 2016-09-29 22:38:14 +01:00
Dan Abramov
4f345e021a Add Codebase Overview (#7828)
* Add Codebase Overview

* Update codebase-overview.md

* Update codebase-overview.md
2016-09-29 11:33:57 +01:00
Gil Chen-Zion
a2bb55e3f4 Note that getInitialState is not used in ES6 classes in docs (#7748) 2016-09-28 19:07:29 -07:00
Kyle Mathews
87724bd875 typos fix (#7822) 2016-09-28 17:27:25 +01:00
Christopher Chedeau
cc00280aa6 Our first 50,000 stars blogpost 2016-09-28 10:21:29 +01:00
Christoph Pojer
0990c93806 Reduce confusion in testing documentation. (#7818)
* Reduce confusion in testing documentation.

Just wanted to add some clarity to this page and link to the react tutorial on Jest's website to give people more information. Also changed enzyme's definition from library to utility to help reduce the confusion. Hope this makes sense to everybody :)

See https://twitter.com/damusnet/status/780752042675597312

cc @lelandrichardson

* Update 10.4-test-utils.md
2016-09-27 19:08:02 -07:00
J. Renée Beach
59ff7749ed React dom invalid aria hook (#7744)
* Add a hook that throws a runtime warning for invalid WAI ARIA attributes and values.

* Resolved linting errors.

* Added a test case for many props.

* Added a test case for ARIA attribute proper casing.

* Added a warning for uppercased attributes to ReactDOMInvalidARIAHook
2016-09-27 20:53:14 -05:00
Christopher Chedeau
72ed5df5a4 Fix total count in flow tracker (#7813)
When you put the output of a bash command in a variable, it replaces the `\n` with a space. Using `ls` instead of `echo` fixes it

Test Plan:
Run

```
ALL_FILES=`find src -name '*.js' | grep -v umd/ | grep -v __tests__ | grep -v __mocks__`
COUNT_ALL_FILES=`ls $ALL_FILES | wc -l`
echo $COUNT_ALL_FILES
```

Make sure that it outputs 221
2016-09-27 16:20:50 -07:00
Dan Abramov
1c0b5dca5a Tweak the contributing wording in README 2016-09-27 23:32:57 +01:00
Dan Abramov
c82bcefa93 Move How to Contribute to documentation and update it (#7817)
* Move How to Contribute to documentation and update it

* Consistent formatting
2016-09-27 23:20:49 +01:00
Christopher Chedeau
84f8df1f89 Track fiber tests (#7812)
Use the newly added tracking system to track the number of fiber tests that are passing/failing.

I first tried to modify the grunt lint rule for it and send the output in stdout but unfortunately grunt displays the rule + done messages there. I had like 30 lines of js already and I figured I could just write 3 lines of bash and it would work the same. Let me know if you want me to use another approach for it.

Test Plan:
Run the commands that have been introduced in this commit but the facts-tracker one
Run `echo $FIBER_TESTS` and make sure it prints `666/1434`
2016-09-26 14:54:27 -07:00
Christopher Chedeau
fb1e7075ed Update travis.yml to use $GITHUB_USER_NAME and $GITHUB_USER_EMAIL (#7811)
See https://github.com/facebook/react/pull/7747#issuecomment-249677880 for discussions
2016-09-26 14:47:16 -07:00
imjanghyuk
6032491555 Update 07-forms.ko-KR.md (#7809)
fix spelling
2016-09-26 14:02:33 -07:00
Christopher Chedeau
dbd9c4b205 Introduce facts-tracker (#7747)
* Introduce facts-tracker

We want to be able to track various things like number of files that are flowified, number of tests passing with Fiber...

This introduces a tool that lets you do that. The API is very simple, you execute the script with a list of tuples [key value] and it's going to create a `facts` branch and put a txt file for each fact and values over time.

```
node scripts/facts-tracker/index.js \
  "flow-files" "$COUNT_WITH_FLOW/$COUNT_ALL_FILES"
```

Test Plan:
This is tricky to test because Travis only exposes the private variables (github token) when it processes a committed file and not on branches. The reason is that otherwise anyone could send a pull requests that does `echo $GITHUB_TOKEN` and steal your token.

Given this constraint, I did all the work using two of my repos:
- https://github.com/vjeux/facts-tracker
- https://github.com/vjeux/facts-tracker-test

and am sending this pull request that should work as is /fingers crossed/, but we won't be able to test it out until it is committed.

Note that once this lands, I'm going to kill those two repos.

* Update with all the suggested changes

* Branch on a flow type in travis.yml

* Use $GITHUB_TOKEN

* properly escape it
2016-09-26 12:58:51 -07:00
jinmmd
d9957ac075 Change [入门教程] from "tutorial.html" to "tutorial-zh-CN.html" (#7789) 2016-09-26 10:39:34 -07:00
jinmmd
5331dfd1a5 Change [API参考] from "top-level-api.html" to "top-level-api-zh-CN.html" (#7790) 2016-09-26 10:39:03 -07:00
Andy Edwards
b7c70b67af Clarify manual PropType calls warning (#7777) 2016-09-22 14:59:01 +01:00
Dan Abramov
13692d59ad Update broken JSFiddle in Why React blog post (#7783)
Fixes #7782
2016-09-21 13:42:49 +01:00
Paul O’Shannessy
00ac1797d7 Adjust code to handle more availability of function.name (#7670) 2016-09-20 14:23:46 -07:00
Paul O’Shannessy
2058d47e7b [docs] Update React Rally 2016 videos link (#7771) 2016-09-19 14:26:32 -07:00
Paul O’Shannessy
7b0d5d0e74 Update website for 15.3.2
(cherry picked from commit b52ea6bd8f)
2016-09-19 11:14:30 -07:00
Paul O’Shannessy
af28c5cd73 Update Changelog & Readme for 15.3.2
(cherry picked from commit 8c7bbbfc21)

Fix formatting of 15.3.2 changelog

(cherry picked from commit c2388bf09b)
2016-09-19 11:14:16 -07:00
Ivan Zotov
2ec2d8f7f7 Fix links and ids for tips in docs (#7766) 2016-09-19 17:50:26 +03:00
Ivan Zotov
4dd554c9b7 Russian translation for style props value px of tips (#7742)
* Russian translation for style props value px of tips

* Update 06-style-props-value-px.ru-RU.md
2016-09-19 13:57:42 +03:00
Ivan Zotov
8176f4970c Russian translation for max. numbers of jsx root nodes (#7738)
* Russian translation for max. numbers of jsx root nodes

* Update 05-maximum-number-of-jsx-root-nodes.ru-RU.md
2016-09-19 13:45:09 +03:00
Ivan Zotov
7d5c70d98c Russian translation for self-closing-tag of tips (#7729)
* Russian translation for self-closing-tag of tips

* Fix next link for inline styles tip

* Update 04-self-closing-tag.ru-RU.md
2016-09-19 13:39:46 +03:00
Brandon Dail
7dfa01f9fa Revert ReactMultiChild to plain object (#7757)
Since ReactART and RN extend ReactMultiChild, changing it to a class is
a breaking change. See
https://github.com/facebook/react/pull/7736/files#r79073698
2016-09-17 10:40:23 -05:00
Uladzimir Havenchyk
65870dcaee Simplify event phases. Use explicitly 'captured' and 'bubbled'. (#7741) 2016-09-15 23:24:56 -07:00
Brandon Dail
c78464f8ea Resolve flow errors with ReactTestRenderer (#7736)
* Resolve flow errors with ReactTestRenderer

* Add whitespace between types and methods

* extend ReactMultiChild instead of using Object.assign

* Use ReactElement type from ReactElementType

* Make ReactMultiChild a class
2016-09-15 11:44:56 -05:00
Paul O’Shannessy
864bc7b939 Update ignores in flowconfig (#7722)
This ensures we ignore relative to our project root and won't be tripped up by issues where checkouts in other places result in Flow passing when it shouldn't (eg on Travis CI where the checkout path is `/home/travis/build/facebook/react`)
2016-09-14 14:57:31 -07:00
Ivan Zotov
79367b09f7 Russian translation if-else in JSX of tips (#7726) 2016-09-14 15:05:21 +03:00
Ivan Zotov
fcc37ccaa2 Russian translation for inline styles of tips (#7717) 2016-09-14 13:26:36 +03:00
Ivan Zotov
7d76bdad69 Fix Russian translation of introduction to be more technical (#7727) 2016-09-14 13:23:57 +03:00
Brandon Dail
5a3abab660 Clean up ReactTestRenderer (#7716)
* create ReactTestTextComponent fil

* create ReactTestEmptyComponent

* Use class for ReactTestRenderer

* Add flow to ReactTestRenderer
2016-09-13 21:20:41 -05:00
Stephen John Sorensen
b2297ae6c3 remove plain object warning (#7724) 2016-09-13 19:15:07 -07:00
Ben Alpert
9eba80825f Unify branches in cloneFiber (#7723) 2016-09-13 17:42:15 -07:00
Andrew Clark
6144212a86 [Fiber] Animation priority work (#7466)
* High priority work

Adds the ability to schedule and perform high priority work. In the
noop renderer, this is exposed using a method `performHighPriWork(fn)`
where the function is executed and all updates in that scope are given
high priority.

To do this, the scheduler keeps track of a default priority level.
A new function `performWithPriority(priority, fn)` changes the default
priority before calling the function, then resets it afterwards.

* Rename overloaded priority terms

"High" and "low" priority are overloaded terms. There are priority
levels called HighPriority and LowPriority. Meanwhile, there are
functions called {perform,schedule}HighPriWork, which corresponds
to requestAnimationFrame, and {perform,schedule}LowPriWork, which
corresponds to requestIdleCallback. But in fact, work that has
HighPriority is meant to be scheduled with requestIdleCallback.
This is super confusing.

To address this, {perform,schedule}HighPriWork has been renamed
to {perform,schedule}AnimationWork, and
{perform,schedule}LowPriWork has been renamed to
{perform,schedule}DeferredWork. HighPriority and LowPriority
remain the same.

* Priority levels merge fix
2016-09-13 16:46:32 -07:00
Sebastian Markbåge
3e54b28c20 Merge pull request #7344 from acdlite/fibersetstate
[Fiber] setState
2016-09-13 15:31:14 -07:00
Sebastian Markbage
27d1210c1d Log the updateQueue in dumpTree
This also buffers all rows into a single console.log call.
This is because jest nows adds the line number of each console.log
call which becomes quite noisy for these trees.
2016-09-13 15:26:48 -07:00
Sebastian Markbage
f3a2dc252e Check for truthiness of alternate
This is unfortunate since we agreed on using the `null | Fiber`
convention instead of `?Fiber` but haven't upgraded yet and this
is the pattern I've been using everywhere else so far.
2016-09-13 15:26:48 -07:00
Andrew Clark
0ca1cea26a Don't mutate current tree before work is committed.
We should be able to abort an update without any side-effects to the
current tree. This fixes a few cases where that was broken.

The callback list should only ever be set on the workInProgress.
There's no reason to add it to the current tree because they're not
needed after they are called during the commit phase.

Also found a bug where the memoizedProps were set to null in the
case of an update, because the pendingProps were null. Fixed by
transfering the props from the instance, like we were already doing
with state.

Added a test to ensure that setState can be called inside a
callback.
2016-09-13 15:26:48 -07:00
Andrew Clark
f514662ca0 forceUpdate
Adds a field to the update queue that causes shouldComponentUpdate to
be skipped.
2016-09-13 15:26:48 -07:00
Andrew Clark
d8c24cfa78 replaceState
Adds a field to UpdateQueue that indicates whether an update should
replace the previous state completely.
2016-09-13 15:26:48 -07:00
Andrew Clark
1d49237299 Update callbacks
Callbacks are stored on the same queue as updates. They care called
during the commit phase, after the updates have been flushed.

Because the update queue is cleared during the completion phase (before
commit), a new field has been added to fiber called callbackList. The
queue is transferred from updateQueue to callbackList during completion.
During commit, the list is reset.

Need a test to confirm that callbacks are not lost if an update is
preempted.
2016-09-13 15:26:47 -07:00
Andrew Clark
c6db7f73be Rename stateQueue -> updateQueue
Also cleans up some types.
2016-09-13 15:26:47 -07:00
Andrew Clark
f7dab22ac9 Ensure that setState update function's context is undefined 2016-09-13 15:26:47 -07:00
Andrew Clark
97dac74c40 Use ReactInstanceMap
Move ReactInstanceMap to src/renderers/shared/shared to indicate that
this logic is shared across implementations.
2016-09-13 15:26:47 -07:00
Andrew Clark
d218158d22 Clean up
Use a union type for the head of StateQueue.
2016-09-13 15:26:47 -07:00
Andrew Clark
691e053650 Fix stateQueue typing 2016-09-13 15:26:47 -07:00
Andrew Clark
909caccebd Clean up
Rather than bubble up both trees, bubble up once and assign to the
alternate at each level.

Extract logic for adding to the queue to the StateQueue module.
2016-09-13 15:26:47 -07:00
Andrew Clark
25d199abe0 Updater form of setState
Add support for setState((state, props) => newState).

Rename pendingState to stateQueue.
2016-09-13 15:26:47 -07:00
Andrew Clark
8b200c5e78 Use queue for pendingState
Changes the type of pendingState to be a linked list of partial
state objects.
2016-09-13 15:26:47 -07:00
Andrew Clark
94d2317b4b setState for Fiber
Updates are scheduled by setting a work priority on the fiber and bubbling it to
the root. Because the instance does not know which tree is current at any given
time, the update is scheduled on both fiber alternates.

Need to add more unit tests to cover edge cases.
2016-09-13 15:26:46 -07:00
Sebastian Markbåge
a19fede67c Merge pull request #7636 from sebmarkbage/fiberrefactor
[Fiber] Refactor Pending Work Phase and Progressed Work
2016-09-13 15:24:52 -07:00
Sebastian Markbage
52011d58b0 Restructure clone child fiber a bit to make it clearer 2016-09-13 14:58:00 -07:00
Sebastian Markbage
a7afc064bd Pass current instead of picking it up from alternate
This colocates the reliance on alternate with the scheduler, so
that we have the option to not use this, or more easily break
apart the initial mount phase into an optimized path.
2016-09-13 14:57:59 -07:00
Sebastian Markbage
8b0be68eee Progressed work 2016-09-13 14:57:59 -07:00
Sebastian Markbage
b717db00fb Add shouldComponentUpdate to functional components
I'll probably end up reverting this before the bigger release
since it is not part of the official public API. However,
it is useful to be able to compare the performance between
functional components and classes.
2016-09-13 14:57:59 -07:00
Sebastian Markbage
cc259a29e3 Explain why ReactFiber is a POJO instead of constructor 2016-09-13 14:57:59 -07:00
Sebastian Markbage
49f0c952b5 Drop childInProgress
I will try a slightly different but similar strategy.
2016-09-13 14:57:59 -07:00
Sebastian Markbage
b63cda6e85 Drop Separate findPendingWork Phase
The findPendingWork phase is the same as just walking the tree the
normal way effectively. It only makes things more complex to
think about. We might possibly be able to write a few special
branches to optimize it but for now it doesn't seem necessary.
2016-09-13 14:57:59 -07:00
Sebastian Markbage
9e52130fb7 Move priority reset to the end and search pending work in work tree
The priority level gets reset at the wrong time because I rely
on mutating it at the wrong point. This moves it to the end of
completed work as a second pass over the children to see what
the highest priority is. This is inefficient for large sets but
we can try to find a smarter way to do this later. E.g. passing
it down the stack.

This bug fix revealed another bug that I had flagged before that
we're finding work to do in the "current" tree instead of the
working tree. For trees that were paused, e.g. childInProgress
trees, this won't work since don't have a current tree to search.

Therefore I fixed findNextUnitOfWorkAtPriority to use
workInProgress instead of current.
2016-09-13 14:57:59 -07:00
tokikuch
a64ca9b697 BeforeInput is fired with a wrong text at a wrong time on IE (#7107) 2016-09-13 11:15:18 -07:00
Brandon Dail
f3569a2c31 Implement createNodeMock for ReactTestRenderer (#7649)
* Implement optional mockConfig and getMockRef

* default mockConfig, walk render tree

* Pass mockConfig to transaction

* Attach mockConfig to transaction

* type mockConfig in ReactRef

* Expect object in native component ref test

* Fix argument name for attachRefs

* Add mockConfig support to legacy refs

* Pass transaction to getPublicInstance

* Implement getMockConfig on ReactTestReconcileTransaction

* Merge defaultMockConfig and mockConfig options

* Rename mockConfig to testOptions

* Break getPublicInstnce into three lines

* createMockRef -> createNodeMock
2016-09-13 09:09:20 -05:00
Keyan Zhang
38c4ade6cc changed ReactChildrenMutationWarningHook to Object.freeze (#7455)
- only freeze children array created by createElement
2016-09-13 16:25:31 +03:00
Amanvir Sangha
616e468987 Update OWASP link in docs for dangerous innerHTML (#7710) 2016-09-13 05:29:09 -07:00
Ivan Zotov
4dd44e77f8 Add Russian translation for introduction of tips (#7690) 2016-09-13 13:36:16 +03:00
Michał Pierzchała
b87bcb96ac Proper font-family for docs input fields (#7706) (#7708) 2016-09-12 16:29:46 -07:00
Dan Abramov
3fcba2044a Fix benchmarks (#7704) 2016-09-12 21:58:00 +03:00
Flarnie Marchan
54cbe29262 Fix Flow errors in Event Plugins (#7698)
Due to a typo in PR#7667 where I put 'DispatchConfig' when the type was
'EventTypes', there were some flow errors being thrown.

Then PR#7642 fixed a bug in SimpleEventPlugin and added some untyped
methods, which threw more flow errors.

Last, while fixing this, I fixed two eslint errors in the
SimpleEventPlugin test.
2016-09-10 16:44:08 -07:00
Dmitrii Abramov
e3e03b30b2 jest@15.1.1 (#7693) 2016-09-10 15:09:14 -07:00
Ray Dai
2fc7125d49 Update 14-communicate-between-components.ko-KR.md (#7686)
Apply the same change made in #7680.
2016-09-09 11:22:56 -07:00
Paul O’Shannessy
8debf524df Revert "Add unknown property warning for use of autofocus" (#7684) 2016-09-08 13:43:57 -07:00
Nathan Hunzaker
73c50e7d00 Move mouse event disabling on interactive elements to SimpleEventPlugin. Related perf tweak to click handlers. (#7642)
* Cull disabled mouse events at plugin level. Remove component level filters

* DisabledInputUtils tests are now for SimpleEventPlugin

* Add click bubbling test

* Add isInteractive function. Use in iOS click exception rules

* Invert interactive check in local click listener. Add test coverage

* Reduce number of mouse events disabable. Formatting in isIteractive()

* Switch isInteractive tag order for alignment

* Update formatting of isInteractive method
2016-09-08 11:47:52 -07:00
Toru Kobayashi
df033180f0 Run codemod react-codemod/transforms/class again (#7679)
ref. #7321
2016-09-08 10:38:44 -07:00
Ray Dai
05cbc93401 Update 14-communicate-between-components.md (#7680)
To demonstrate multiple arguments `bind(this, arg1, arg2, ...)`, also not to pass in for than what `handleClick` needed, namely props, or maybe even pass item itself, etc.
Going to change the kor file after review.
2016-09-08 10:20:25 -05:00
Gant Laborde
90a120c603 Adding the published ReactRally videos section (#7681)
ReactRally came and went, and it was splendid.
2016-09-08 10:17:39 -05:00
Christopher Chedeau
eaefd9052a Type ReactHostOperationHistoryHook (#7672)
In order to properly type an `Operation`, we need to change the call site from having two arguments: one for `type` and one for `payload` into an object that contains both. This isn't a perf regression because we were already constructing this object in the first place and doesn't change the emitted event so shouldn't affect the dev tools.

None of the call sites are actually flow-ified so it isn't technically used but once we will, it'll make sure that we don't send random strings and payload through those very generic methods.
2016-09-07 20:08:09 -07:00
Christopher Chedeau
82598eec79 Trim and inline ReactInstanceHandles (#7676)
React IDs have been killed and there was one call site left in a test. I trimmed down the implementation to keep only what is actually used and inlined it inside of the test so we don't get more people using it in the future.
2016-09-07 20:03:56 -07:00
Flarnie Marchan
7b2d9655da Flow type event plugins (#7667)
* Type SimpleEventPlugin and TapEventPlugin

- Renamed file from 'ReactSynteticEvent' to 'ReactSyntheticEventType'
- Fills in the 'any' holes that were left in DispatchConfig type and the
  type annotations in EventPluginRegistry.
- Adds polymorphic PluginModule type and related types
- Uses hack to support indexable properties on 'Touch' type in
  TapEventPlugin

The issue in TapEventPlugin is that the code is accessing one of four
possible properties on the 'Touch' type native event using the bracket
accessor. Classes in Flow don't support using the bracket accessor,
unless you use a declaration and the syntax `[key: Type]: Type`.[1] The
downside of using that here is that we create a global type, which we
may not need in other files.

[1]: https://github.com/facebook/flow/issues/1323

Other options:
- Use looser typing or a '@FixMe' comment and open an issue with Flow to
  support indexing on regular classes.
- Rewrite TapEventPlugin to not use the bracket accessor on 'Touch'. I
  thought the current implementation was elegant and didn't want to
  change it. But we could do something like this:
```
 if (nativeEvent.pageX || nativeEvent.pageY) {
   return axis.page === 'pageX' ? nativeEvent.pageX : nativeEvent.pageY;
 } else {
   var clientAxis = axis.client === 'clientX' ? nativeEvent.clientX : nativeEvent.clientY;
   return nativeEvent[axis.client] + ViewportMetrics[axis.envScroll];
 }
```
2016-09-07 12:40:45 -07:00
Christopher Chedeau
334b8bdf16 I wrote it live! (#7663) 2016-09-06 15:18:42 -07:00
Kite
ed8a753346 Fix the HTML for package management (#7656) 2016-09-06 09:58:17 -07:00
Filip Spiridonov
0c77b2f3eb Remove unnecessary var declaration (#7666) 2016-09-06 18:31:47 +03:00
Brandon Dail
06ea71d3fd Use compositeType in warning invariant for refs (#7658) 2016-09-06 11:49:20 +03:00
hkal
6a525fdc4c Add unknown property warning for use of (#6461) 2016-09-03 18:48:23 -05:00
Dan Abramov
a09d158a7c Don't bundle ReactComponentTreeHook in production (#7653)
Fixes #7492.
This was a build size regression introduced in #7164.
2016-09-03 22:32:20 +01:00
Dan Abramov
9d9af63a6a Link to Create React App (#7654)
* Link to Create React App

* Reword
2016-09-03 18:13:30 +01:00
Nathan Hunzaker
40c90a6499 Use proper render method in static markup event listener test (#7652) 2016-09-03 17:29:12 +01:00
Paul O’Shannessy
7b247f3609 Flow: bool -> boolean (#7650) 2016-09-02 17:35:14 -07:00
Christopher Chedeau
2559030c34 Type ReactCurrentOwner (#7648)
Simpler than ReactOwner :)
2016-09-02 16:29:24 -07:00
Christopher Chedeau
a70acb37d9 Convert CallbackQueue to a class (#7647)
It turns out that flow cannot type `this` with a function constructor + prototype overrides. Turning it to a class makes flow happy and has minimal impact on the output.

In open source, we already use the loose version of the class transform and internally we have one that's outputting even less code if you have `@preventMunge` in the header.

See discussion in https://www.facebook.com/groups/2003630259862046/permalink/2098480820376989/
2016-09-02 15:27:44 -07:00
Christopher Chedeau
839697f60c Restore coverage in Travis (#7628)
We disabled coverage in Travis because the implementation was crashing ( https://github.com/facebook/react/issues/6290 ). Since we upgraded to Jest 15, the entire coverage implementation is brand new so we should give it another try.
2016-09-02 14:23:58 -07:00
Christopher Chedeau
31dd6944d3 Type ReactRef (#7600)
Nothing out of the ordinary on this one.
2016-09-02 14:16:32 -07:00
Flarnie Marchan
9a88e593ed Merge pull request #7644 from flarnie/flowifyEventPluginRegistry
Type EventPluginRegistry
2016-09-02 13:53:44 -07:00
Flarnie Marchan
3c980aaf30 Type EventPluginRegistry
This commit takes the first incremental step towards adding type checks
to the React event code. A couple of issues came up.

There is an issue with the SyntheticEvent type: Flow declares a
SyntheticEvent type[1] that lacks the non-public properties which are
used in React internals. To solve this I declared a class that extends
SyntheticEvent. This class can be expanded as we add Flow types to more
places where SyntheticEvent instances are referenced.

I'm happy to change this if folks prefer a different approach.
Some options I considered:
- Override the SyntheticEvent declaration with our own declaration
  - Pro: We can use 'SyntheticEvent' as a type just like we are used to
    when working in any other codebase.
  - Pro: No need to import any type since it's a declaration
  - Pro: Only one version of SyntheticEvent; less confusion.
  - Con: Could get out of sync with real implementation.
  - Con: Duplicates part of the type declared in Flow.
- Import the SyntheticEvent class and use that as the type
  - Pro: Keeps type definition in sync with the real implementation.
  - Con: Declaration overrides implementation so I'm not sure this would
    work.
  - Con: Have to remember to import the type.
- Declare a separate type called ReactSyntheticEvent that extends
  SyntheticEvent
  - Pro: Stays in sync with the Flow SyntheticEvent type;
    less duplication.
  - Pro: Differentiates this type from the Flow SyntheticEvent type;
    less confusion.
  - Pro: No need to import any type since it's a declaration
  - Con: Could get out of sync with real implementation.

I also ran into an issue where a variable was only non-null when
'__DEV__' is true, similar to PR #7586.[2] The work-around is to force
it to be typed non-null and add a comment documenting the reason. At
this time Flow doesn't have a better way to deal with the situation.

Next steps:
- Specific type for the 'dispatchConfig' property of SyntheticEvent
- More detailed types for PluginName and PluginModule

Lastly; note that I renamed some variables to follow the convention of
reserving PascalCase for classes, enums, and Flow types.

[1]: https://github.com/facebook/flow/blob/master/lib/react.js#L277-L293
[2]: b99eb5087b
2016-09-02 13:13:48 -07:00
Christopher Chedeau
1229a238c4 Generate SimpleEventPlugin data structures at runtime (#7616)
We used to copy and paste the same big blob many times in order for it to work with keyOf which is no longer a constraint. This pull request takes a list of all the events as string and generate those data structures at runtime.

It reduces the size of React by 1k post gzip and flow is able to extract the structure out of it :)
2016-09-02 12:57:18 -07:00
却痕
4c365ea957 docs:translate doc 11-advanced-performance to chinese (#7584) 2016-09-01 22:59:30 -04:00
Ben Alpert
0c62d121c5 Merge pull request #7634 from spicyj/flowfix
Small flow fixes
2016-09-01 17:26:08 -07:00
Ben Alpert
0722b15752 Small flow fixes 2016-09-01 15:52:29 -07:00
Kent C. Dodds
34761cf9a2 add events code walkthrough video link (#7633)
I think if we do another one of these it'd be good to turn this into a list, but this is good for now.

Thanks @spicyj!
cc @gaearon
2016-09-01 14:23:40 -05:00
Guillaume Claret
355c490653 Remove the Flow experimental.strict_type_args option (#7631) 2016-09-01 11:40:08 -07:00
Nathan Hunzaker
5c47920384 Remove String.prototype.split polyfill warning (#7629) 2016-09-01 08:44:36 -05:00
Christoph Pojer
1bd55c8cbd Merge pull request #7625 from vjeux/jest15
Update to jest 15
2016-09-01 02:56:54 +01:00
Christopher Chedeau
1a113a15c9 Update to jest 15
Jest 15 has just been released and is way more awesome: http://facebook.github.io/jest/blog/2016/09/01/jest-15.html

This pull request updates jest from version 12 to 15. Right now there's a fix in jest around Symbol that hasn't been released yet, so this will break CI and cannot be merged it. But once it ships by the end of the day, we'll be good to go :)

See comments inline for all the changes I've done.
2016-08-31 18:25:03 -07:00
Paul O’Shannessy
2e38fcf355 Add more specific link to react-addons-shallow-compare readme (#7608) 2016-08-31 15:53:30 -07:00
Paul O’Shannessy
c73d8633c3 Copy all SVG child nodes when using setting innerHTML in IE (#7618) 2016-08-31 11:50:58 -07:00
Mateusz Burzyński
51476de913 Guarded ensureScrollValueMonitoring against some malicious script on the Internet overriding native document.createEvent (fixes #6887) (#7621) 2016-08-31 15:25:18 +01:00
Ben Alpert
7d7defe30f Improve error boundaries tests (#7569) 2016-08-30 20:02:56 -07:00
Miller Medeiros
51f04fdbc1 Add checkpoint/rollback to ReactNativeReconcileTransaction (#7619) 2016-08-30 15:42:36 -07:00
Kevin Lin
c85f46320e Add 'as' keyword (#7543) (#7582)
* Add 'as' keyword (#7543)

* fix commenting to adhere to styling

* fix grammar in comment
2016-08-30 15:14:46 -07:00
Miller Medeiros
0c031c55b8 Improve error boundaries tests 2016-08-30 14:59:17 -07:00
Christopher Chedeau
f7076b7759 Kill keyOf :) (#7615) 2016-08-30 11:03:05 -07:00
Christopher Chedeau
2f9a9dc4c5 Remove keyMirror in TopLevelTypes (#7597)
This is the last callsite of keyMirror! It removes 0.5k gzipped :)

The only trick with this one is that ReactTestUtils actually iterates over the list of all the events. Instead of duplicating the logic, I used the $Enum feature of flow that lets us statically extract out the type from the dynamic value. Inside of react-dom we're no longer requiring the file directly so it doesn't bloat the file size, and we still get to have static typing, best of both worlds!
2016-08-30 09:50:16 -07:00
Christopher Chedeau
738a9e3ef2 Remove keyMirror in PropagationPhases (#7596)
See rationale in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
2016-08-30 09:44:14 -07:00
Paul O’Shannessy
395888435b Cleanup ReactErrorUtils (#7610)
This cleans up the Flow annotations and brings the implementations in line.
2016-08-29 20:44:47 -07:00
Michael Jackson
9fd42264fe s/npmcdn/unpkg/g (#7609)
npmcdn.com is moving to unpkg.com. Same backend, one less letter in the
domain name. Boom.
2016-08-29 19:45:31 -07:00
Duke Pham
3071f31d04 Add line breaks to examples on 10.1-animation docs per (#7606)
comments to issue #7317.
Updated JP doc examples to match other languages
Reformat to match JSX multi-line style #7550
2016-08-29 15:50:23 -07:00
Robert Kielty
ee199381de Adds minor additions clarifying questions I had reading intro tutorial (#7595) 2016-08-29 15:34:48 -07:00
Marcin Mazurek
ba84b5b0a7 Warn if input changes controlledness - also for null (#7544) (#7603) 2016-08-29 11:23:30 -07:00
Nick Raienko
5331fd00bc Ignore bundle.js for examples (#7498)
* Ignore bundle.js for examples

* Move ignored bundle.js under examples directory
2016-08-29 10:34:46 -07:00
Clay Miller
3c73463eb1 Remove non-standard 'icon' property (fixes #7430) (#7508) 2016-08-29 10:33:28 -07:00
Nik Nyby
9511b4fe29 docs: re-position comments to account for code sample width (#7602) 2016-08-29 10:08:07 -07:00
TedPowers
8397ef58db Changed to !document.documentMode (#7594) 2016-08-29 04:33:36 -07:00
Christopher Chedeau
a3e576e1bb Type Transaction (#7581)
This one is interesting because we have transaction objects being passed around everywhere in the codebase but there's actually no Transaction class. It's a "mixin" that comes to life by being Object.assigned to the prototype of a real "class" (before class was cool!). Therefore, we can't just say `var Transaction = require('Transaction'); (transaction: Transaction) => { }` because it would be the object that contains a mixin and not an instance of a transaction.

The trick I use is to export `TransactionType` and alias it to `Transaction` in the file as it doesn't actually require transaction. In case they do, we'll figure it out, but in the few files I looked at, it doesn't seem to be the case.

For the perform function, it actually typechecks pretty well!
2016-08-28 16:47:27 -07:00
Christopher Chedeau
dd0c65c6aa Remove the Mixin layer of indirection on ReactCompositeComponent (#7599)
As mentioned in https://github.com/facebook/react/pull/7581#issuecomment-242952042 we can remove the Mixin layer of indirection as it only exports a Mixin and I find it confusing.
2016-08-28 16:46:53 -07:00
Christopher Chedeau
dbe3584340 Remove the Mixin layer of indirection on ReactMultiChild (#7598)
As mentioned in https://github.com/facebook/react/pull/7581#issuecomment-242952042 we can remove the Mixin layer of indirection as it only exports a Mixin and I find it confusing.
2016-08-28 16:46:39 -07:00
Christopher Chedeau
19b8eadb24 Type PooledClass (#7578)
This one was really interesting to type as it's doing a lot of unusual JavaScript. Fortunately flow is now pretty kick ass and I've been able to mostly type it. The only missing piece is that it won't check the constructor arguments.

If you are a fb employee, you can follow the discussion here: https://www.facebook.com/groups/flowtype/permalink/1132359430146004/
2016-08-28 10:43:13 -07:00
Christopher Chedeau
fa9869b5a0 Type ReactOwner (#7587)
Incrementally type ReactInstance by adding the types of attach/detachRef.

I moved isValidOwner as a function inside of the file since it's never used externally.
2016-08-28 10:31:49 -07:00
Christopher Chedeau
c9e03f0a85 Type ReactMultiChildUpdateTypes (#7589)
As mentioned in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/ I'm going to kill this instance of keyMirror and use a plain string instead with a type union.

The current type union is unused right now but when I type ReactMultiChild I will use it.
2016-08-28 10:31:30 -07:00
Christopher Chedeau
e3b2c6e650 Remove keyMirror in SpecPolicy (#7590)
As discussed in my RFC: https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
2016-08-28 10:30:59 -07:00
Christopher Chedeau
a35387c030 Remove keyMirror in ComponentLifeCycle (#7591)
See rationale in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
2016-08-28 10:30:33 -07:00
Christopher Chedeau
84084153ed Remove keyMirror in ReactPropTypeLocations (#7592)
This one involves a bit more work as I added "phantom" flow types to a bunch of places where the type is a ReactPropTypeLocations even though those files are not `@flow` yet.

A good side effect is that `ReactPropTypeLocationNames` keys are now correctly typed, this means that they cannot go out of sync without breaking flow :)
2016-08-28 10:30:15 -07:00
Christopher Chedeau
0d927844fb Type ReactDebugTool (#7586)
Flow doesn't really support the concept of variables that are non-null but only inside of a `__DEV__` block. There's an internal post about it ( https://www.facebook.com/groups/flowtype/permalink/1132437726804841/ ) and the conclusion is that we should force it to be non-null and trust the developer to put the proper DEV checks in place.
2016-08-27 14:13:18 -07:00
Christopher Chedeau
2fb5eae372 Type ReactPerf (#7585)
We need to export FlushHistory type and I submitted a PR on flow to fix the type of console.table which is too restrictive.

I'm already starting to see the benefits of flow, I can look at random variables in the code and flow knows what shape the objects are! It's really useful to try and understand what's going on :)
2016-08-27 14:12:54 -07:00
Christophe Hurpeau
517a0dc051 doc: npm ls react is a better advice (#7513)
Refs Must Have Owner Warning
`npm ls react` is a better advice than `npm ls | grep react`
2016-08-26 23:04:00 -07:00
Christopher Chedeau
c086e5f94e Type ReactDebugTool (#7576) 2016-08-26 14:47:59 -07:00
Christopher Chedeau
09887e0311 Type ReactInvalidSetStateWarningHook (#7572) 2016-08-26 14:47:15 -07:00
Christopher Chedeau
e2ddbac35e Type ReactChildrenMutationWarningHook (#7571) 2016-08-26 14:46:57 -07:00
Christopher Chedeau
b977cf13c4 Remove unneeded declare (#7570)
It turns out that we don't need it, flow is smart enough to realize that the function is declared in the two branches :)
2016-08-26 08:42:03 -07:00
Christopher Chedeau
f784a2d50a Type ReactComponentEnvironment (#7566) 2016-08-25 20:08:20 -07:00
Christopher Chedeau
66e77f696a Fix lint errors (#7568)
In Type ReactComponentTreeHook #7504, I merged even though travis didn't report green (travis for all the fb repos has been backlogged like crazy since this morning) by manually doing `npm test` and `npm run flow` but I didn't ensure that lint was all green.

@millermedeiros pinged me about it so here's a quick fix
2016-08-25 19:16:34 -07:00
Miller Medeiros
38f74bcaf4 Support error boundaries on ReactTestRenderer (#7558) 2016-08-25 16:35:55 -06:00
Christopher Chedeau
ea494a2c10 Type ReactComponentTreeHook (#7504)
For this one, I wanted to type a non-trivial piece of the codebase and ran into the fact that we do not have types for ReactElement nor ReactInstance, so I had to create them.

I'll add comments inline
2016-08-25 15:27:03 -07:00
Christopher Chedeau
563f3bbab4 Type ReactPropTypesSecret (#7501) 2016-08-25 15:26:38 -07:00
Christopher Chedeau
a72a156f58 Type ReactElementSymbol (#7564) 2016-08-25 15:23:29 -07:00
Christopher Chedeau
03e8c0eb75 Type ReactErrorUtils (#7565) 2016-08-25 15:23:13 -07:00
Christopher Chedeau
18003578b1 Type canDefineProperty (#7500) 2016-08-25 10:46:49 -07:00
Christopher Chedeau
ad3c65186e Type ReactPropTypeLocations (#7502) 2016-08-25 10:46:26 -07:00
Christopher Chedeau
7f64baad78 Type ReactPropTypeLocationNames (#7503) 2016-08-25 10:46:15 -07:00
Christopher Chedeau
08614db025 Update flow to 0.31 (#7557) 2016-08-25 09:43:28 -07:00
Dan Abramov
a229cdba7f Ensure lifecycle timers are stopped on errors (#7548)
* Ensure lifecycle timers are stopped on errors

Fixes #7349

* Address review feedback and add an extra test
2016-08-24 19:18:32 +01:00
Dan Abramov
0a248ee7b9 Show React events in the timeline when ReactPerf is active (#7549)
* Show React events in the timeline when ReactPerf is active

This currently only seems to work on Chrome.

* Address Chrome issue
2016-08-24 18:40:16 +01:00
Paul Kehrer
7b11aa9450 Add playsInline as an allowed HTML property (#7519)
The WHATWG has unprefixed `-webkit-playsinline` as `playsinline` (see: https://github.com/whatwg/html/pull/1444) and iOS 10 intends to use it (https://webkit.org/blog/6784/new-video-policies-for-ios/).
2016-08-23 10:47:51 -07:00
NestorTejero
32e60fecdc add explicit link to http://bower.io/ (#7546) 2016-08-23 09:30:12 -07:00
Lucas
56e20b4ab5 Fix minor typo in README.md (#7540) 2016-08-21 18:36:54 -07:00
Lucas
869cb05b76 Add missing KeyUp eventType (#7533)
Fixes #7222.
2016-08-19 18:03:35 -07:00
Paul O’Shannessy
077d32cebb Update website for 15.3.1
(cherry picked from commit 199056cf1b)
2016-08-19 14:20:02 -07:00
Paul O’Shannessy
e10f83de12 Update readme for 15.3.1
(cherry picked from commit cc41ec258f)
2016-08-19 14:20:02 -07:00
Paul O’Shannessy
9af8be654b Update changelog for 15.3.1
(cherry picked from commit 3c0906ca24)
2016-08-19 14:20:01 -07:00
Greg Palmer
a8741963dc Avoid "Member not found" error in IE (#7411)
Explanation, discussion, and similar change as #7343

Addresses #7320
2016-08-19 14:43:34 -06:00
Ben Alpert
6a65960641 Improve validateDOMNesting message for whitespace (#7515)
For #5071.
2016-08-19 11:45:14 -07:00
Paul O’Shannessy
944be18357 Upgrade to fbjs v0.8.4 (#7532) 2016-08-19 10:40:03 -07:00
Alex Zherdev
11c0adcc95 Fix header link generation for non-English docs (#7497) 2016-08-18 14:55:50 -07:00
Alexandre Kirszenberg
9f5b009f05 Fix ReactTestInstance::toJSON() with empty top-level components (#7523) 2016-08-18 13:02:09 -07:00
龙海燕
db6f36bdce Update 09.2-package-management.md (#7520) 2016-08-18 08:52:07 -06:00
ventuno
a9e681a828 Warn if using React.unmountComponentAtNode on a different React instance's tree. (#7456)
* Warn when using React.unmountComponentAtNode on a different React instance's tree

https://github.com/facebook/react/issues/3787

* Adding tests.

* Implementing recommended changes.

https://github.com/facebook/react/issues/3787
2016-08-17 17:20:36 -07:00
Ben Alpert
921d8c151b Update onlyChild invariant message (#7514) 2016-08-17 13:03:31 -07:00
Dan Abramov
680685bec4 Fix slow performance of PropTypes.oneOfType() on misses (#7510)
It used to be slow whenever a type miss occurred because expensive `Error` objects were being created. For example, with `oneOfType([number, data])`, passing a date would create an `Error` object in `number` typechecker for every item.

The savings depend on how much commonly you used `oneOfType()`, and how often it had “misses”. If you used it heavily, you might see 1.5x to 2x performance improvements in `__DEV__` after this fix.
2016-08-17 10:04:56 +01:00
Jess Telford
aa48c82b0d React.Children.toArray() changes keys (#7495)
As noted by @spicyj in #5541
2016-08-15 23:43:33 -07:00
Troy DeMonbreun
3013afe2d5 Fix for #7170 (#7486)
* Write failing test

* Ensure .min and .max are set before .value

* Adjusting test for false negative

* Revert test adjustment (apparently it was only failing locally)
2016-08-15 13:38:53 -05:00
Christopher Chedeau
9a48b5ca7b Fix flow (#7499)
ReactElement requires a generic argument now and the return function of render is a ReactTestInstance and not a ReactElement.
2016-08-15 18:04:22 +01:00
Dan Abramov
48475787b4 Avoid indexOf() during unmounting a root in the hook (#7496)
* Avoid indexOf() during unmounting a root in the hook

* Check for (Map|Set).prototype.keys
2016-08-15 15:47:54 +01:00
Tanase Hagi
09f0a06b8a Add propsTypes and defaultProps example for stateless functions (#7458)
* Add propsTypes and defaultProps example for stateless functions

* Update 05-reusable-components.md

* Update 05-reusable-components.md
2016-08-14 12:04:47 -05:00
Andres Suarez
8d1e416d9a Remove last use of mapObject (#7494) 2016-08-13 20:13:56 -07:00
Andres Suarez
e5f9ae2705 Avoid object iteration when creating DOM factories (#7493) 2016-08-13 19:30:06 -07:00
Dan Abramov
db452bd20b Use ES6 Map in ReactComponentTreeHook if available (#7491)
* Use ES6 Map in ReactComponentTreeHook if available

* Make getRootIDs fast again

* Only use native Map
2016-08-13 21:43:18 +01:00
jaaberg
fdc91e016f Fix typo in changelog (#7468) 2016-08-13 13:45:04 -05:00
Dan Abramov
a56e105081 Don't define key or ref dummy props if none were provided (#7488)
* Don't define key or ref dummy props if none were provided

This fixes a performance regression.

* Style nit
2016-08-13 19:36:57 +01:00
Dan Abramov
a73886456e Fix ReactComponentTreeHook.getRegisteredIDs() to work with inlined content (#7490)
I broke this in #7463: parseInt() cuts off #text at the end.
Changing to just use negative numbers instead.
2016-08-13 19:36:21 +01:00
Dan Abramov
cba2b19b84 Remove ReactDOMInstrumentation (#7481)
Its events are not being used anywhere.
2016-08-12 20:09:27 +01:00
Dan Abramov
4b734f7a02 Improve DEV performance in Chrome (#7483)
* Ensure this._domID is always a number

* Ensure this._rootNodeID is always a number
2016-08-12 18:34:46 +01:00
Sebastian Markbåge
c8f7215b20 Use aliasify everywhere instead of browserify-global-shim (#7476)
I already had to aliasify to have better control over the requires
so we might as well do it everywhere for consistency.

This probably makes it easier to rebase the rollup work too
because aliases seems to be how you solve this in that world.
2016-08-11 20:17:37 -07:00
Sebastian Markbåge
1c5a639c37 Require the isomorphic React instead of internals from renderers (#7473)
This is needed for flat builds. It also lets us get rid of a bunch
of special cases in the build scripts.

It also allow us to just copy the source files into React Native
instead of having to build first to resolve the special cases.
2016-08-11 18:56:55 -07:00
Dan Abramov
0e976e136c Consolidate hook events (#7472)
* Remove onBeforeMountComponent hook event

It is unnecessary.
We now pass the element as part of onInstantiateComponent, and it can't change before mounting.

* Remove onComponentHasMounted hook event

It is unused after #7410.

* Replace on(Begin|End)ReconcilerTimer hook events

We already have onBeforeUpdateComponent.
Let's just have on(Before?)(Mount|Update|Unmount)Component and stick with them.

This removes double event dispatches in some hot spots.

* Remove onComponentHasUpdated hook

The tests still pass so presumably it was not necessary.

* Add missing __DEV__ to TestUtils code

* Replace on(InstantiateComponent|SetParent) with onBeforeMountComponent

This lets us further consolidate hooks.
The parent ID is now passed as an argument to onBeforeMountComponent() with the element.

* Remove onMountRootComponent hook event

It is unnecessary now that we pass the parent ID to onBeforeMountComponent.

* Use parentDebugID = 0 both for roots and production

This removes some awkward branching.
2016-08-11 19:35:50 +01:00
Sebastian Markbåge
f7e0db9a18 Build React DOM Fiber package (#7173)
This builds a `react-dom-fiber.js` bundle which exposes ReactDOMFiber.
This allows early experiments with the new Fiber reconciler.

I also expose it in the npm package through `react-dom/fiber`.
2016-08-10 18:45:14 -07:00
Sebastian Markbåge
0f004efce2 Build renderers into their individual npm packages (#7168)
This copies modules into three separate packages instead of
putting it all in React.

The overlap in shared and between renderers gets duplicated.

This allows the isomorphic package to stay minimal. It can also
be used as a direct dependency without much risk.

This also allow us to ship versions to each renderer independently
and we can ship renderers without updating the main react package
dependency.
2016-08-10 18:17:49 -07:00
Sebastian Markbåge
c06a68a10b Mock ReactDOM for Fiber Tests (#7206)
We currently write all our tests against the DOM implementation.
I need a way to run the Fiber tests against it. But I don't want
to take on any package dependencies on Fiber modules yet.

There's a problem with jest right now where you can't globally
mock modules that already exist. So I have to add a global call
to jest.mock.

Luckily we already have a way to test the useCreateElement paths
using a feature flag. I won't activate this flag in travis until
it passes, but the idea is to run all three variants in travis.

I'm not sure that invoking rAF and rIC synchronously is the best
way to test this since it doesn't capture the backwards
compatibility aspect. I.e. the fact that people might be relying
on the synchronous nature in real apps too. It's a start.

Ideally, jest would have these built-in.
2016-08-10 17:44:36 -07:00
Dan Abramov
1f31357a2e Remove unnecessary indirection and events from the hooks (#7464)
* Remove unnecessary indirection from the tree hook

* Replace onSetDisplayName, onSetOwner, onSetText with one event

Less events is better.
onSetDisplayName, onSetOwner, and onSetText only existed because we didn't initially track elements.

* Remove unused variables
2016-08-11 00:19:09 +01:00
Dan Abramov
afa27bc4d5 Fix unmounting performance regression in __DEV__ (#7463)
* Comment previous occurrences of this issue

* Fix DEV performance regression in V8

* Extract try/catch into a separate function when calling hooks
2016-08-10 20:14:59 +01:00
Dan Abramov
178cb7d339 Prevent performance regression in DEV due to warning arguments (#7461)
* Prevent internal performance regression

This only affects Facebook website, not open source version of React.

On the Facebook website, we don't have a transform for warnings and invariants.
Therefore, expensive arguments will be calculated even if the warning doesn't fire.
This fixes a few cases where that calculation might be more expensive than usually.

In my testing, this brings down average row click time in Power Editor from ~300ms to ~220ms in __DEV__ (vs ~40ms in prod).

* Put warning() that shows up in profile behind condition
2016-08-10 19:52:46 +01:00
Keyan Zhang
5514ea369d Fix memory leak in ReactChildrenMutationWarningHook for SSR (#7410)
* corrected ReactChildrenMutationWarningHook's name

* changed `onComponentHasMounted` to `onMountComponent`

and get element from `ReactComponentTreeHook` instead of keeping an internal store
2016-08-10 19:50:18 +01:00
Paul O’Shannessy
c848b65378 Remove unused createHierarchyRenderer (#7454) 2016-08-09 16:03:24 -07:00
Sebastian Markbåge
ca9167c202 Include React itself in the list of shims (#7453)
Without this we end up bundling all of the isomorphic React into
the DOM bundle. This was fixed in #7168 too but I'll just do an
early fix to ensure that #7168 is purely an npm change.
2016-08-09 15:33:34 -07:00
Sebastian Markbåge
34c4474472 Fix trailing build issues (#7450)
Use relative path for addons UMD shim module

Use explicit top level wrapper marker for top level elements
2016-08-09 12:52:15 -07:00
Sebastian Markbåge
8ef00dbb7d Bundle DOM renderers into their individual UMD bundles (#7164)
* Cut out isomorphic dependencies from the renderers

These files reaches into isomorphic files.

The ReactElement functions are exposed on the React object anyway
so I can just use those instead.

I also found some files that are not shared that should be in
renderers shared.

* Found a few more shared dependencies

renderSubtreeIntoContainer is only used by the DOM renderer.
It's not an addon.

ReactClass isn't needed as a dependency since injection doesn't
happen anymore.

* Use a shim file to load addons' dependencies on DOM

By replacing this intermediate file we can do the lazy loading
without needing any lazy requires. This set up works with ES
modules.

We could also replace the globalShim thing with aliased files
instead for consistency.

* Bundle DOM renderers into their individual UMD bundles

Instead of exposing the entire DOM renderer on the react.js
package, I only expose CurrentOwner and ComponentTreeDevtool which
are currently the only two modules that share __state__ with the
renderers.

Then I package each renderer in its own package. That could allow
us to drop more server dependencies from the client package. It
will also allow us to ship fiber as a separate renderer.

Unminified DEV            after     before
react.js                  123kb     696kb
react-with-addons.js      227kb     774kb
react-dom.js              668kb     1kb
react-dom-server.js       638kb     1kb

Minified PROD             after     before
react.min.js               24kb     154kb
react-with-addons.min.js   37kb     166kb
react-dom.min.js          149kb     1kb
react-dom-server.min.js   144kb     1kb

The total size for react.min.js + react-dom.min.js is +19kb larger
because of the overlap between them right now. I'd like to see
what an optimizing compiler can do to this. Some of that is fbjs
stuff. There shouldn't need to be that much overlap so that's
something we can hunt. We should keep isomorphic absolutely
minimal so there's no reason for other React clones not to use it.
There will be less overlap with Fiber.

However, another strategy that we could do is package the
isomorphic package into each renderer bundle and conditionally
initialize it if it hasn't already been initialized. That way
you only pay an overlap tax when there are two renderers on the
page but not without it. It's also easier to just pull in one
package. The downside is the versioning stuff that the separate
npm package would solve. That applies to CDNs as well.

ReactWithAddons is a bit weird because it is packaged into the
isomorphic package but has a bunch of DOM dependencies. So we have
to load them lazily since the DOM package gets initialized after.
2016-08-09 12:39:03 -07:00
B.Orlov
7d57c1f0c1 Fix batchedUpdates return value (#7444) 2016-08-09 10:26:29 -07:00
Robert Martin
43674d989d Capitalize AJAX (#7435) 2016-08-08 16:24:30 -07:00
Robert Chang
0833d89783 change a word in performance docs (#7442) 2016-08-08 16:10:28 -07:00
Joseph Savona
ba2230df29 Fix link formatting on Relay blog post (#7434) 2016-08-05 14:54:34 -07:00
Sebastian Markbåge
a8c8191264 Merge pull request #7248 from sebmarkbage/fibercleanup
[Fiber] Various minor tweaks and a few big ones
2016-08-05 14:40:27 -07:00
Sebastian Markbage
af7dd8e0a1 Move wip fibers to childInProgress
This took a while to figure out, but we need to be able to store
children that are currently being worked on separately from the
current children. We always need a canonical "current" children
so that we can update them. However, we also need a different set
that we're currently working on so that we have a way to get to
already progressed work.

This solve the starvation problem in the first render because now
we can reach children that were never rendered and have a place
to store their progressed work on. The unit test changes tests
this.

This lets us get rid of the hasWorkInProgress flag.

When we reconcile new children we need to reconcile them against
progressed work so that we can reuse it. The progressed work is
"work in progress" nodes. So in that case we need to mutate
instead of clone, to preserve the invariant that only two versions
exist at any given point. This effectively forks the
ReactChildFiber implementation.
2016-08-05 14:33:48 -07:00
Sebastian Markbage
94ed00740b Introduce shouldComponentUpdate in Fiber
It is important to be able to use this since it avoids starvation
problems if you can reuse partially completed work.
2016-08-05 14:31:47 -07:00
Sebastian Markbage
de6069e550 Reuse the correct child and side-effects when reusing partial work
We need to use the *other* child because we reset it to the
current one on the way up.

We also need to reset the first/last side-effects to that of the
children so that we're committing the right thing.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
9fca812139 Fix NoWork bug
Thanks @acdlite. Add comment about future unit test coverage.

This was actually hiding the fact that we are only able to reuse
existing work if it was marked as completely finished which it
won't be if we reuse its pending priority.

However, we should be able to bail out even if there is work
remaining in a subtree.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
48b7b2c67c Add note about potential future bugs 2016-08-05 14:31:46 -07:00
Sebastian Markbage
5ac87e0d0f When a reconciliation gets down prioritized, reuse children
When we downprioritize children we need to remember to reuse the
old children in the update side-effect.

This whole set up is very unfortunate since we can have children
in our active tree that never actually finished rendering. This
strategy might be fundamentally flawed, not sure.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
d0838797a3 Set pendingProps in cloneFiber for symmetry
This might become confusing later but is unreachable today. That's
because existing pendingProps only matter when a clone is updated,
but this path can only matter when it is created.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
5c094fb5d1 Don't reset next work pointer for lower priority work
If the current work is higher priority than the new work, then
don't bother resetting the unit of work pointer since it won't
affect the execution order.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
7e9b958662 Reuse old props for the update if there are no new props 2016-08-05 14:31:46 -07:00
Sebastian Markbage
de4a7b972b Move all imports to closures in Fiber
I'm paranoid about inline-ability so I use this pattern of adding
a constant to the closure everywhere.

ES6 modules help avoid that but we can't use that consistently
because of the dependency injection so instead I opt for making
this explicit everywhere.

Grep: \b[a-zA-Z_$\d]+\.[a-zA-Z_$\d]+\(
2016-08-05 14:31:46 -07:00
Sebastian Markbage
e0e4954061 Remove console.logs from Fiber
The code is sufficiently complex now that this is more noise than
helpful. Will just temporary explicit logs in the future.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
00084f5503 [Fiber] Rudimentary class support
Mostly just to get started with unit testing.
2016-08-05 14:31:46 -07:00
Sebastian Markbage
28dc560d0f [Fiber] unmountComponentAtNode
Add unmounting hook.
2016-08-05 14:31:45 -07:00
Joseph Savona
aca62e7d24 Relay blog post (#7433) 2016-08-05 10:55:06 -07:00
Paul O’Shannessy
b910a1478d [docs] Use appropriately sized og:image (#7417)
Also runs through Imageoptim for smaller size.
2016-08-03 14:08:44 -07:00
Paul O’Shannessy
d1cff59ddc Fix JSON in package.json (#7408) 2016-08-02 16:05:03 -07:00
Paul O’Shannessy
c5cb5b8bd8 Specify "files" field for npm packages (#7396) 2016-08-02 15:11:45 -07:00
Paul O’Shannessy
1bb257de93 [docs] Use npmcdn (#7394) 2016-08-02 13:44:06 -07:00
Keyan Zhang
8af6f9e5a2 Fix <input> with type date/time/etc. issue on mobile browsers (#7397)
Fix <input> with type date/time/etc. issue on mobile browsers
2016-08-02 12:56:05 -07:00
Timothy Yung
0fb8febd0a Change trackedTouchCount invariant into a console.error (#7400)
* Change `trackedTouchCount` invariant into a console.error

* Fix ResponderEventPlugin lint warning
2016-08-01 22:42:30 -07:00
Nathan Hunzaker
8aed0cd67e Add some semicolons for linting. (#7390) 2016-08-01 21:17:58 +01:00
Keyan Zhang
328fc75bc9 Merge pull request #7381 from keyanzhang/rename-hooks
Rename Devtool to Hook
2016-08-01 11:42:33 -07:00
Nathan Hunzaker
2823dfcbfb Avoid "Member not found exception" in IE10 (#7343)
'change' custom events raise "Member not found" in <= IE10. To
circumvent this, the SyntheticEvent class now checks for "typeof
event.cancelBubble !== 'unknown'". This eliminates this exception and
maintains the expected bubbling functionality.

Addresses #7320.
2016-07-31 13:59:51 -07:00
Keyan Zhang
bba0d992d8 temporary compatibility fix 2016-07-29 16:49:44 -07:00
Paul O’Shannessy
57ae3b389d [docs] add permalink for newly translated page (#7380) 2016-07-29 16:24:43 -07:00
Keyan Zhang
81f554817c renamed methods (devtool -> hook) 2016-07-29 16:12:23 -07:00
Keyan Zhang
f2fc182250 renamed modules (devtool -> hook) 2016-07-29 16:12:23 -07:00
Paul O’Shannessy
092f5ae867 Update website for 15.3.0
(cherry picked from commit cc01d1be33)
2016-07-29 12:17:41 -07:00
Paul O’Shannessy
7d4e97f9e5 Update readme for 15.3.0
(cherry picked from commit 7251f6a6e9)
2016-07-29 12:17:41 -07:00
Paul O’Shannessy
26f55b4dbb Changelog for 15.3.0
(cherry picked from commit f7837682b4)
2016-07-29 12:17:41 -07:00
Paul O’Shannessy
25aa5e36c9 [docs] Add permalink to PropTypes warning page (#7377)
Followup to #7219, which was created before the Jekyll 3 upgrade, which needs the permalink field.
2016-07-29 12:14:01 -07:00
Dan Abramov
8329856a3f Add “Don't Call PropTypes” warning (#7219) 2016-07-29 12:04:33 -07:00
Dustan Kasten
7e874f59f5 ReactTestRenderer package (#7362) 2016-07-28 21:39:05 -07:00
Keyan Zhang
c9dc2ab0ec fixed incorrect doc location (#7365) 2016-07-28 11:03:07 -07:00
Cheng Lou
0292d34047 PropTypes: distinguish nullable from optional object field (#7291)
* PropTypes: distinguish nullable from optional object field

This gives a more precise message (no type semantics change) to the case of passing a field in an object, but whose value is `null`:

Before:

```js
propTypes: {
  foo: React.PropTypes.number.isRequired
}
```

Would scream "Required prop `foo` was not specified in `MyComp`".

Now it'll be "Required prop `foo` was specified in `MyComp`, but its value is `null`.".

Works as expected in nested objects.

This fixes the issue of a component transitively passing a `null`, specifying the correct field to the child but have the child tell it that it didn't provide the prop.

Optional field and nullable are two different things anyway.

* Add missing test case.

* Reword messages.
2016-07-26 16:26:51 -07:00
Jackson Huang
fe5128fe8f Create 02-displaying-data.zh-TW.md (#7284)
* Create 02-displaying-data.zh-TW.md

* Update 02-displaying-data.zh-TW.md
2016-07-26 13:45:12 -07:00
Ben Alpert
30aa84181d Remove unused unmountIDFromEnvironment (#7259)
I got rid of the need for this a few months ago.
2016-07-25 23:34:22 -07:00
Patrick Finnigan
85dcbf83c5 fix doc for React Native mountComponent (#7313) 2016-07-25 16:19:15 -07:00
Gert Hengeveld
9d33fb0b76 Added ReactNL conference (#7342) 2016-07-25 16:17:05 -07:00
Amjad Masad
d157827311 "transient dependencies" -> "transitive dependencies" (#7341)
I think that's what you meant -- although with npm dependencies are kind of transient :P
2016-07-25 16:16:11 -07:00
scloudyy
5b06667efd Update docs zh cn (#7254)
* update 03-interactivity-and-dynamic-uis.zh-CN

* update 04-multiple-components.zh-CN

* update 05-reusable-components.zh-CN

* updat 06-transferring-props.zh-CN

* update 07-forms.zh-CN

* update 08-working-with-the-browser.zh-CN

* update 08 and 08.1

* update 09-tooling-integration.zh-CN

* revise

* don't use ES6
2016-07-25 12:23:45 -07:00
Veljko Tornjanski
0805921883 Wording change in doc (#7348) 2016-07-25 11:59:15 -07:00
Keyan Zhang
484f96bb61 Merge pull request #7321 from keyanzhang/codemod-es6-component
Codemod tests from createClass to ES2015 classes
2016-07-23 15:22:35 -07:00
Keyan Zhang
4d8a5bcd5c codemodded tests from createClass to ES2015 classes
- reverted more files under classic
2016-07-23 15:16:12 -07:00
Keyan Zhang
bf26e70374 upgraded babel-plugin-transform-class-properties
- babel/babel#3589 fixed inferring class name
2016-07-23 15:16:12 -07:00
Nathan Hunzaker
08a0895887 Avoid validation warning when inputs change type (#7333)
For controlled inputs, `updateWrapper` was getting called before the
`type` prop had a chance to update. This could lead to a case where
switching from the `text` to `number` type caused a validation error
that would prevent the proper input value from being assigned.

This commit moves the call to `ReactDOMInput.updateWrapper` below
`_updateProperties` to avoid this situation.
2016-07-22 18:38:29 -07:00
Seyi
1fc5f284c0 Blog post: Fixed typo in post (#7336) 2016-07-22 12:40:46 -07:00
Paul O’Shannessy
7614c12ed7 Host our own images for the blog, use https links (#7339) 2016-07-22 12:36:07 -07:00
Steven Syrek
c0b7d81872 Correct grammatical error (subject-verb agreement) (#7338)
"It is worth repeating: there is no configuration files or complicated folder structures." > "It is worth repeating: there are no configuration files or complicated folder structures."
2016-07-22 19:13:11 +01:00
Dan Abramov
6e3b69f055 Add blog post 2016-07-22 16:58:33 +01:00
Keyan Zhang
3fd582643e improved warning in ReactUpdateQueue (#7326) 2016-07-21 12:41:31 +01:00
Keyan Zhang
fc04e853f8 Add babel-plugin-transform-class-properties (#7322)
* added babel-plugin-transform-class-properties

* removed babel-plugin- prefix
2016-07-20 17:39:10 -07:00
Paul O’Shannessy
5ac1bae58e Switch Travis CI to Trusty Beta (#7309) 2016-07-20 11:47:16 -07:00
Alex Zherdev
8bcea5310e Mention actual prop type in element type checker (#7319) 2016-07-20 19:16:55 +01:00
Paul O’Shannessy
5e3959e071 Merge pull request #7308 from zpao/jekyll3
Upgrade to Jekyll 3
2016-07-19 16:33:59 -07:00
Paul O’Shannessy
5e18eb3487 Finish Jekyll 3 Upgrade
- Reverts change to use sectionid on layouts (was unreliable), using config to make sure that's specified on all pages that need it
- Adds permalinks to all other pages so that og data is correct
- Corrects some permalinks that were in correct (translations)
2016-07-19 15:08:58 -07:00
Daniel Lo Nigro
6d537e939f Upgrade to Jekyll 3
Full list of changes is at https://jekyllrb.com/docs/upgrading/2-to-3/. The tl;dr of it is:
 - Relative permalinks were removed, so all the files in the `docs` subdirectory need their permalink to be prefixed with `docs/`
 - `post` and `page` types were renamed to `posts` and `pages` respectively
 - `jekyll-paginate`, `pygments` and `redcarpet` are all now optional, so I needed to explicitly add it to the Gemfile. Jekyll now uses `rouge` rather than `pygments` for syntax highlighting, but rouge does not support highlighting individual lines (`hl_lines`) so we need to continue using Pygments.
 - Layout metadata (eg. `sectionid`) is now on a `layout` variable rather than `page`

Tested the following pages and confirmed that they all work:
 - "Docs" link (getting started page): http://127.0.0.1:4000/react/docs/getting-started.html
 - Downloads: http://127.0.0.1:4000/react/downloads.html
 - Tutorial: http://127.0.0.1:4000/react/docs/tutorial.html
 - A few pages under the "docs" subdirectory, to confirm they're working properly:
    - http://127.0.0.1:4000/react/docs/addons.html
 - http://127.0.0.1:4000/react/docs/why-react.html
 - http://127.0.0.1:4000/react/docs/create-fragment.html
 - A few tips:
    - http://127.0.0.1:4000/react/tips/false-in-jsx.html
 - http://127.0.0.1:4000/react/tips/style-props-value-px.html
 - Non-English versions of the page:
    - http://127.0.0.1:4000/react/docs/getting-started-it-IT.html
    - http://127.0.0.1:4000/react/docs/getting-started-ja-JP.html
2016-07-19 12:18:49 -07:00
Paul O’Shannessy
c3ce0f24c9 Update website for 15.2.1
(cherry picked from commit ea880f2e2c)
2016-07-19 12:17:34 -07:00
Paul O’Shannessy
1252739c84 Update readme for 15.2.1
(cherry picked from commit 5597ca70be)
2016-07-19 12:17:34 -07:00
Paul O’Shannessy
cae816cf09 changelog for 15.2.1
(cherry picked from commit 6b19617333)

Changelog fixes

(cherry picked from commit dfb5cc306f)

Fix typo in previous changelog update

(cherry picked from commit 57a1ebb809)
2016-07-19 12:17:20 -07:00
Sassan Haradji
1cc9a5dc71 prevent spamming warnings related to performance measurement code (#7299)
* prevent spamming warnings related to performance measurement code

* minor changes in names and such

* -

* -
2016-07-19 11:46:12 +01:00
Dan Abramov
15ae5857f6 Eagerly evaluate inline requires in Jest (#7245)
* Eagerly evaluate inline requires in Jest

I inlined some requires in #7188 to fix the build size regression.
However this caused an issue with Jest due to it resetting module registry between tests.

This is a temporary fix to #7240.
It should be reverted as part of #7178.

* Make the hack work in all environments
2016-07-16 20:51:25 +01:00
Dan Abramov
6c9da39514 Clarify the section about dogfooding (#7292) 2016-07-16 15:02:20 +01:00
Dan Abramov
dc11e615ad Minor tweaks to Design Principles (#7283) 2016-07-14 21:29:11 +01:00
Dan Abramov
9d995720da Add Design Principles to the docs (#7282) 2016-07-14 20:37:28 +01:00
Dan Abramov
27d7592cf6 Fix TestUtils crash with NODE_ENV=production (#7246)
I caused it with #7189.
We generally don’t recommend running TestUtils in production environment but this is technically a regression.

Fixes #7231.
2016-07-14 12:02:39 +01:00
Fernando Alex Helwanger
f6d4293003 Add mixins property to context example (#7277) 2016-07-14 10:43:47 +01:00
Troy DeMonbreun
fc04310792 Fix #7099 (#7251)
* Set step prop before value prop

* Embed comments on .step sequence behavior
2016-07-13 13:28:14 -07:00
Paul O’Shannessy
0bfaf5156d [docs] Follow up to 6972 - update docs code (#7278) 2016-07-13 13:17:09 -07:00
segmentationfaulter
bf0572dde7 Update 03-interactivity-and-dynamic-uis.md (#6972) 2016-07-13 13:14:41 -07:00
Mert Kahyaoğlu
2da50a0f18 Renaming: ReactDOM (#7265)
Rename React with ReactDOM
2016-07-13 12:59:02 -07:00
Brandon Dail
cccef3c683 Add referrerPolicy to HTMLDOMPropertyConfig (#7274) 2016-07-13 11:56:57 -07:00
Dan Abramov
f02cbba9fd Fix typos in “Mixins Considered Harmful” (#7275)
* Fix typos in “Mixins Considered Harmful”

* Use consistent code style
2016-07-13 18:46:21 +01:00
Dan Abramov
b0136b37c5 Add a new blog post about mixins (#7273) 2016-07-13 17:40:53 +01:00
Keyan Zhang
5103e1d6a1 warn for using maps as children with owner info (#7260) 2016-07-13 08:29:42 -07:00
Ben Alpert
caec8d5ce7 Test renderer improvements (#7258)
Adds `.update(newElement)` and `.unmount()` and makes children reorders and composite type swapping work.

Part of #7148.
2016-07-12 22:35:31 -07:00
Ben Alpert
e5513eceff Update benchmarks to be more realistic polymorphically (#7255)
Previously, the extract-components script would create the same number of layers of composites as the page it captures, but it would output a new class for each time any composite is used (since we don't want to replicate all the component logic).

I changed the script to output a single type for each type in the input -- and each generated component takes an index for which output it should return. This should be closer to how the original code behaves, especially with respect to VM function call lookups where the amount of polymorphism makes a difference.

I re-recorded the benchmarks with the new scripts. They run significantly faster:

```
Comparing old.txt (control) vs new.txt (test)
Significant differences marked by ***
% change from control to test, with 99% CIs:

* ssr_pe_cold_ms_jsc_jit
    % change: -41.73% [-43.37%, -40.09%]  ***
    means: 39.3191 (control), 22.9127 (test)
* ssr_pe_cold_ms_jsc_nojit
    % change: -44.24% [-46.69%, -41.80%]  ***
    means: 45.8646 (control), 25.5764 (test)
* ssr_pe_cold_ms_node
    % change: -45.61% [-47.38%, -43.85%]  ***
    means: 90.1118 (control), 49.0116 (test)
```

This is probably in part due to the changes here, but also the page I captured has changed somewhat in the meantime and there seem to be slightly fewer components in the hierarchy, so they're not really comparable. But going forward we can use this benchmark which should be more accurate. I also included an identical copy that uses stateless functional components so we can test optimizations to those later.
2016-07-12 19:32:51 -07:00
Kent C. Dodds
12bc80a6dc Add link to video chat with @spicyj (#7252) 2016-07-12 14:42:19 -07:00
Zac Smith
473097144c Remove uneccesary colon (#7238)
Only use a colon after a statement that is a complete sentence, like [Grammer Girl says](http://www.quickanddirtytips.com/education/grammar/colons).
2016-07-12 11:19:07 -07:00
Varayut Lerdkanlayanawat
45223dc8bf Reformat event names in Media Events section (#7250) 2016-07-12 10:10:29 -07:00
Usman
c52a2b9ab0 Fixed all eslint warnings (#7230) 2016-07-11 17:47:41 -07:00
Paul O’Shannessy
92492e08b2 Merge pull request #7229 from zpao/blog-post-errorcodes
Blog post for error codes
2016-07-11 17:41:41 -07:00
Keyan Zhang
f5a11dcc3a Blog post for error codes 2016-07-11 17:39:12 -07:00
Samy Al Zahrani
9a80d42817 Add xmlns and xmlns:xlink attributes (#6471) 2016-07-09 13:32:53 +01:00
Dan Abramov
64e7602b3b Fix unmounting performance regression in V8 (#7232)
As reported in #7227, unmounting performance regressed with React 15.
It seems that `delete` has become much slower since we started using numeric keys.
Forcing dictionary keys to start with a dot fixes the issue.
2016-07-09 01:32:20 +01:00
Brandon Dail
b6e1eb2718 Inject default batching after pending transactions (#7033) 2016-07-08 18:52:14 +01:00
Dan Abramov
1a0e3a3215 Make ReactPerf.start() work during reconciliation (#7208)
* Add failing test demonstrating a ReactPerf warning

* Make the failing ReactPerf test more precise

* Make ReactPerf.start() work during reconciliation

* Reorder lifecycle methods for greater clarity

* Fix memory leak

* Error boundaries should not break ReactPerf

* Put onBeginFlush/onEndFlush into transaction wrappers

This looks cleaner even though it is not strictly necessary.
We still call them manually for unmounting because it doesn't have a transaction.
2016-07-07 19:41:30 +01:00
saiyagg
21ce27161d Remove duplicate line (#7210) 2016-07-07 13:26:17 +01:00
Ben Alpert
c8fbdac227 Add React.PureComponent (#7195)
This provides an easy way to indicate that components should only rerender when given new props, like PureRenderMixin. If you rely on mutation in your React components, you can continue to use `React.Component`.

Inheriting from `React.PureComponent` indicates to React that your component doesn't need to rerender when the props are unchanged. We'll compare the old and new props before each render and short-circuit if they're unchanged. It's like an automatic shouldComponentUpdate.
2016-07-06 13:24:44 -07:00
Andrey Okonetchnikov
0d892c03da Do not render name attribute on INPUT if it is not supplied. Closes #7198. (#7199) 2016-07-06 10:11:46 -07:00
Paul O’Shannessy
5c737b9550 Don't detach value from defaultValue for submit/reset inputs (#7197) 2016-07-05 16:39:43 -07:00
Dan Abramov
d2ff462b79 Pass shouldHaveDebugID flag to instantiateComponent (#7193)
* Add failing tests for #7187 and #7190

* Pass shouldHaveDebugID flag to instantiateComponent

This allows us to remove a hack that was added in #6770 and caused #7187 and #7190.

* Move logic for choosing whether to use debugID outside instantiate
2016-07-06 00:22:24 +01:00
Brandon Dail
2c93a41580 Use hardcoded value for PropType secret (#7194)
Rename secret!
2016-07-06 00:22:01 +01:00
Sebastian Markbåge
4f7a38c3b7 Move error boundaries test into reconciler (#7166)
The src/core folder moved while this PR was pending so this file
didn't move with it.

Let's get rid of this annoying top level folder.
2016-07-05 15:09:13 -07:00
Paul O’Shannessy
26ed910f28 Import warnings that currently live in gists. (#7175) 2016-07-05 13:52:58 -07:00
Marshall Bowers
69703e04d5 Gulp: lint, flow, and version-check (#7174)
* Add plugin loading for gulp

* Convert `lint` task to gulp

* Convert `flow` task to gulp

* Convert `version-check` task to gulp

* Add missing semicolons
2016-07-05 13:30:09 -07:00
Timothy Yung
2b226f5fa6 Revise ResponderTouchHistoryStore Error Handling (#7143)
Touch behavior is inconsistent across different platforms, and ResponderTouchHistoryStore currently fatals when assumptions are broken. In addition, the behavior differs between development and production.

This pull request does a few things to make ResponderTouchHistoryStore easier to deal with:

Adds Flow to keep the TouchEvent, Touch, and TouchRecord types straight.
Changes behavior to be consistent across environments. This means either always throwing or never throwing (and making use of warning and console.error as appropriate).
When an orphaned move or end event is received, print debug information and ignore it instead of crashing and burning.
2016-07-05 13:15:58 -07:00
Brandon Dail
95ac239cf3 Warn if PropType function is called manually (#7132)
* Warn if PropType function is called in production

* Check if console is undefined before warning

* Randomize value of ReactPropTypesSecret

* Remove dev environment tests

* Rename typeCheckPass to productionWarningCheck

* Rename productionWarningCheck to expectWarningInProduction

* Call toString on Math.random()

* Rename test block for React type checks

* Make sure warning isnt emitted for failing props

* Cache warning by component and prop, warn in dev

* Pass ReactPropTypesSecret to internal checks

* Move tests to ReactPropTypes-test.js

* Update the warning message to include link

* Do not test warning for unions  with invalid args
2016-07-05 20:02:50 +01:00
Dan Abramov
5d31ebcf5f Disable DebugTools in production (#7189) 2016-07-05 19:41:45 +01:00
Keyan Zhang
48ccab788b Fixed PR link 2016-07-05 11:21:31 -07:00
Dan Abramov
4aa860e1bb Mention @Aweary’s #6933 in 15.2.0 changelog 2016-07-05 19:10:38 +01:00
Dan Abramov
36734f4d37 Add link to @troydemonbreun’s contribution
We missed this PR in the changelog
2016-07-05 18:54:36 +01:00
Christopher Chedeau
309215fc40 [flow] isTextInputElement (#7075)
Summary:

I had to cast into any because flow doesn't think that checking the lowercase version of nodeName is a valid way to refine the variable from HTMLElement to HTMLInputElement. I'm also not confident enough in changing the implementation to an instanceof HTMLInputElement to please flow. It also takes care of the null check in the process.

The `nodeName &&` condition wasn't useful since the two branches are checking it against concrete values and actually makes the type different since nodeName is not a boolean per se. I replaced them with if conditions to make it clearer what it actually did instead of doing boolean logic tricks.

It is unclear why I had to type supportedInputTypes, see this internal post for a discussion: https://www.facebook.com/groups/flowtype/permalink/1084168611631753/

The only difference in behavior is that I now explicitely convert to boolean the object dereference via `!!`.

Test Plan:
npm run flow
Careful inspection of the code

Reviewers: @zpao @spicyj
2016-07-05 10:22:56 -07:00
Dan Abramov
8fe6b5fb46 Inline dev-only requires (#7188)
* Inline dev-only requires

This reduces the production bundled build size.

* Use new references after resetting module registry in tests

This fixes the tests which were broken due to inlining some requires.
2016-07-05 18:20:12 +01:00
Christopher Chedeau
07cfba17a9 [flow] fix flattenChildren type (#7110)
Summary:
Make the debug attribute optional

Test Plan:
npm run flow

Reviewers: @keyanzhang @chicoxyzzy
2016-07-05 09:18:49 -07:00
Dan Abramov
7d0801e1a0 Remove Danger.dangerouslyRenderMarkup as it is dead code (#7185) 2016-07-05 03:25:06 +01:00
Dan Abramov
24dfb56113 Remove unnecessary Flow annotation
It was added in #7127 but this file isn’t type checked anyway.
2016-07-04 15:48:41 +01:00
Robin Ricard
dbdddf1c82 Trigger a proper no-op warning for async state changes on server (#7127)
This commit fixes #5473: ReactDOMServer.renderToString: presence of onClick
handler causes errors on async update

This commit performs the following changes:

- Adds a getUpdateQueue method to ReactServerRenderingTransaction,
  ReactReconcileTransaction, ReactNativeReconcileTransaction and
  ReactTestReconcileTransaction
- Make the ReactCompositeComponent call this getUpdateQueue instead of using
  ReactUpdateQueue that was unwanted at certain moments on server
- On ReactServerRenderingTransaction, dispatch ReactUpdateQueue's methods
  while rendering and warning methods afterwards. This is done through the new
  ReactServerUpdateQueue class
- Added a series of tests that mimics the case presented in #5473 with setState,
  forceUpdate and replaceState
- Add flow typechecking on concerned files
2016-07-04 15:47:00 +01:00
Richard Roncancio
6e5dd8926c Removed transitionAppearTimeout to remove warning (#7165)
- Removed the prop transitionAppearTimeout from
addons/transitions/ReactTransitionGroup in order to remove a warning
when passing unknown props to DOM elements.
2016-07-02 23:25:12 +01:00
Samuel Reed
3946ac33b8 Add PropTypes.symbol to reusable components doc (#7171) 2016-07-02 20:54:47 +01:00
Sebastian Markbåge
4bc1048e0d Unshare not actually shared files (#7167)
This moves some files out of shared that are not actually shared
with isomorphic. They're specific to the renderers.
2016-07-01 19:16:52 -07:00
Paul O’Shannessy
23cfe03c99 Changelog for 15.2.0
(cherry picked from commit 74c29b391a and  bc1d59ee19)
2016-07-01 12:23:01 -07:00
Paul O’Shannessy
f40e6dbc76 Update website for 15.2.0
(cherry picked from commit 3a6584b2ee)
2016-07-01 12:21:56 -07:00
Paul O’Shannessy
7ef584b2c3 Update readme for 15.2.0
(cherry picked from commit 516aa96419)
2016-07-01 12:21:48 -07:00
Sebastian Markbåge
cf259a4ff8 Merge pull request #7154 from sebmarkbage/sideeffects
[Fiber] Host Side Effects
2016-06-30 16:35:38 -07:00
Griffin Michl
39265cb892 Group warnings for unknown DOM properties (#7153) 2016-07-01 00:13:32 +01:00
Sebastian Markbage
e60fb7eca0 Nits 2016-06-30 15:55:09 -07:00
Sebastian Markbage
05c6925282 Rudimentary DOM Renderer with Example 2016-06-30 14:30:16 -07:00
Sebastian Markbage
c6b5622bff Schedule side-effects to parents before their children
This is only for host nodes so that the DOM tree is fully updated
by the time we've flushed.

Classes will schedule their life-cycles *after* their children's
side-effects.
2016-06-30 14:29:17 -07:00
Sebastian Markbage
2f0ff6e974 Apply side-effects to host containers
This updates the host container root with new children.
Currently, this is always called for updates because we don't
track if any children reordered.
2016-06-30 14:29:17 -07:00
Sebastian Markbage
62d4561910 Host environment side-effects
This creates a new API for processing side-effects on the host
environment.

During initial reconciliation host instances are created during
the time sliced periods.

During updates there is an opportunity for the host
to prepare something on the instance during the time slicing, and
to determine whether there were any changes. The could be thrown
away.

At the commit phase, these changes are finally committed to the
host instance.
2016-06-30 14:29:17 -07:00
Sebastian Markbage
a4b8bebe18 Dependency injection in the begin/complete/commit phases
This just makes them instantiable so that we can get access to the
host config in these.
2016-06-30 14:29:17 -07:00
Sebastian Markbage
f84a8eabc7 Fiber side-effects
This adds tracking of side-effects that gets scheduled during an
update.

As the tree gets reconciled, the side-effectful fibers are linked
together in an ordered singly linked list. That way we can walk
the linked list to commit only the work that needs to be
synchronous - quickly.

We also store first and last nodes within a fiber. That
way when we reuse an already processed subtree, we can reuse that
subset of the linked list.
2016-06-30 14:29:16 -07:00
Sebastian Markbåge
291f8e30a9 Merge pull request #7034 from sebmarkbage/newreconciler
[Fiber] Host Container Fiber and Priority Levels
2016-06-30 14:28:05 -07:00
Sebastian Markbage
6a8cedf985 Remove unreachable code
This should've been caught above.
2016-06-30 12:55:55 -07:00
Sebastian Markbage
4a8651412d Renamed fiber.parent -> fiber.return
This is not just the parent Instance but also the return Fiber for
some piece of work. This clarifies and buys into this definition.

Basically, in the current model you will always pass into a fiber
from the parent that you're going to return to. Even if you get
aborted and reused this will be updated to the correct return
fiber before you get back here.

I don't have any guarantees in place to enforce this right now. I
don't really know how to, but seems safe. :)

I confirmed that the use of keyword properties work for old
engines because we have the transform enabled in our build system.
2016-06-30 12:55:55 -07:00
Sebastian Markbage
385d085886 Feedback on style 2016-06-30 12:55:55 -07:00
Sebastian Markbage
d8f785165c Reuse work that was preempted if it was untouched
This tries to reuse work that was completed but another higher
priority event came in. This tries to avoid starvation when high
priority events causes low pri work to keep rerendering from
scratch.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
6b86764ac1 Use a recursive algorithm for dumpTree
The parent pointer is updated to one of the two versions during
work so if you log in the middle of work, it gets confused.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
ea08c0020c Resume work deep in a bailed out child immediately in same pri
I found a way to test this case without any need for setState.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
5971411e87 Don't block deep low pri updates when bailing out
First I fix a bug where host components didn't properly bail out
although this was unobservable.

When we bail out, we need to ensure that we preserve the highest
remaining priority work that is left to do for that subtree.

This still isn't properly handling the case when that work has the
*same* priority as the current one. That work will be flushed the
*next* tick instead of the current pass.

I can't create a test for that yet since I need setState to get to
that state.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
285e661757 dumpTree helper for debugging
It is helpful to be able to dump information about the current
tree for debugging issues in unit tests.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
97cd8e179a Attack of the Clones!
This fixes some bugs with the clones and traversing backwards
through them. It is important that we maintain the correct parent
at all times and that clones have the correct values.

We need to carefully clone everything on the way up to the the
fiber with the next work to do.

This code is a bit messy and fragile now. I'm sure I didn't get it
all right but I want to get the basics in place first. Then we can
structure this part better. I think the general algorithm is sound
though.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
986c63c6d4 Extract scheduler into its own module
The scheduler is getting quite complicated. I'll extract it into
its own module.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
7d028fd8cc Reorganize the top level around a FiberRoot
We need a canonical stateful root for each. I don't really want to
overload the HostContainer for this purpose since it makes the
fiber code more specialized.

Instead I create a root which represents an actual stateful root.

When these get scheduled they get chained together in a linked
list. However, we don't hold onto anything that doesn't have
scheduled work. This will help us release everything automatically
in the GC, as long as there are no subscriptions nor scheduled
work.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
5e65f2f622 Bubble up pending work priority to the top level
This is a bit poorly structured. I'll restructure when the pieces
are better in place.

Basically we reset the priority of a node before work on the
children. The children then bump their parent if they end up
having work left.

This is the first time we're seeing deep updates happening. The
new unit test demonstrates this.

There is an interesting case that happens when we fall back out of
a deep update. We end up "completing" a node that we didn't begin.
This probably breaks in coroutines. When that completes, it'll try
to render the sibling next but that should bail out so we check
for any pending work on the sibling. That one I'm not sure about.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
8ad8bd1939 Automatically downgrade an update to a hidden node
This automatically downgrades the priority of a hidden node. Its
children won't be reconciled until they come around the next time.
2016-06-30 12:55:54 -07:00
Sebastian Markbage
e53f0dc4b4 Pass the priority level along to children 2016-06-30 12:55:53 -07:00
Sebastian Markbage
f04c38ed65 Create HostContainer Component Type
This is essentially equivalent to the current top level wrappers.
They contain the next children to be mounted into a container node
from the host.

It is the responsibility of the host to retain references to them
for updates.

I expect them to be able to exist in the middle of the tree in
the future, for renderSubtreeIntoContainer.
2016-06-30 12:55:53 -07:00
Sebastian Markbage
61fe5e11dc Test ability to abort work 2016-06-30 12:55:53 -07:00
Sebastian Markbage
81537c3e51 Rename input -> props
I tried to be clever and generalize it but this is currently only
props and there are other assumptions that might break down if it
isn't.
2016-06-30 12:55:53 -07:00
Sebastian Markbage
5e0ff5f966 Add Priority Levels Enum
This flag on fibers will be used to track what priority of work is
needed by that subtree, if any at all.

Also fix up the TypeOfWork to have consistent naming and typing.
2016-06-30 12:55:53 -07:00
Sebastian Markbage
ed215634be Get rid of ugly and difficult to follow breaks in switch
Because pattern matching or something.
2016-06-30 12:55:53 -07:00
Troy DeMonbreun
6cc037bd0d Fix for #5468: Validate PropTypes.oneOf(Type) arguments early (#6316)
* Fix for 5468: Validate proptype definitions sooner

Added typeCheckWarn() func and updated the oneOf/oneOfType tests
Added __DEV__ warning for invalid oneOf/OneOfType args

* Suppress redundant error on warn; typeCheckWarn() removed

* Return no-op

* Using emptyFunction module for consistency

* Remove createChainableTypeChecker() call

* Adjust test to assert type check passes when warned
2016-06-29 01:30:41 +01:00
starkch
f94912516f Reword invariant message about empty tags (fixes #7065) (#7066)
* addresses issue #7065

* fix test to use new message

* fix string in tests

* fix test string

* Update error message and tests
2016-06-27 23:30:09 +01:00
Dan Abramov
25f9f4563e Fix renderSubtreeIntoContainer to update context (#7125)
* create failing test case

* Fix renderSubtreeIntoContainer to update context

Fixes #6599

* Also test re-rendering due to prop update

* Address review feedback
2016-06-27 23:29:43 +01:00
Ben Alpert
abcd567325 Make "unexpected batch number" a warning (#7133)
This was added to catch internal errors in React but doesn't seem to be doing much good except frustrating people more when their apps throw (#6895, FB-internal t11950821). Until more proper error boundaries land, let's make this a warning.
2016-06-27 13:39:23 -07:00
Dan Abramov
a49b7a2dfb Fix tests from #6158 to use Jasmine 2 (#7126) 2016-06-27 01:38:45 +01:00
Esteban
752e1595fc Remove comment about PooledClass destructors being optional (#6560)
They are no longer optional since #4720
2016-06-26 21:52:12 +01:00
Swaroop SM
18bad0669f Warn if the included mixin is undefined (#6158) 2016-06-26 20:14:08 +01:00
Evan Jacobs
5a20d449f6 [TestUtils] Copy type to nativeEvent in Simulate.<eventName> (#6154)
Although it is unreasonable to set every possible property for
simulated events, `type` is useful for event handlers that are shared
between types and potentially have different behaviors.
2016-06-26 20:11:37 +01:00
Brandon Dail
60760eb915 Clarify purpose of state property in ES6 classes (#7109) 2016-06-23 12:44:36 -07:00
Sergey Rubanov
3b5c756c7a [flow] add some typings to utils (#7104)
* add some typings to utils

* add typing of flattenChildren

* more accurate typings for flattenChildren
2016-06-23 18:16:37 +02:00
Christopher Chedeau
9342c2f02f [flow] type deprecated (#7076)
Summary:

Test Plan:
npm run flow

Reviewers: @zpao @spicyj @gabelevi
2016-06-23 17:46:24 +02:00
Jim
416b5ef173 Remove dead HAS_SIDE_EFFECTS logic (#6987) 2016-06-22 16:12:32 -07:00
Jim
b4fc27357c Add autoFocus to list of whitelisted dom element props. (#7098) 2016-06-22 14:30:16 -07:00
Dan Abramov
83cbc3e5fb Resolve refs in the order of the children (#7101)
* Resolve refs in the order of the children

React makes no guarantees about ref resolution order. Unfortunately, some of the internal Facebook component APIs (specifically, layer dialogs) currently depend on the ref resolution order. Specifically, the assumption is that if the layer dialog is placed as a last child, by the time it mounts or updates, the refs to any previously declared elements have been resolved.

With the current `ReactMultiChild`, this is *usually* the case but not always. Both initial mount and an update of all components satisfy this assumption: by the time a child mounts or updates, the previous children’s refs have been resolved. The one scenario where it isn’t true is when **a new child is mounted during an update**.

In this case, the `mountComponent()` call used to be delayed until `ReactMultiChild` processes the queue. However, this is inconsistent with how updates normally work: unlike mounting, updating and unmounting happens inside `ReactChildReconciler.updateChildren()` loop.

This PR changes the `mountComponent()` to be performed inside `ReactChildReconciler`, just like `receiveComponent()` and `unmountComponent()`, and thus ensures that `attachRef()` calls are enqueued in the order the children were processed, so by the time the next child flushes, the refs of the previous children have been resolved.

This is not ideal and will probably be broken by incremental reconciler in the future. However, since we are trying to get rid of mixins in the internal codebase, and layered components are one of the biggest blockers to that, it’s lesser evil to temporarily make ref resolution order more strict until we have time to fix up the layer APIs to not rely on it, and are able to relax it again (which would be a breaking change).

* Use array instead of object to avoid lookups
2016-06-22 22:28:06 +01:00
Jim
c7ba16fbbf webcomponents should use attachedCallback instead of createdCallback. (#7102) 2016-06-22 12:42:50 -07:00
Jared Fox
cd9ad90d05 fix webcomponent example issue #7056 (#7057)
* fix webcomponent example issue #7056

* update fix issue #7056, remove unused web component  callbacks
2016-06-22 10:30:04 -07:00
Paul O’Shannessy
4f00553c15 [docs] Update share button (#7097) 2016-06-21 16:21:10 -07:00
Christopher Chedeau
b0732ef881 [cleanup] Move ReactStateSetters inside of addons/link (#7085)
Summary:
The only callsite of ReactStateSetters is in LinkedStateMixin which lives in addons/link. Better move it there to avoid cluttering the other folder.

Test Plan:
None

Reviewers: @zpao @spicyj
2016-06-21 16:09:09 +02:00
Christopher Chedeau
489caeb2d7 [flow] type adler32 (#7080)
This one is trivial

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
2016-06-20 15:35:59 +02:00
Christopher Chedeau
12a6ad1ef5 [flow] type KeyEscapeUtils (#7079)
Summary:

The only call site ensures that the value is not null: dc6fc8cc07/src/shared/utils/traverseAllChildren.js (L44)

key is stringified inside of createElement, so we are guaranteed to receive a string right now: dc6fc8cc07/src/isomorphic/classic/element/ReactElement.js (L142)

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
2016-06-19 21:58:21 +02:00
Christopher Chedeau
5a21d49e3b Remove injectMixin (#6831)
Summary:
The only callsite left was removed here: e8af100849 (commitcomment-17570210) but the code to handle it remained.

Test Plan:
tbgs and ibgs, make sure there's no callsites.

Reviewers: @jimfb, @spicyj, @sebmarkbage
2016-06-19 21:57:27 +02:00
Christopher Chedeau
5b4dad31f8 Merge pull request #7053 from vjeux/flow_accumulate
[flow] annotate accumulate, accumulateInto and forEachAccumulated
2016-06-17 22:07:39 +02:00
Paul O’Shannessy
4886e028bf Specify possible need for C++ compiler (#7064) 2016-06-17 11:34:04 -07:00
Nik Nyby
a8d8210222 update babel-core to 5.8.34 in tutorial docs (#7059) 2016-06-16 20:50:14 -07:00
Claudio Brandolino
5bca3773ab Standardise format of the three "state" questions. (#7046)
* Standardise format of the three "state" questions.

The original format follows the template:

 > 1. x? if `x` then probably isn't state
 > 2. y? if `!y` then probably isn't state
 > 3. z? if `z` then it's not state

This caused both me and a hallway tester to do a double take.

The proposed reformulation allows the answers to follow the same template.

In the same spirit, it uses the same contraction pattern in the last answer (`it's not state`-> `it isn't state`). This has the welcome side effect to make the lack of "probably" stand out more.

* Update phrasing in thinking in reacr
2016-06-16 10:35:18 -07:00
Christopher Chedeau
1c71970431 [flow] annotate accumulate and accumulateInto
Summary:
Trying to start adding flow types to files in React. I needed to add a script to package.json in order to run flow, flow-bin is already a dependency.

I had to rewrite the implementation a bit. Flow doesn't recognize

```
var currentIsArray = Array.isArray(current);
if (currentIsArray) {
  // not refined
}
```

but the following does work

```
if (Array.isArray(current)) {
  // refined
}
```

Test Plan:
npm run-script flow
npm run-script test accumulate

Reviewers: @zpao @spicyj
2016-06-16 17:33:32 +02:00
Jim
49238b9440 Warn if people mutate children. (#7001) 2016-06-15 22:22:31 -07:00
Toru Kobayashi
718c07c915 Remove setProps and replaceProps from docs (#7044) 2016-06-14 22:13:26 -07:00
Toru Kobayashi
e8fa464d6f Remove setProps and replaceProps from src (#7045) 2016-06-14 22:11:37 -07:00
Jim
97d89fa5bf Move null-input-value-prop warning into devtool, add stack trace (#7040) 2016-06-14 16:34:38 -07:00
Paul O’Shannessy
6e8c2fb828 Revert "Remove setProps and replaceProps completely" (#7039) 2016-06-14 15:02:01 -07:00
Juan
b618b786a9 Update readme to latest React description (#7014)
* Update readme to latest React description

* Update readme to latest wordsmithing
2016-06-14 12:46:21 -07:00
Qin Junwen
a394ed6a6c Update 10.4-test-utils.md (#6971)
The find/scry methods which returns DOM component in react@0.13 now returns DOMElement in react@0.14 and later.
2016-06-14 14:09:20 -04:00
Robert Haritonov
4577db6d3c Add React Amsterdam conference to the list (#7028) 2016-06-14 11:02:13 -07:00
nhducit
eda159cd28 Update 03-interactivity-and-dynamic-uis.md (#7015) 2016-06-14 13:55:38 -04:00
Christoph Pojer
6b8db0e111 Add symbol to identify a ReactTestComponent instance. (#7035) 2016-06-13 22:50:28 -07:00
Ben Alpert
96d2a30c25 Wordsmith the homepage (#7022) 2016-06-13 12:40:18 -07:00
Ryo Shibayama
e487c36ec0 Fix Japanese/Italian/Korean tutorials (#7020)
* Fix japanese tutorial

* Fix Italian tutorial as same as e4fe662

* Fix Korean tutorial as same as e4fe662
2016-06-12 00:03:13 -07:00
Ben Alpert
c7868cc741 New marketing copy on homepage (#7012) 2016-06-10 19:47:23 -07:00
inkinworld
665633a1b7 Update 12-context.md (#6973)
Modify a clerical error
2016-06-10 11:52:10 -07:00
Dominic Gannaway
40f6d3eaca Performance: setTextContent should attempt to set TextNode nodeValue where possible (#7005) 2016-06-10 09:57:31 -07:00
Keyan Zhang
46cd6a0b62 pinned babylon version for eslint to work (#7008) 2016-06-09 16:14:44 -07:00
Jim
2282894d52 Remove console.log from test (#7006) 2016-06-09 09:24:03 -07:00
Jim
0bb0fe8d00 Fix controlled/uncontrolled validation for radio+checkbox inputs (#7003) 2016-06-09 07:58:42 -07:00
Toru Kobayashi
731e42998a Remove setProps and replaceProps completely (#6921) 2016-06-09 03:53:52 -07:00
ogom
9c7f895783 Updte tutorial to ja-JP (#6967) 2016-06-08 19:20:20 -07:00
Jim
f0b140d726 Fix IE11 placeholder textContent value bug. (#7002) 2016-06-08 18:58:37 -07:00
Brandon Dail
c47830d12c Warn if childContextType is defined on SFC (#6933)
Add console.error message content check

Use appropriate name in warning/test
2016-06-08 13:32:43 -07:00
Hiroyuki Wada
518336e2fb Fix #5839 Add error event to source element (#6941)
* Fix #5839 Add error event to source element

* Add test case for <source onError={callback}>
2016-06-08 13:30:27 -07:00
Josh Hunt
99d8524d23 Fix #6950, work around IE missing innerHTML on SVG nodes (#6982)
* Workaround IE lacking innerHTML on SVG elements

* Add tests for setInnerHTML

* Correctly check if node has innerHTML property

* Ensure tests for setInnerHTML actually tests both codepaths

* Provide mock element for setInnerHTML tests

* Only use SVG setInnerHTML workaround for SVG elements
2016-06-08 10:00:03 -07:00
Yusong Liu
5331323cd2 Fix the typo in the documentaion pages for shallowCompare (#6980)
* fix the typo for the docs of shallowCompare at:
https://facebook.github.io/react/docs/shallow-compare.html

* change "value" to "values" to match the two objects.
2016-06-07 23:09:50 -07:00
Sebastian Markbåge
0cafd83834 Merge pull request #6988 from sebmarkbage/newreconciler
[Fiber] Minimize abuse of .alternate
2016-06-07 18:42:18 -07:00
Timothy Yung
7988acaa95 Improve error message for components in bad states (missing instance) (#6990) 2016-06-07 17:23:40 -07:00
Keyan Zhang
1abce1630c Add reactProdInvariant and corresponding babel rewrite pass (#6948) 2016-06-07 17:11:04 -07:00
Sebastian Markbage
40180c4b26 Get rid of ugly and difficult to follow breaks in switch
Because pattern matching or something.
2016-06-07 17:05:25 -07:00
Sebastian Markbage
c83a0428f1 Minimize abuse of .alternate
This avoids using .alternate as much as possible and isolates it
to the root. For anything that is "work in progress" this happens
to be the same as the alternate field. To avoid an extra "current"
field on work in progress fibers, we can just use the alternate.

The timing for when this is true might be a bit tricky to reason
about so I explicitly pass the current value everywhere from the
top. That way we can always change this in the future to use an
explicit field or we can try to maintain a parallel data
structure that remembers which was the "current" fiber for each
wip child.
2016-06-07 15:03:32 -07:00
Sebastian Markbåge
ccd26ee020 Merge pull request #6981 from sebmarkbage/newreconciler
[Fiber] Add support for simple updates and fiber pooling
2016-06-07 14:30:07 -07:00
Sebastian Markbage
3a32d2642f Rename unitOfWork -> workInProgress
These values represent fibers that are incomplete. In the current
model they're mutated in place. In a completely immutable model
they would need to be cloned for every step they make progress.
I.e. one where the child is still in this WIP state and one when
it is complete.

To clarify this I'll name them workInProgress while they're in
that state, which is also what Jordan did in his prototype.
2016-06-07 13:49:12 -07:00
Sebastian Markbage
cce58ffd62 Simple updates using alternate fibers
This splits the Fiber type into Fiber and Instance. This could be
two different object instances to save memory. However, to avoid
GC thrash I merge them into one.

When ReactChildFiber reconciles children, it clones the previous
fiber. This creates a new tree for work-in-progress. The idea is
that once flushed, this new tree will be used at the root.

However, we know that we'll never need more than two trees
at a time. Therefore my clone function stores the clone on the
original. Effectively this creates a fiber pool.

Ideally, the .alternate field shouldn't be used outside of clone
so that everything can work with pure immutability. I cheat a bit
for now so I don't have to pass both trees everywhere.

ReactChildFiber is a bit hacky for reuse and doesn't solve all
cases. Will fix that once I try to get parity.
2016-06-07 13:49:11 -07:00
Jim
eb705d1448 Fix autofocus for input and textarea (#6986) 2016-06-07 12:50:37 -07:00
Dan Abramov
d101f68bce Tweak ReactPerf warning message and code style (#6977) 2016-06-06 20:59:28 +02:00
Ben Alpert
8c60aaf430 Revert "Fallback to legacy set/get in old versions of FF" (#6976) 2016-06-06 11:49:43 -07:00
Alexander
2a46103ac8 Warn that ReactPerf does not work in the production build (#6884)
Fixes #6871
2016-06-06 20:46:57 +02:00
Dan Abramov
afe483790b Revert "Warn that ReactPerf does not work in the production build (#6884, #6975)"
This reverts commit f71dfbcbf0.

Reverting because GitHub stripped the original PR author.
2016-06-06 19:44:40 +01:00
Dan Abramov
f71dfbcbf0 Warn that ReactPerf does not work in the production build (#6884, #6975)
Fixes #6871
2016-06-06 20:37:46 +02:00
Keyan Zhang
cf73de9459 [Docs] Error Decoder Page (#6946) 2016-06-04 14:43:56 -07:00
Ben Alpert
3c3c30a19a Fix function declaration in if statement (#6963)
Firefox doesn't like these and throws.
2016-06-04 13:37:57 -07:00
Keyan Zhang
96994c20b8 added instruction for downloading babel-browser (#6960) 2016-06-03 15:43:32 -07:00
Ben Alpert
1801d56500 Use remarkable instead of marked (#6961)
https://github.com/reactjs/react-tutorial/issues/139
2016-06-03 14:41:38 -07:00
Keyan Zhang
c9eb572a6f Fix null node issue in ReactCSSTransitionGroup (#6958) 2016-06-03 13:42:45 -07:00
Paul O’Shannessy
d3b36d5524 Merge pull request #6957 from zpao/flow026
Upgrade Flow
2016-06-03 13:17:15 -07:00
Paul O’Shannessy
dd093faadf Add <any> type args for ReactElement,Class,Component 2016-06-03 13:13:20 -07:00
Paul O’Shannessy
2efc7186fe Fix $FlowFixMe broken by comment spanning multiple lines 2016-06-03 13:13:19 -07:00
Paul O’Shannessy
36d1a271c4 Upgrade to flow 0.26 & match internal config with strict args
Also ignore examples, important because react can be installed by the commonjs
one and the modules will get detected there too, resulting in duplicate
definitions
2016-06-03 13:12:47 -07:00
Daniel Rosenwasser
6b3f11cdd7 Update link and description of TypeScript support. (#6953) 2016-06-03 10:27:39 -07:00
Andrew Imm
8216125d82 Fallback to legacy set/get in old versions of FF (#6930) 2016-06-02 11:35:21 -07:00
Sasha Aickin
d6e70586b7 Replace the implementation of escapeTextContentForBrowser with escape-html (#6862)
* Replacing the implementation of escapeTextContentForBrowser with escape-html for performance

* Addressing @spicyj's code review comment here: https://github.com/facebook/react/pull/6862#issuecomment-223102868 . Pulled the code of escape-html in to react and changed the encoding of single quote to &#x27.

* Addressing code review comment https://github.com/facebook/react/pull/6862#discussion_r65462074 to make code more inlinable for v8. Thanks, @spicyj.
2016-06-01 17:14:30 -07:00
Ben Alpert
9498747606 Remove Flux from docs nav (#6945)
Most people don't use the official Flux implementation or docs so I think this is likely to be more confusing than helpful. Maybe later we can add a better comparison of data management solutions.
2016-06-01 11:41:35 -07:00
Keyan Zhang
bfd1531eca Add a gulp script for extracting error codes (#6882) 2016-06-01 11:21:26 -07:00
Ben Alpert
50982cea99 Add rudimentary test renderer (#6944) 2016-06-01 11:17:10 -07:00
Jim
51f8b1b40c Remove css px warning, stop appending px to strings (#6899) 2016-05-31 14:32:27 -07:00
Sebastian Markbåge
dc5686a42f Merge pull request #6931 from sebmarkbage/newreconciler
[Fiber] Simple test assertions
2016-05-31 14:20:18 -07:00
Sebastian Markbage
8056fbc2c9 [Fiber] Simple test assertions
I'll split the coroutine and incremental testing into their own
tests so that I can expand them with more edge cases.
2016-05-31 13:52:28 -07:00
Sebastian Markbåge
7de23758f1 Merge pull request #6903 from sebmarkbage/newreconciler
[Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage
2016-05-31 13:39:59 -07:00
Sebastian Markbage
811084d74e Use the tag instead of stage field for coroutine stages
This gets rid of a field that we only need for coroutines.

We might need this if we have multi phase handlers in the future
but then maybe we can just use multiple tags.
2016-05-31 13:34:19 -07:00
Sebastian Markbage
aa14d89c7d Transfer everything from Element onto the Fiber
This has a few benefits:

1) This allows the element to always remain on the young generation.
2) The key can be accessed on the fiber which is easier to keep as the
same class and is directly accessible in the child reconciliation of every
object.
3) This conveniently means that we don't have to create a fake element for
continuations which was really hacky.

We can still do the quick bailout of rerendered things using the props
object which is also unique.
2016-05-31 13:34:19 -07:00
hjmoss
4e82e8b6e6 Grammar: less dependencies -> fewer dependencies (#6917)
* Grammar: less dependencies -> fewer dependencies

* changelog.md grammar: less dependencies -> fewer dependencies
2016-05-31 09:17:13 -07:00
Toru Kobayashi
97b44085ff Remove getDOMNode from docs (#6919) 2016-05-30 09:16:15 -07:00
Alex Jacobs
29ed7c6c8c Fix minor lint warnings (#6909) 2016-05-28 22:04:32 +01:00
Ben Alpert
e62384bca4 Fix style test for Jasmine 2 (#6913) 2016-05-28 12:58:08 -07:00
Nate Norberg
38900cc7ca Added more specific warning for using onDblClick instead of onDoubleClick (#6881) 2016-05-27 15:23:05 -07:00
Jim
ba3bfe3e31 Followup to 6896, add explanation of workaround. (#6905) 2016-05-27 09:19:25 -07:00
Bruce Harris
f329099831 Update tutorial with reference to autobinding docs (#6870)
* Update tutorial with reference to autobinding docs

* Update tutorial to clarify that autobinding happens specifically with createClass() API
2016-05-27 04:07:00 -07:00
Paul O’Shannessy
d87005e0b6 [docs] Use existing layout for redirecting html-jsx (#6904) 2016-05-26 23:50:55 -07:00
Ilya Gelman
b0cb4e850d Add ReactNext 2016 conference (#6833) 2016-05-26 23:43:00 -07:00
Daniel Lo Nigro
871116f001 Move HTMLtoJSX page off React site. References https://github.com/reactjs/react-magic/issues/52 (#6608) 2016-05-26 23:39:28 -07:00
Daniel Lo Nigro
d81f3297aa Add link to ReactJS.NET on server-side environments page (#6607) 2016-05-26 23:36:56 -07:00
Keyan Zhang
c8bab76091 switched to codemirror's jsx mode (#6898) 2016-05-26 23:33:04 -07:00
Paul O’Shannessy
5c6f9d31bd Merge pull request #6677 from zpao/dont-warn-css-0-string
Don't warn when style value is '0'
2016-05-26 20:05:32 -07:00
Sebastian Markbåge
0f4a4df12e Merge pull request #6859 from sebmarkbage/newreconciler
[Fiber] Child Reconciler + New Coroutines Primitive
2016-05-26 18:21:08 -07:00
Sebastian Markbage
fd4f74ef95 Coroutines 2016-05-26 18:13:21 -07:00
Sebastian Markbage
7c8a090994 Child Fiber 2016-05-26 17:27:19 -07:00
Robin Berjon
263615573c Stop passing null as second argument to document.createElement() (#6896)
* Stop passing null as second argument to document.createElement()

* rewrap check for props.is to make it more readable
2016-05-26 21:51:15 +01:00
Dan Abramov
ca5a0dad16 Merge pull request #6886 from Weizenlol/patch-1
Added own property check when deleting listeners.
2016-05-26 21:14:50 +01:00
Dan Abramov
1d3aceb6c3 Merge pull request #6890 from grgur/patch-1
Added React Europe 2015 videos
2016-05-26 13:50:55 +01:00
Grgur Grisogono
c5d4978f23 Added React Europe 2015 videos
Linking to the official channel that contains separate playlists for Day 1, Day 2, and Lightning talks
2016-05-26 14:29:48 +02:00
Weizenlol
b1882f870a Added own property check when deleting listeners.
React crash when default object prototype is modified.
2016-05-26 11:30:36 +03:00
Dan Abramov
2d74280679 Merge pull request #6880 from gaearon/clone-key-ref-props-2
Fix issues introduced by createElement() warning
2016-05-26 01:41:24 +01:00
Dan Abramov
58c9fda946 Inline expectations in tests as they are used once 2016-05-26 01:29:54 +01:00
Dan Abramov
55a0e4bf80 Infer displayName in more cases for props.ref/key warning 2016-05-26 01:21:28 +01:00
Ben Alpert
21d271f6d0 Warn when element is missing in devtool (#6869) 2016-05-25 17:11:57 -07:00
Dan Abramov
919eba3c99 Correctly check that element and props are frozen
This fixes an incorrect way of checking introduced in 95373ce769 (it had no effect).
2016-05-26 01:08:29 +01:00
Dan Abramov
a432afa750 Ignore specifically React warning getter in ReactElement
We don’t want to have different behavior in development and production.
Previously, we used to ignore getters on key/ref in dev, but we’d read them in prod.
Now, we only ignore the getters that we *know* we created so the production logic doesn’t differ.
2016-05-26 01:01:15 +01:00
Dan Abramov
e822cbd183 Make sure cloneElement() supports prototype-less config (#6878)
This brings createElement() fix from #6855 to cloneElement().
2016-05-26 00:37:18 +01:00
Dan Abramov
d9ae319821 Move tests concerned with cloning into ReactElementClone-test 2016-05-26 00:27:57 +01:00
Dan Abramov
c77411b1af Short-circuit the check just for getters
This way in other cases both DEV and PROD falls through to the check for undefined.
This fixes #6879 and a similar bug introduced for cloneElement() in 94d0dc68c8.
2016-05-26 00:21:18 +01:00
Dan Abramov
1b802fbd65 Add a test verifying undefined key and ref are ignored
It currently fails in `createElement` because of #6879 which was introduced in #5744.
It also fails in `cloneElement` because the code with that bug was extracted and shared in 94d0dc68c8.
2016-05-26 00:10:10 +01:00
Dan Abramov
15cd66b91b Tweak whitespace 2016-05-25 23:21:29 +01:00
Dan Abramov
f846edcbea Remove indirection when determining valid config and ref 2016-05-25 23:17:20 +01:00
Eric Matthys
94d0dc68c8 Do not clone key and ref getters 2016-05-25 23:02:56 +01:00
Andrew Clark
d7ced68dce Clarify that string refs are considered legacy. (#6692) 2016-05-25 22:47:34 +01:00
Ben Alpert
eb050727ee Revert "Update shallowCompare to accept nextContext" (#6877) 2016-05-25 14:37:48 -07:00
Dan Abramov
c0ecde687a Merge pull request #6872 from gaearon/jest-cli@12
Update to Jest 12.1.1 and Jasmine 2
2016-05-25 22:07:50 +01:00
Dan Abramov
5c509b150d Update Jasmine 2 PR with changes from master 2016-05-25 21:55:35 +01:00
Dan Abramov
9c22ef7e50 Update jest bin command 2016-05-25 21:49:32 +01:00
Dmitrii Abramov
00bc8ceaad jest@12.1.1 2016-05-25 21:49:31 +01:00
Dmitrii Abramov
5d332f22b4 ReactClassEquivalence 2016-05-25 21:49:31 +01:00
Dmitrii Abramov
517ed859b4 Upgrade to Jasmine 2 2016-05-25 21:48:32 +01:00
Paul O’Shannessy
d8a0b9a662 Upgrade to jest-cli@0.9 and use Jasmine2 2016-05-25 21:48:32 +01:00
Ben Alpert
510155e027 Fix instrumentation in shallow rendering (#6867)
Previously, this threw:

```
 FAIL  src/test/__tests__/ReactTestUtils-test.js (7.291s)
● ReactTestUtils › it can fail context when shallowly rendering
  - TypeError: Cannot read property '_source' of null
        at describeID (src/renderers/shared/devtools/ReactComponentTreeDevtool.js:70:46)
        at Object.ReactComponentTreeDevtool.getStackAddendumByID (src/renderers/shared/devtools/ReactComponentTreeDevtool.js:203:15)
        at checkReactTypeSpec (src/isomorphic/classic/types/checkReactTypeSpec.js:76:58)
        at ReactCompositeComponentMixin._checkContextTypes (src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:668:5)
        at ReactCompositeComponentMixin._processContext (src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:607:14)
        at ReactCompositeComponentMixin.mountComponent (src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:191:30)
        at ReactShallowRenderer._render (src/test/ReactTestUtils.js:483:14)
        at _batchedRender (src/test/ReactTestUtils.js:460:12)
        at ReactDefaultBatchingStrategyTransaction.Mixin.perform (src/shared/utils/Transaction.js:140:20)
        at Object.ReactDefaultBatchingStrategy.batchedUpdates (src/renderers/shared/stack/reconciler/ReactDefaultBatchingStrategy.js:65:19)
        at Object.batchedUpdates (src/renderers/shared/stack/reconciler/ReactUpdates.js:112:20)
        at ReactShallowRenderer.render (src/test/ReactTestUtils.js:453:16)
        at Spec.eval (src/test/__tests__/ReactTestUtils-test.js:289:34)
        at jasmine.Block.execute (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:1067:17)
        at jasmine.Queue.next_ (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2100:31)
        at jasmine.Queue.start (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2053:8)
        at Spec.jasmine.Spec.execute (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2380:14)
        at jasmine.Queue.next_ (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2100:31)
        at onComplete (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2096:18)
        at Spec.jasmine.Spec.finish (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2354:5)
        at eval [as onComplete] (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2381:10)
        at jasmine.Queue.next_ (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2110:14)
        at eval (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2090:18)
        at Timeout.e [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:440:19)
        at tryOnTimeout (timers.js:224:11)
        at Timer.listOnTimeout (timers.js:198:5)
```
2016-05-25 09:46:50 -07:00
Dan Abramov
8d7161e004 Don't count the time inside flushes towards lifecycle hooks (#6860)
* Don't count the time inside flushes towards lifecycle hooks

Fixes #6842.

We keep the existing behavior of testing for matching `onBeginLifeCycleTimer`/`onEndLifeCycleTimer` calls, but we push the current timer onto the stack if we enter a flush.
This solves an issue with portals which cause updates while a lifecycle timer is already running.

I chose to subtract the time spent in the flush from the time counted towards the lifecycle method because it would artificially inflate the “total” time of the component due to all the components inside the portal, so it would skew the exclusive table.

* Fix up the comment
2016-05-25 17:39:05 +01:00
Jim
de1de9e18f Add warning for unknown properties. (#6800) 2016-05-25 06:58:41 -07:00
Jim
4338c8db4b Properly set value and defaultValue for input and textarea (#6406)
* Have `defaultValue` reach DOM node for html input box for #4618

* Cleanup and bug fixes for merge.
2016-05-24 18:28:01 -07:00
Ben Alpert
cb4a0af7dd Remove unknown props in ART (#6861) 2016-05-24 17:04:18 -07:00
Ben Alpert
531a6b3265 Merge pull request #6775 from spicyj/fix-art
Copy React ART tests and add hacks to fix them
2016-05-24 16:47:54 -07:00
Ben Alpert
769ab715c2 Fix ART after Native -> Host rename 2016-05-24 16:44:33 -07:00
Ben Alpert
7ecff6a437 Add hacks to make React ART not warn from devtools 2016-05-24 16:44:33 -07:00
Ben Alpert
5cbb68258b Add (failing) React ART tests
This helps us make sure we don't break React ART in a minor or patch release. The idea is to not change these files when making minor or patch changes. Copied directly from react-art with requires fixed. (I also picked a different haste name just in case.)
2016-05-24 16:44:33 -07:00
Dan Abramov
9ba5668d18 Fix componentWillUnmount() not counted by ReactPerf (#6858)
* Fix componentWillUnmount() not counted by ReactPerf

* Test that functional component render() time shows up in ReactPerf

* Test for setState() code path updates being included
2016-05-24 20:50:08 +01:00
Alex Zherdev
6a101b6c10 Context docs updated with ES6 examples (#6852) 2016-05-24 11:27:38 -07:00
Ben Alpert
43b63995a8 Point people to prod build in perf docs (#6857) 2016-05-24 11:08:51 -07:00
Ali Taheri Moghaddar
c313baa0ca Avoid directly calling hasOwnProperty (#6855)
* Avoid directly calling hasOwnProperty

* Fix failing test case
2016-05-24 18:55:51 +01:00
Ben Alpert
fe2002c3d8 Add test to ensure 'undefined' children is used (#6853) 2016-05-23 17:22:05 -07:00
Keyan Zhang
db6ac5c01c Extract the type checker into a separate module (#6851)
The type checker is now a separate module under `isomorphic/classic/types`
2016-05-23 17:12:13 -07:00
Jim
799eae2faf Removed unnecessary null check (#6841) 2016-05-23 11:25:02 -07:00
Keyan Zhang
c136369a81 Remove prop types checking in ReactCompositeComponent (#6824)
Remove prop types checking in ReactCompositeComponent
2016-05-23 11:13:09 -07:00
Vedat Mahir YILMAZ
c7ef0af54b Interactivity and Dynamic UIs Docs page updated with ES6 Example (#6832)
* Interactivity and Dynamic UIs Pages ES6 Example

* Change bind handler
2016-05-22 02:32:14 -07:00
Rui Araújo
d955ee9fae Move ReactElementValidator to __DEV__ block (#6830)
It saves some more bytes in production mode.
2016-05-22 02:01:21 -07:00
Roderick Hsiao
fd589fc8dd Support onLoad event on link element (#6815) 2016-05-20 17:12:00 -07:00
Paul O’Shannessy
09075f8bab Update website for 15.1.0
(cherry picked from commit 7842c19934)
2016-05-20 16:34:56 -07:00
Paul O’Shannessy
015833e594 Update readme for 15.1.0
(cherry picked from commit b7d480986a)
2016-05-20 16:34:56 -07:00
Paul O’Shannessy
619b3e8509 Changelog for 15.1.0
(cherry picked from commit bca912f91e)
2016-05-20 16:34:56 -07:00
Keyan Zhang
47e49ae8b7 Add component stack info to key validation warnings (#6799)
* Add component stack info to key validation warnings

* Add `ReactComponentTreeDevtool.getStackAddendumByID`
2016-05-20 14:19:31 -07:00
Paul O’Shannessy
6a3e9d583b Merge pull request #6804 from dmitriiabramov/update_typescript
Update typescript
2016-05-20 11:09:27 -07:00
Keyan Zhang
e1e34274f6 Merge pull request #6814 from Ivanwangcy/master
Update 03-interactivity-and-dynamic-uis.zh-CN.md
2016-05-20 00:26:53 -07:00
Ivan
c36f5a087f Update 03-interactivity-and-dynamic-uis.zh-CN.md 2016-05-20 14:25:07 +08:00
hao.huang
09fdd1d578 Add permalink (#6813)
Add permalink to this doc,so we can access with 'prev' and 'next'
2016-05-19 19:54:42 -07:00
Dmitrii Abramov
efb6d80e60 match jest.d.ts by regex 2016-05-19 19:24:40 -07:00
chico
655ac0f0dd update typescript 2016-05-19 19:24:40 -07:00
Ben Berman
eda08d9656 Minor comment typo (#6808) 2016-05-19 14:21:59 -07:00
Dan Abramov
d1256825bc Merge pull request #6801 from iamdustan/instrumentation-to-shared
Move instrumentation to renderers/shared. Closes #6797
2016-05-19 13:24:06 +01:00
Dustan Kasten
d51981eeea Move instrumentation to renderers/shared. Closes #6797 2016-05-18 22:34:09 -04:00
Tony Rossi
8ea1cf4ee0 Update shallowCompare to accept nextContext (#6661)
* Update shallowCompare to accept nextContext

Across our application we are using immutable objects as properties and thus using shallowCompare for all our {{shouldComponentUpdate}}.  Because of this children with contextTypes don't get updates when the context on the parent changes.  Adding an additional comparison for context (when it is provided) fixes this problem.

* Remove the undefined check

* Add nextContext
2016-05-17 16:50:23 -07:00
Dan Abramov
7f08961604 Merge pull request #6789 from gaearon/tree-devtool-fixes
Make sure element is reported correctly by tree devtool
2016-05-17 23:34:58 +01:00
Dan Abramov
1070b4aa6c Make sure element is reported correctly by tree devtool
This adds some tests for getElement() and verifies that it works for text components too.
The code that calls the instrumentation is fixed where necessary so that the tests pass.
2016-05-17 23:07:35 +01:00
Jim
2e881aa4b4 Fire unknown prop warning when rendering client side. (#6693) 2016-05-17 15:06:31 -07:00
Dan Abramov
4ab203cd73 Test that elements are tracked by tree devtool
The test is currently failing because text elements are not reported in some cases.
2016-05-17 22:16:53 +01:00
Dan Abramov
503cbd3356 Merge pull request #6787 from gaearon/tree-devtool-test-tweaks
Refactor ReactComponentTreeDevtool test
2016-05-17 21:15:49 +01:00
Dan Abramov
9301cfbc80 Refactor ReactComponentTreeDevtool test
We extract common logic between DOM and native tests so they don't diverge.

Also, rather than build a tree object in advance for testing, we will walk the tree on the go.
This lets us have much more specific error messages with a clear path when something goes wrong.
2016-05-17 20:51:00 +01:00
David Aurelio
151e1d7014 Require modules from React Native as node modules. (#6715) 2016-05-16 13:03:38 -07:00
Ben Alpert
6afd51061a Embed JSX filename paths relative to repo root (#6778)
Test Plan: Changed the preprocessor to log the output of babel.transform and saw

```
var _jsxFileName = 'src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js';
```

in the resulting output, instead of an absolute path.
2016-05-16 11:15:12 -07:00
Sebastian McKenzie
3703b63a11 Remove unnecessary require causing excess memory usage (#6781) 2016-05-16 08:52:05 -07:00
Rachel D. Cartwright
207fe0b478 make test utils format consistent (#6777) 2016-05-15 13:46:03 -07:00
Ben Alpert
378c879a6a Show component stack in PropTypes warnings (#6771) 2016-05-14 17:40:39 -07:00
Ben Alpert
3cc733add4 Fix severe perf problems in component tree devtool (#6770)
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60.

We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though.

Reviewers: @gaearon, @sebmarkbage
2016-05-14 12:13:48 -07:00
Ben Alpert
5b5bd5eb75 Print stack in devtool exception warning (#6768) 2016-05-14 12:12:19 -07:00
Ben Alpert
03f4ba260b Track source more generically in ReactComponentTreeDevtool (#6765)
Being able to get the source for your parent components seems useful, and ReactComponentTreeDevtool is best poised to be able to do that.

I'm also not sure it makes sense to have separate DOM-specific `onMountDOMComponent` and `onUpdateDOMComponent` events, so I removed them for now. Even if we want them, their timing seemed sort of arbitrary.

I also made it so DOM devtools can listen to non-DOM events too. Willing to change that if people think it's ugly though.
2016-05-14 12:12:12 -07:00
Ben Alpert
c0007d56e9 Interleave trials in benchmark script
This should be more of a fair A/B test so the timings aren't affected by having different load on your system when testing the two alternatives.
2016-05-14 12:04:25 -07:00
Ben Alpert
cab835d3a0 Make benchmark script work in React 15 2016-05-14 12:03:51 -07:00
Nima Jahanshahi
32c750de5c Fixed an invalid escape char in attribute name regexp (#6772)
more info: https://www.w3.org/TR/xml/#NT-Name
2016-05-14 10:10:30 -07:00
Dan Abramov
74cce27fe0 Merge pull request #6767 from gaearon/fix-broken-master
Fix remaining onNativeOperation => onHostOperation rename
2016-05-14 01:47:31 +01:00
Dan Abramov
dea7cafd9d Fix remaining onNativeOperation → onHostOperation rename
We renamed it in #6754 but #6748 got merged after that referencing the old name.
2016-05-14 01:09:53 +01:00
Dan Abramov
5569d1d40e Merge pull request #6763 from nfcampos/is-running
added isProfiling() to ReactDebugTool and isRunning() to PerfTools
2016-05-13 20:50:38 +01:00
Nuno Campos
5b93a2bdbe added tests for repeated calls to ReactPerf.start/stop 2016-05-13 20:28:14 +01:00
Nuno Campos
201d03268e changed test 2016-05-13 08:24:25 +01:00
Ben Alpert
20bcabb1ea Remove some dead code (#6764) 2016-05-12 17:10:18 -07:00
Chad Fawcett
5d64199bb6 Add information on JSX element keys (#6751) 2016-05-12 17:02:07 -07:00
Dmitriy Kubyshkin
0e889d7c72 Fixed removing attributes during custom element update. Fixes #6747 (#6748) 2016-05-12 17:00:04 -07:00
Nuno Campos
a027d15aff added isProfiling() to ReactDebugTool and isRunning() to PerfTools 2016-05-12 19:27:05 +01:00
hao.huang
92bebcad5f Add permalink (#6713)
Add permalink to docs, so we can access with 'prev' and 'next'
2016-05-12 08:57:45 -07:00
djskinner
712b1f75bf Refer to correct example (#6760)
I *think* this should refer to the second example, where the instance to the ref is stored. In any case please can someone confirm for my own understanding?
2016-05-12 07:49:02 -07:00
Ben Alpert
ba9b985406 Rename host-y things to be "host" not "native" (#6754)
For clarity.

I left "native event" as-is because there's a lot of it, it's not particularly ambiguous, and SimulateNative/nativeTouchData are public API in ReactTestUtils.
2016-05-11 23:22:59 -07:00
Dan Abramov
de1bb7a71f Merge pull request #6753 from facebook/fix-6750
Fix a memory leak in ReactComponentTreeDevtool
2016-05-12 03:41:55 +01:00
Dan Abramov
3779a5d18c Fix a memory leak in ReactComponentTreeDevtool
`ReactDebugTool` used to only call `purgeUnmountedComponents()` while profiling, so information about unmounted instances kept accumulating when not profiling.

Additionally, unmounting in React Native and rendering to string did not correctly clean up the devtool.

Finally, the tests tested the wrong behavior and relied on explicit `purgeUnmountedComponent()` calls.

To fix this, we:

* Test specifically that unmounting is enough to clean up the tree devtool.
* Add missing `onBeginFlush` and `onEndFlush` calls to server and native rendering so `ReactDebugTool` knows when to copy the tree.

Fixes #6750
2016-05-12 03:19:55 +01:00
Dan Abramov
027d9a919b Merge pull request #6752 from facebook/fix-6742
Fix ReactPerf.printOperations() crash
2016-05-12 02:59:46 +01:00
Dan Abramov
9cebc26638 Fix a failing test and count IDs from one 2016-05-12 02:45:09 +01:00
Dan Abramov
f0594d2792 Remove the protective clause that is now unnecessary
Instead, we fixed the callsites to stop emitting events for empty components.
2016-05-12 00:50:18 +01:00
Dan Abramov
d80723b237 Check for missing debugID in ReactDebugTool
TopLevelWrapper and empty components have ID of 0.
These are implementation details and we don't want to leak them to devtools.
2016-05-12 00:45:07 +01:00
Dan Abramov
1559111bf9 Switching between null and a native should not be counted as a waste 2016-05-12 00:05:32 +01:00
Dan Abramov
0cd1d3b5a2 Allow empty components in the native operation logs
Fixes #6742
2016-05-11 23:31:50 +01:00
Marshall Bowers
6b1232aa86 Add basic issue and PR templates (#6597)
Issue template adapted from the Angular template, and PR template
adapted from the PR guidelines in CONTRIBUTING.md.
2016-05-11 15:30:25 -07:00
Dan Abramov
c8a7988bf9 Add a failing test case for #6742
getOperations() blows up when replacing null with a native because the null component has debugID of 0 that isn’t registered in the component tree.
2016-05-11 23:27:48 +01:00
Jarrod Mosen
01b060d7dc Fix grammar on homepage (#6746)
* Fix grammar in README

* Change DOM abstraction grammar on homepage
2016-05-11 15:03:05 -07:00
yiminghe
b11540ccb2 consistent owner for stateless component (#6534) 2016-05-10 22:21:16 -07:00
Sebastian Markbåge
cf157886e9 React Fiber Reconciler (#6690)
This is an outline for the new reconciler infrastructure.

I created a noop renderer to have something to get started from.

I split the reconciler folder into old and new, as well as shared.
I put shouldUpdateReactComponent in shared as an example of a
utility that can easily be shared between both. I plan on breaking
out more utilities like these.
2016-05-10 18:24:57 -07:00
Sebastian Markbåge
069f8099d6 Fix flow errors (#6719)
The new flow somehow found these on my machine but nowhere else
and not previously.
2016-05-10 11:56:32 -07:00
Ben Alpert
98cb2f8507 Revert "Don't wrap drag events in IE/Edge in dev builds" (#6741) 2016-05-10 10:58:35 -07:00
Dan Abramov
7bf96c08e6 Merge pull request #6377 from puradox/proptypes-symbol
Add new primitive PropType `Symbol`
2016-05-10 15:09:12 +01:00
Bradford
25be6dc027 fix minor capitalzation typo (#6736) 2016-05-09 21:41:40 -07:00
Dan Abramov
c3d52d8ec1 Fix zh-TW permalink 2016-05-10 02:21:10 +01:00
Dan Abramov
a95494d635 Fix ru-RU doc page permalinks
Fixes #6735
2016-05-10 01:39:15 +01:00
yiminghe
904ee9a678 allow to ignore value attribute for option (#5362) 2016-05-09 09:22:50 -07:00
Dan Abramov
982e096eb5 Merge pull request #6730 from elas7/fix-docs
[docs] Remove mention of 'nested object' as an allowed children in React.Children.map
2016-05-09 02:35:48 +01:00
Seba
46e658711e [docs] add link to create-fragment from React.Children.map docs 2016-05-08 22:12:07 -03:00
Seba
2fa52f375b [docs] Remove mention of 'nested object' as an allowed children in React.Children.map
Replace it with 'keyed fragment', since ReactFragments were made a replecement for Objects as allowed children in #4700
2016-05-08 21:26:40 -03:00
Yaxian
9ddf9e137e refine the translation of chapter 12-context (#6665) 2016-05-07 09:47:38 -07:00
Jim
96cb8c5fc4 Basic SSR support for error boundaries (#6694) 2016-05-06 16:54:06 -07:00
Sebastian Markbåge
700b7148ef Get patch versions of Flow (#6716)
Best practice or whatever.
2016-05-06 14:48:56 -07:00
Ben Alpert
82ab58ea03 Disable coverage on Travis (#6712) 2016-05-05 17:14:26 -07:00
Paul O’Shannessy
873369cc7c Cleanup: remove @nolint (#6703) 2016-05-05 16:12:17 -07:00
Andreas Svensson
2af4765a2a DOMLazyTree, populate <object> before insertion into DOM (#6691) 2016-05-05 15:12:11 -07:00
Ben Alpert
e01bf78a79 Move dev-only flags to only exist on composites (#6709)
_isOwnerNecessary was unused.
2016-05-05 15:07:04 -07:00
Dan Abramov
b6a6078167 Merge pull request #6647 from gaearon/bye-bye-reactperf
Replace ReactPerf with new implementation
2016-05-05 02:57:13 +01:00
Jay Phelps
fbe900265f [DOCS] ReactTextComponent was renamed ReactDOMTextComponent a while ago (#6700) 2016-05-04 14:44:53 -07:00
Dan Abramov
590ee490f9 Merge pull request #6696 from dotu/patch-3
Create 03-interactivity-and-dynamic-uis.ru-RU.md
2016-05-04 20:22:50 +01:00
Andrey Safronov
bbaf02950e Update 03-interactivity-and-dynamic-uis.ru-RU.md 2016-05-04 22:53:39 +04:00
Andrey Safronov
afc032b0a0 Update 03-interactivity-and-dynamic-uis.ru-RU.md
надо ли менять в заголовках слова "помещать в состояние" на "хранить в состоянии" ?
2016-05-04 19:04:26 +04:00
Keyan Zhang
9ce54210ea fixed transform-react-jsx-source devDep (#6697) 2016-05-03 23:50:27 -07:00
Andrey Safronov
dc60780d49 Create 03-interactivity-and-dynamic-uis.ru-RU.md 2016-05-04 10:01:40 +04:00
Paul O’Shannessy
c9504d99a5 Setup grunt flow task and run on travis (#6684) 2016-05-03 18:16:38 -07:00
Troy DeMonbreun
7cf61db257 Fix for #6062 : Show source line number on unknown property warning (#6398)
* New approach for 6062 fix : Show source line number on unknown property warning

* WIP: ReactDebugToolEventForwarderDevTool

* Update event signature to debugID

* Trigger events in ReactDOMComponent

* Renamed to onMountDOMComponent; passing in element directly

* Added debugID; updated simple test

* Added test for multi-div JSX to ref exact line

* Added test for composite component
2016-05-03 15:51:07 -07:00
Paul O’Shannessy
f25a88e965 grunt jest tasks shouldn't use watchman (#6675) 2016-05-03 14:39:11 -07:00
Sebastian Markbåge
771d938fc0 Set up Flow - Yay! (#6682)
This just configures flow to be checked and fixes our existing
Flow typed files.

Possible enhancements:

Export .js.flow declarations from the build. Unclear whether this
will be a supported workflow in the future or not, so let's wait
on that.

We should fail builds and CI on Flow errors.

Ideally we should lint for Flow style guides (like no space before
colon).
2016-05-03 14:37:13 -07:00
Paul O’Shannessy
48f4684b5f Ensure babelrc gets added to zipfile too (#6688) 2016-05-03 13:58:06 -07:00
Kevin Suttle
3370db14bb Fix broken link to TypeScript docs (#6687) 2016-05-03 10:56:01 -07:00
Pieter De Baets
760b1ef4c3 Remove some mocks that are already packaged by InitializeJavaScriptAppEngine (#6642) 2016-05-03 16:46:51 +01:00
Dan Abramov
82e363c464 Fix displayName in ReactPerf.getInclusive() output 2016-05-03 14:21:30 +01:00
Dan Abramov
7b241d1d7f Add tests and fix wasted render calculation 2016-05-03 14:21:30 +01:00
Dan Abramov
bc241bfcfe Add getUpdateCount() to ReactComponentTreeDevtool
It is necessary to exclude just mounted components from wasted calculation.
2016-05-03 14:21:30 +01:00
Dan Abramov
e187affcaf Make stats less noisy for top-level components 2016-05-03 14:21:29 +01:00
Dan Abramov
abe9a0ce94 Ignore lifecycle events outside batches
Technically this shouldn't happen but it seems possible with ReactNativeMount.unmountComponentAtNode().
For now, let's just ignore these lifecycle events because ReactPerf makes a hard assumption that all lifecycle hooks happen inside batches.
We can revisit later when we have a comprehensive test suite for ReactPerf itself.
2016-05-03 14:21:29 +01:00
Dan Abramov
8b9b79eb6b Fix incorrect onBegin/onEnd timer pair 2016-05-03 14:21:29 +01:00
Dan Abramov
103ca4b406 Use performanceNow() instead of performance.now() 2016-05-03 14:21:29 +01:00
Dan Abramov
49a1542c9f Emit flush events on React Native for ReactPerf 2016-05-03 14:21:29 +01:00
Dan Abramov
f22e54a947 Add getLastMeasurements() as it is documented as public API 2016-05-03 14:21:29 +01:00
Dan Abramov
411fc9ca7d Rename the new ReactPerfAnalysis to ReactPerf 2016-05-03 14:21:29 +01:00
Dan Abramov
5f8f1f6c16 Delete the old ReactPerf 2016-05-03 14:21:28 +01:00
Pieter De Baets
222f5087fe Move ReactIOS components to native subfolder (#6643)
* Move ReactIOS components to ReactNative
* Drop ReactNative subfolder
2016-05-03 14:05:33 +01:00
Tanase Hagi
83521bddb0 Update examples/basic-commonjs/package.json (#6685) 2016-05-02 20:50:25 -07:00
Jim
1d49baff63 fixed minor typo (#6568) 2016-05-02 17:59:03 -07:00
Dan Abramov
4ed46ec52f Merge pull request #6669 from dotu/patch-2
Create 02-displaying-data.ru-RU.md
2016-05-03 01:56:27 +01:00
Jake Boone
393a1798fa Grammar correction in ReactDOMInput.js warning (#6657)
Changed "a uncontrolled input" to "an uncontrolled input".
2016-05-02 15:23:22 -07:00
Brandon Dail
eb116482a3 Return early from enqueuePutListener for SSR (#6678) 2016-05-02 14:26:35 -07:00
Paul O’Shannessy
fa89cf53f2 Don't warn when style value is '0' 2016-05-02 13:23:35 -07:00
Paul O’Shannessy
468901c336 Ensure we're using latest object-assign (#6681)
This picks up the change to feature test against order bugs.
2016-05-02 13:16:25 -07:00
Andrey Safronov
d9bc567f77 Update 02-displaying-data.ru-RU
dot
2016-05-03 00:15:14 +04:00
Andrey Safronov
be9f9071d4 Update 02-displaying-data.ru-RU
исправил ошибки
2016-05-02 23:03:34 +04:00
Paul O’Shannessy
be78a41892 Revert "Merge pull request #6458 from mondaychen/master"
This reverts commit 25481083b0, reversing
changes made to 09022b165f.
2016-05-02 11:22:55 -07:00
Paul O’Shannessy
261bf28a99 Update website for 15.0.2
(cherry picked from commit 846b5ea252)
2016-05-02 10:16:03 -07:00
Paul O’Shannessy
9d14cce62f Update readme for 15.0.2
(cherry picked from commit 4dec99c61e)
2016-05-02 10:15:57 -07:00
Paul O’Shannessy
06f538a61e Changelog for 15.0.2
(cherry picked from commit a157791264)
2016-05-02 10:15:45 -07:00
Andrey Safronov
b6c2973b55 Update 02-displaying-data.ru-RU
Многие предложения перестроены, добавлены запятые
2016-05-02 18:43:26 +04:00
Desmond Brand
db175052c0 Add links to docs for addons and top level API (#6555)
This makes it easier to figure out where the docs live.

Googling for e.g. `react-addons-update` also works, but this should
make things easier for people that hyperclick directly to the source.
2016-05-02 06:14:28 -07:00
Andrey Safronov
eeb59246b2 Create 02-displaying-data.ru-RU.md
Translation for language code ru-RU
2016-05-01 15:52:42 +04:00
Sasha Aickin
256753b830 Add test logic to make sure that events get tested when rendering on top of server-generated markup. (#6668) 2016-04-30 11:21:34 -07:00
Greg Hurrell
4f01b4b186 Remove errant console.log (#6664)
That crept in in c1e3f7ec14.
2016-04-30 07:45:23 -07:00
Andrey Safronov
08e568cfc8 Create 01-why-react.ru-RU.md (#6659)
* Create 01-why-react.ru-RU.md

* Create 01-why-react.ru-RU.md

Translation for language code [ru-RU](https://en.wikipedia.org/wiki/Russian_language)

* Create 01-why-react.ru-RU.md

Errors fixes

* Update 01-why-react.ru-RU.md

исправил "чтобы решить".
спасибо за отзывчивость. надеюсь дальнейшие переводы хоть немного помогут распространению React в России :)
2016-04-30 07:43:25 -07:00
Sebastian Markbåge
0e4b046634 Get rid of transformMatrix/decomposeMatrix special case (#6660)
This is no longer needed on the native side.

This is also the last use of the Platform flag. React Core is now
platform agnostic with regard to React Native. So I'll remove
the mocks and dependency.
2016-04-29 15:57:12 -07:00
Jason Quense
a02eeb59f5 Bail out of dedupe logic in cases where there is an incomplete value descriptor (#6648) 2016-04-29 15:21:01 -07:00
Jan Schär
3d31361cfb Allow custom elements extending native ones (#6570)
...by passing the `is` attribute as the second param to `createElement`.
See http://webcomponents.org/polyfills/custom-elements/
2016-04-29 15:05:33 -07:00
Ben Alpert
c1e3f7ec14 Fix bug with double updates in a single batch (#6650)
Fixes #2410. Fixes #6371. Fixes #6538.

I also manually tested the codepen in #3762 and verified it now works.
2016-04-29 14:02:51 -07:00
Jackson Huang
44f84634d7 Create 01-why-react.zh-TW.md (#6470)
* Create 01-why-react.zh-TW.md

Translation for language code [zh-TW](https://en.wikipedia.org/wiki/Zh-TW)

* Update 01-why-react.zh-TW.md

change "封裝性非常好" to "封裝性高"
2016-04-29 08:55:50 -07:00
Dan Abramov
45ec1265eb Merge pull request #6633 from gaearon/native-tree-devtool
Make ReactComponentTreeDevtool work with React Native
2016-04-29 16:20:58 +01:00
Dan Abramov
b7f6a642f6 Make ReactComponentTreeDevtool work with React Native 2016-04-29 16:13:21 +01:00
Dan Abramov
98a8f49068 Merge pull request #6046 from gaearon/new-perf
Add new ReactPerf
2016-04-29 15:35:53 +01:00
Dan Abramov
67b1dbf75f Add new ReactPerf 2016-04-28 20:45:57 +01:00
Ryan Lahfa
9d201abb2b package(node-engine-version): accept 6.x versions (#6645) 2016-04-28 11:33:26 -07:00
Simen Bekkhus
772468183f Add note on how to submit a form (#6594) 2016-04-28 08:42:29 -07:00
Dan Abramov
af1a21289b Merge pull request #6628 from sheerun/patch-1
Document stateless components in formal types
2016-04-28 13:28:06 +01:00
Adam Stankiewicz
16f64c4499 Document stateless components in formal types 2016-04-28 13:47:59 +02:00
Paul O’Shannessy
096e5c7cf7 Ensure babelrc file gets packaged for starter kit (#6617) 2016-04-28 00:24:58 -07:00
Christoph Pojer
64401150a0 Merge pull request #6638 from cpojer/master
Update Jest’s grunt task.
2016-04-28 16:21:54 +09:00
cpojer
681a463240 Update Jest’s grunt task. 2016-04-28 16:08:20 +09:00
Christoph Pojer
d07b554291 Merge pull request #6620 from cpojer/master
Update to Jest 12. Codemod to new Jest APIs.
2016-04-28 15:03:20 +09:00
cpojer
8e34514096 Update to Jest 12. Codemod to new Jest APIs. 2016-04-28 14:54:57 +09:00
Sebastian Markbåge
72ba5971ae Use spread instead of deprecated merge utility (#6634) 2016-04-27 19:54:40 -07:00
Dan Abramov
b8f8360b5c Merge pull request #6388 from gaearon/bye-bye-deprecated-utils
Remove OrderedMap and ReactPropTransferer
2016-04-27 20:36:39 +01:00
Dan Abramov
3bdf09e86f Merge pull request #6612 from gaearon/instrumentation-new-operations
Add ReactNativeOperationHistoryDevtool to track native operations
2016-04-27 19:03:55 +01:00
Dan Abramov
2723323006 Remove OrderedMap and ReactPropTransferer
These are not exposed publicly and have been deprecated.
2016-04-27 17:44:02 +01:00
Dan Abramov
aaadb31827 Add ReactNativeOperationHistoryDevtool to track native operations 2016-04-26 23:50:58 +01:00
Yan Li
71179459de adds ReactRally & Reactive 2016 + conf locations (#6623) 2016-04-26 15:12:13 -07:00
Dan Abramov
f5b20bf79c Try enabling coverage again
It was disabled in d138b286db.
We should have more Travis instances now so it shouldn't run out of memory.
2016-04-26 13:21:41 +01:00
Jim
8dfdac6780 ComponentWillUnmount should only ever be invoked once (#6613) 2016-04-25 18:06:30 -07:00
Dan Abramov
76a4c46dba Merge pull request #6549 from gaearon/instrumentation-new
Provide info about component tree to devtools
2016-04-26 01:12:23 +01:00
Dan Abramov
a9e0896af8 Mute devtool events for TopLevelWrapper and empty components 2016-04-26 01:02:45 +01:00
Stolenkid
aeda84602f fixed a minor typo (#6600) 2016-04-25 14:37:52 -07:00
Dan Abramov
7dbc95f379 Merge pull request #6605 from gaearon/fix-warning-condition
Fix the warning condition in ReactDebugTool and ReactDOMDebugTool
2016-04-25 20:16:52 +01:00
z.ky
f4e608fc2e Update tutorial - add link for starting server (#6602)
To be extra helpful to beginners, and avoid questions like this: http://stackoverflow.com/questions/35758956/react-tutorial-how-do-i-start-the-server
2016-04-25 11:20:47 -07:00
Dan Abramov
1f97103d7b Flip the warning condition in ReactDebugTool and ReactDOMDebugTool
The current warning condition caused the first error to be swallowed, and all the next errors to be logged. I believe the intention was the opposite: to log the first error, and to ignore any next errors for the same method.
2016-04-25 00:41:53 +01:00
Dan Abramov
f89f94d145 Add tests for ReactDebugTool and ReactDOMDebugTool 2016-04-25 00:41:32 +01:00
Dan Abramov
acd67c368d Remove isComposite and hide TopLevelWrapper 2016-04-25 00:05:04 +01:00
Dan Abramov
9f16003e69 Assert that unmounted instances are in the tree until purged 2016-04-24 01:53:53 +01:00
Dan Abramov
829558b8b0 Refactor how native container ID is stored 2016-04-23 22:27:40 +01:00
Sebastian Markbåge
69b6869a3e Ignore events fired on missing React Native instances
This can happen if something gets unmounted before the event gets
dispatched. I'm not sure how this works out exactly but this
preserves previous behavior in this scenario.
2016-04-23 13:10:00 -07:00
Dan Abramov
900a588f63 Add safeguards to ReactComponentTreeDevtool 2016-04-23 02:23:16 +01:00
Sebastian Markbåge
2f2ed71bd0 Merge pull request #6588 from sahrens/patch-3
Delete ReactNativeGlobalInteractionHandler.js
2016-04-22 16:55:08 -07:00
Sebastian Markbåge
aacb5467a0 Merge pull request #6584 from sahrens/patch-1
[RN] Don't hold interaction handles for all touches
2016-04-22 16:54:59 -07:00
Spencer Ahrens
63fbc3f72e Delete ReactNativeGlobalInteractionHandler.js
Depends on https://github.com/facebook/react/pull/6584 to no longer reference is. See FB task #10926500
2016-04-22 16:53:34 -07:00
Sebastian Markbåge
ea504521d5 Merge pull request #6587 from sahrens/patch-2
Move PanResponder back to react-native repo temporarily.
2016-04-22 16:44:26 -07:00
Spencer Ahrens
1fc7487eaa Move PanResponder back to react-native repo temporarily.
We have some more work to do with this before we can pull it out of react-native.  FB Task #10926500
2016-04-22 16:37:00 -07:00
Spencer Ahrens
983a365f74 [RN] Don't hold interaction handles for all touches
We don't want to hold handles while doing native scrolling, etc.

FB Task: #10926500
2016-04-22 16:22:44 -07:00
Paul O’Shannessy
5ddfee8cfe Merge pull request #6576 from yuji0602/tutorial_md_sample_json_change
Changed example json value.
(cherry picked from commit ec036ed185)
2016-04-22 13:08:48 -07:00
Dan Abramov
df3c85886e Stop exposing ReactComponentTreeDevtool internal tree directly 2016-04-22 15:45:35 +01:00
Dan Abramov
1ebffa59fe ReactComponentTreeDevtool should ignore TopLevelWrapper 2016-04-22 02:42:29 +01:00
Ike Peters
9df54e0fce properly handling invalid scryRenderedDOMComponentsWithClass args (#6529)
properly handling invalid scryRenderedDOMComponentsWithClass args

properly handle invalid scryRenderedDOMComponentsWithClass args
2016-04-21 17:09:04 -07:00
Esteban
416f315c96 Fix return type in onlyChild's JSDoc (#6573)
The return type is a 'ReactElement' instead of a 'ReactComponent'.
2016-04-21 16:02:20 -07:00
Ben Alpert
0dc9b91017 Merge pull request #6572 from spicyj/rn-batch
Batch event handling in React Native
2016-04-21 15:14:56 -07:00
Ben Alpert
9f11f8c263 Batch event handling in React Native
This fixes an issue where handling events on a node that was just removed threw a "All native instances should have a tag." error and matches what we do in the DOM renderer in ReactEventListener.
2016-04-21 15:06:48 -07:00
Esteban
9462d0d040 Fix mapFunction parameters in mapChildren's JSDoc (#6569)
Remove 'key' parameter from 'mapFunction(child, key, index)'. It is no longer called with 'key'.
2016-04-21 14:28:08 -07:00
Dan Abramov
e20d366ea8 Fix expect() slipping into the non-test code 2016-04-21 22:23:35 +01:00
Dan Abramov
1f2e78359f No need for a special case here 2016-04-21 18:56:42 +01:00
Dan Abramov
ab0ef89ec7 Track parentID for ReactPerf 2016-04-21 17:59:31 +01:00
Dan Abramov
f530b977ec Test ReactComponentTreeDevtool specifically 2016-04-21 17:32:56 +01:00
Dan Abramov
b5997c8e7b Extract ReactComponentTreeDevtool 2016-04-21 17:31:04 +01:00
Minwei Xu
b7a2409919 ref-09-webcomponents.zh-CN.md (#6561) 2016-04-20 20:07:02 -07:00
Dan Abramov
835ca9bca3 Clean up the devtool tree on server rendering 2016-04-21 02:37:58 +01:00
Dan Abramov
af3603ea2f Devtools should be able to clean up the tree on client rendering 2016-04-20 19:11:38 +01:00
Paul O’Shannessy
bddecc9696 Merge pull request #6553 from zpao/cleanuppkg
Clean up package.json after #6338
2016-04-20 10:34:44 -07:00
Paul O’Shannessy
9354751dc9 Clean up package.json after #6338 2016-04-20 10:29:39 -07:00
Dan Abramov
367594a213 Enforce that info about children is available by the time onSetChildren() fires 2016-04-20 18:20:14 +01:00
Dan Abramov
1587abf6f0 Don't report children for empty and text nodes 2016-04-20 18:12:40 +01:00
Dan Abramov
804c680f06 Report dangerouslySetInnerHTML as no children 2016-04-20 18:01:52 +01:00
Dan Abramov
7884606fdb Handle updates to natives and composites 2016-04-20 17:39:33 +01:00
Dan Abramov
e9f8d57c70 Add an initial implementation of ReactDebugTool events 2016-04-20 16:59:13 +01:00
Dan Abramov
b692893640 Revert "Add ReactDebugInstanceMap"
This reverts commit 575fb79162.
2016-04-20 16:59:13 +01:00
Sebastian Markbåge
c84ad52ddb Merge pull request #6338 from sebmarkbage/reactnative2
Move React Core Integration and Injection to the Core Repo
2016-04-20 03:41:20 +01:00
Sebastian Markbage
ada60c4fd8 Remove ReactDOM.native shim
This is causing build errors.

This should be in the downstream repo if anything.

Relay has its own shim that should be preferred.
2016-04-20 03:35:31 +01:00
Sebastian Markbage
744548ad14 Fix lint for moved ReactNative 2016-04-20 03:35:31 +01:00
Sebastian Markbage
5470972f6a Update devtools injection
This isn't actually used right now so I can't test it. Because the
Chrome devtools are broken for React Native. The Nuclide integration
is in the react-native repo.
2016-04-20 03:35:31 +01:00
Sebastian Markbage
c7d90e2b35 Ensure react-native-renderer package gets copied 2016-04-20 03:35:31 +01:00
Sebastian Markbage
22a8f9964e Don't try to get the target node for responder if there is no listener
This can happen in edge cases where he listeners are already
unmounted or not mounted yet or something.
2016-04-20 03:35:31 +01:00
Sebastian Markbage
064092102d Bump package versions 2016-04-20 03:35:31 +01:00
Sebastian Markbage
dc188dd521 Update ReactNativeDOMIDOperations to deal with a single parent node
This is the new protocol.
2016-04-20 03:35:31 +01:00
Sebastian Markbage
4fcdf02068 Listeners are not attached by ID in the API
...even though they technically still are attached by.
2016-04-20 03:35:31 +01:00
Sebastian Markbage
3287d93235 Build up a native component cache for event dispatching
Changes to event overloading structure
2016-04-20 03:35:31 +01:00
Sebastian Markbage
75cec60e48 Get rid of rootNodeIDs they're just tags now 2016-04-20 03:35:30 +01:00
Sebastian Markbage
97b079b364 Fix ReactNativeComponentEnvironment providesModule
This has a different file name from its providesModule. Screws up
our build scripts.
2016-04-20 03:35:30 +01:00
Sebastian Markbage
f8335168b6 Fix 0.15 compatibility 2016-04-20 03:35:30 +01:00
Sebastian Markbage
d8e8ea5cbb Add test and mocks
Mock UIManager

Comment out dontMock that actually needs mocking
2016-04-20 03:35:30 +01:00
Sebastian Markbage
91e62c718b Strip isomorphic stuff from the ReactNative module
Also, add a shim for the isomorphic module for ios and android so that
react-native doesn't pull in react-dom when React is required.
2016-04-20 03:35:30 +01:00
Sebastian Markbage
240dfae28c Add React Native Modules to module map + fix fbjs
Our module rewrite whitelist needs to ignore providesModule files
that are going to be required from the global React Native
environment.

We also need to add ReactDOM to providesModule since we removed it
from React Native.
2016-04-20 03:35:30 +01:00
Sebastian Markbage
caa6abaecf Build an dedicated npm package for react-native-renderer 2016-04-20 03:35:30 +01:00
Sebastian Markbage
8806463a66 Add Object Spread Support to Our Babel Config
Won't really use this in prod code yet but I have a benchmark that
uses it.
2016-04-20 03:35:30 +01:00
Sebastian Markbage
fe395def65 Move React Native platform files back
These files are really only related to the platform itself and not
the React integration so I'll move them back.
2016-04-20 03:35:30 +01:00
Sebastian Markbage
6c885d28c5 Remove duplicates and move files out of native/vendor
Moving the event plugins into their dedicated folder

Removing the ExecutionEnvironment override. I will just have to fix where needed. Probably related to the Chrome debugger?
2016-04-20 03:35:30 +01:00
Sebastian Markbage
f463b731ee Copy files from the react-native repo 2016-04-20 03:35:30 +01:00
Adrian Sieber
8156ee0cab Minor fixes (#6527)
* Fix typos in CHANGELOG.md

* Fix typos in 2014-11-24-react-js-conf-updates.md
2016-04-19 14:41:42 -07:00
Denis Laxalde
de7d1da997 Remove mention of deprecated ReactLink add-on (#6535) 2016-04-18 06:26:10 -07:00
hkal
dc6fc8cc07 Helper for escaping and unescpaing component keys (#6500)
- Abstract escaping
- Provide human readible same key warnings
2016-04-15 20:55:37 -07:00
Jim
a12aab10cb Mention Enzyme on the test utils page. (#6523) 2016-04-15 16:20:43 -07:00
Jason Quense
045f1a791c Only fire input value change events when the value changes (#5746)
* Only fire input value change events when the value changes

fixes #554, fixes #1471, fixes #2185 (still trying to figure out why)

* catch programmatic value changes

* move value tracking to seperate module
2016-04-15 14:37:26 -07:00
Ben Alpert
4016e71609 Merge pull request #6469 from keyanzhang/validate-foreignObject-children
Ensure validateDOMNesting catches nested body elements
2016-04-14 18:27:13 -07:00
Keyan Zhang
6cf77ef55e Ensure validateDOMNesting catches nested body elements 2016-04-14 20:14:45 -04:00
Dan Abramov
6a93137f0e Merge pull request #6516 from gaearon/ignore-dom-writes-outside-batch
Ignore DOM writes outside the batch in ReactPerf
2016-04-15 00:03:17 +01:00
Paul O’Shannessy
befb70e42f Merge pull request #6519 from zpao/envdocsfixup
Cleanup environments doc
2016-04-14 14:44:25 -07:00
Paul O’Shannessy
bcad0a2973 Cleanup environments doc
- Use correct "Note" formatting so they render correctly
- reordered sections so Node is first
- Use "Node.js" consistently (it is a product name just like Nashorn)
- added/tweaked some of the text
- simplified the Java code so it doesn't hit the internet.
2016-04-14 14:17:44 -07:00
Dan Abramov
3b28602220 Ignore DOM writes outside the batch in ReactPerf
ReactDOMInput and a few other classes handle change event by scheduling updateWrapper() in an asap().
It gets executed after the batch, which confuses ReactPerf that expects all DOM writes to happen during a batch.
Since this implementation of ReactPerf relying on the stack is going away, let's plug the hole temporarily by ignoring DOM writes that occur during postponed updateWrapper(). In any case, they have no relation to actual calculations of wasted renders, as they don't occur due to updateComponent(), but rather due to onChange() special DOM behavior.

This fixes #5548
2016-04-14 20:57:44 +01:00
Jim
6a8c7518d3 Merge pull request #6510 from jimfb/ssr-environment-docs
Added docs for environment integration.
2016-04-14 12:27:59 -07:00
Jim
66bfee6543 Added docs for environment integration. 2016-04-14 12:25:17 -07:00
Dan Abramov
36e4fe54a8 Merge pull request #6215 from nhunzaker/nh-fix-disabled-inputs
Disabled inputs should not respond to clicks in IE
2016-04-14 19:40:21 +01:00
Dan Abramov
ae56910573 Merge pull request #6362 from gaearon/no-owner-in-test-utils
Elements from functional components in TestUtils should have no owner
2016-04-14 18:54:10 +01:00
Jim
0b1fd18685 Merge pull request #6462 from Wildhoney/master
Re-added support for attaching events to document fragments
2016-04-14 10:17:57 -07:00
Paul O’Shannessy
932334d3d4 Merge pull request #6504 from alexlur/patch-1
Replaces Array#map with Array#forEach
2016-04-13 10:43:13 -07:00
Alex
9d94d003a9 Replaces Array#map with Array#forEach 2016-04-13 17:11:08 +08:00
Jim
5785a418a2 Merge pull request #6148 from jimfb/node-package-manager
Create section on using React with package managers.
2016-04-12 22:33:47 -07:00
Jim
c01c46b88a Create section on using React with package managers. 2016-04-12 12:39:49 -07:00
Sam Balana
6e4f3eab84 Merge pull request #3 from RaitoBezarius/fork/proptypes-symbol
Remove unused ES6 Symbol dependency
2016-04-11 14:36:19 -07:00
Raito Bezarius
95fed01634 package(dependency): remove unused es6-symbol dependency 2016-04-11 20:19:09 +02:00
Nate Hunzaker
ec2c542f28 Flip conditional in DisabledInputUtils to cut hasOwnProperty calls 2016-04-08 19:47:40 -04:00
Nate Hunzaker
fc23239b67 Follow style conventions 2016-04-08 19:47:40 -04:00
Nate Hunzaker
0200946112 Move getNativeProps usage inline 2016-04-08 19:47:40 -04:00
Nate Hunzaker
fe739c2883 Disabled inputs should not respond to clicks in IE
This commit migrates over the disabled property behavior from
ReactDOMButton into a general purpose disabled event filter. It also
applies that behavior to inputs, selects, and textareas.
2016-04-08 19:47:40 -04:00
Dan Abramov
6c11bb65e1 Use the same changelog format as 15.0 post 2016-04-08 23:00:20 +01:00
Paul O’Shannessy
0a8f7329b4 Update react-linked-input
- Restores React dep to 15
- Bumps version to 1.0.1 for publishing
2016-04-08 14:53:37 -07:00
Paul O’Shannessy
dc0bea7a52 Fix extraneous markup in changelog 2016-04-08 14:41:20 -07:00
Paul O’Shannessy
44a0bd7478 Actually bump version on website
(cherry picked from commit d72885b383)
2016-04-08 14:39:03 -07:00
Paul O’Shannessy
42c0d4199b Update website for 15.0.1
(cherry picked from commit fd1476e3aa)
2016-04-08 14:39:03 -07:00
Paul O’Shannessy
a7e0da588a 15.0.1 blog post
(cherry picked from commit 142e4ebb57)
2016-04-08 14:39:03 -07:00
Paul O’Shannessy
9bbe80a6cc Update changelog & readme for 15.0.1
(cherry picked from commit a6179d03f3)
2016-04-08 14:39:03 -07:00
Wildhoney
167c27e188 Re-added support for attaching events to document fragments 2016-04-08 19:31:14 +01:00
Jim
5ac51c39a0 Merge pull request #6442 from trevorsmith/master
Correctly select options when nested inside an optgroup
2016-04-08 09:55:43 -07:00
Jim
25481083b0 Merge pull request #6458 from mondaychen/master
No unit-less CSS value warning for `value: "0"`
2016-04-08 09:20:39 -07:00
Jim
09022b165f Merge pull request #6443 from Aweary/patch-1
Grammar fix for 15.0 blog post
2016-04-08 09:09:43 -07:00
Brandon Dail
0149e8a4a9 Grammar fix for 15.0 blog post
Since "This" is the subject and singular, "have" should be "has"

New wording explaining implementation details

Grammar fix for 15.0 blog post

Since "This" is the subject and singular, "have" should be "has"

Fix wording for 15.0 blog post

nitpicks
2016-04-08 11:04:06 -05:00
Dan Abramov
08fd7d4a48 Fix extra parens in CHANGELOG 2016-04-08 17:03:44 +01:00
mondaychen
4e81eb4403 "0" can be the only valid unitless number string 2016-04-08 11:55:31 -04:00
Ben Alpert
2b1bd1d7fe Merge pull request #6449 from spicyj/option-value
Set value using attribute only on initial option render
2016-04-07 21:19:37 -07:00
Ben Alpert
5cb4a620e7 Set value using attribute only on initial option render
Tested that you can now type in the middle of a controlled input in Chrome which previously jumped your cursor to the end.

Fixes #6445.
2016-04-07 19:04:30 -07:00
Sam Balana
ad94295f13 Removed test support for medikoo/es6-symbol
There seems to be a bug with medikoo/es6-symbol where the global state
affects the implementation of the polyfill. I found this by running the
individual test file alone then running all the tests using `grunt
test`. I found that it passes when ran alone and failed when ran
collectively.

I did not find this buggy behavior with zloirock/core-js's
implementation of a polyfill for Symbol. Thus, removing I will keep the
more popular polyfill (core-js) and remove the buggy polyfill
(es6-symbol).

If you are reading this and can think of a confounding factor that is
causing this bug, please let me know and we can try to work together to
add support for medikoo/es6-symbol.
2016-04-07 17:41:42 -07:00
Paul O’Shannessy
516c1d809e Merge pull request #6444 from zpao/re__spreadwarn
Add back React.__spread and make it warn
2016-04-07 17:30:44 -07:00
Paul O’Shannessy
fc1cfb6225 Make React.__spread warn 2016-04-07 17:30:23 -07:00
Sam Balana
05820f89c1 More specific typeof check for polyfilled Symbol
Let's get more specific with our tests. Symbol has to be a function if
it's a polyfill. There are no object polyfills out there. (If there is,
ping me and I'll add support)

Instead of checking if Symbol is undefined, let's check if it's a
function instead since instanceof is depending that Symbol is already a
function.
2016-04-07 16:57:11 -07:00
Paul O’Shannessy
f02d87bdb5 Revert "Merge pull request #6431 from sebmarkbage/killspread"
This reverts commit a37e4e94fc, reversing
changes made to 411951d5b8.
2016-04-07 16:16:37 -07:00
Trevor Smith
f7181e089c Remove an unnecessary call to findDOMNode in the select optgroup test. 2016-04-07 16:43:35 -06:00
Trevor Smith
8577600a61 Add a null check when checking for the native parent of an option element. 2016-04-07 16:42:50 -06:00
Trevor Smith
b102e25663 Correctly select options when nested inside an optgroup 2016-04-07 16:30:51 -06:00
Paul O’Shannessy
6fd2b29ec8 [docs] Clarify data-reactid in v15 post 2016-04-07 15:27:05 -07:00
Paul O’Shannessy
3ed07aca5f Update readme for v15
(cherry picked from commit c49166401a)
2016-04-07 15:15:45 -07:00
Paul O’Shannessy
85372964e5 Update Changelog for v15
(cherry picked from commit 500c0003b2)
2016-04-07 15:15:44 -07:00
Paul O’Shannessy
b2bce139a4 [docs] Update site for v15
(cherry picked from commit 0275d77fc0)
2016-04-07 15:15:44 -07:00
Dan Abramov
75f4925074 Add React 15 post
(cherry picked from commit 67a4b12e27)
2016-04-07 15:15:44 -07:00
Paul O’Shannessy
3abc1f4a88 [docs] Update acknowledgements for v15
(cherry picked from commit 40c0867f63)
2016-04-07 15:15:44 -07:00
Dan Abramov
4537860f7e Add the missing download
(cherry picked from commit 1aee28ef1b)
2016-04-07 14:35:00 -07:00
Jim
2e8f28c29f Merge pull request #6364 from p-jackson/issue-5700
Don't wrap drag events in IE/Edge in dev builds
2016-04-07 14:11:12 -07:00
Jim
7b47e3e537 Merge pull request #6134 from richardscarrott/master
Warn if props obj passed into createElement / cloneElement inherits from anything other than Object
2016-04-07 14:09:18 -07:00
Jim
006058daa5 Merge pull request #6341 from borisyankov/master
Add more information to warning 'Input elements must be either controlled or uncontrolled'
2016-04-07 14:08:03 -07:00
Jim
1dc7c581db Merge pull request #6400 from jimfb/return-value-legacy
Document legacyness of the return value of ReactDOM.render()
2016-04-07 14:03:56 -07:00
Jim
62f64a84a4 Merge pull request #6419 from IvanVergiliev/master
Add documentation about empty functional components
2016-04-07 14:03:21 -07:00
Paul O’Shannessy
caa78f7985 Bump version for v16 development 2016-04-07 11:27:28 -07:00
Jim
ceb377254a Document legacyness of the return value of ReactDOM.render() 2016-04-06 16:30:25 -07:00
Ivan Vergiliev
ead6c9323b Document that stateless functional components can return null in v15 2016-04-06 20:19:14 +03:00
Ivan Vergiliev
85e01a1455 Add documentation about empty functional components 2016-04-06 01:29:59 +03:00
Sam Balana
ced7a3da90 Merge pull request #2 from RaitoBezarius/fork/proptypes-symbol
Fix code-style issue with React guidelines
2016-04-05 13:19:23 -07:00
Raito Bezarius
a98e2cb8b1 prop-types(tests,code-style): fix missing semicolon, unexpected spaces and trailing comma 2016-04-05 22:01:37 +02:00
Sam Balana
f846b54aa2 Merge pull request #1 from RaitoBezarius/fork/proptypes-symbol
Improve symbol check for (local) polyfills
2016-04-05 12:33:55 -07:00
Raito Bezarius
c291f8a81e prop-types(symbols,tests): test for polyfilled Symbol and non-Symbol elements 2016-04-02 14:28:08 +02:00
Raito Bezarius
4239f8ac3b prop-types(symbols): rewrite isSymbol to be simpler
1) If it is a native Symbol
2) If it is spec-compliant
3) Try to match non-spec compliant polyfill by a instanceof check on Symbol if it exists in the global namespace
2016-04-02 14:27:02 +02:00
Raito Bezarius
0d8ab0efa3 devDependencies: add core-js and es6-symbol polyfill for tests 2016-04-02 14:26:35 +02:00
Raito Bezarius
13d9720804 prop-types(symbols): add a helper is-symbol function 2016-04-02 10:10:05 +02:00
Sam Balana
5485ac8f6c Support for ES6 polyfills
Most ES6 polyfills will add support by implementing `Symbol` as a
function. This causes `typeof` to return `function` rather than `symbol`
for polyfilled clients.
2016-03-31 13:47:03 -07:00
Sam Balana
75c4e03718 Added tests for the new primative, Symbol.
I believe that I covered all the typical use cases for Symbols.
If you think that I missed one, feel free to contribute.
2016-03-29 17:21:24 -07:00
Sam Balana
97bcce5214 Added Symbol primative PropType.
With the edition of ECMA-262, we now have a new primative type called
Symbol. This primative type should be added to the PropTypes, as users
will eventually be using Symbols in their props for describing unique
and immutable data, such as identifiers.
2016-03-29 17:18:34 -07:00
Richard
17683e0410 Warn if props obj passed into createElement / cloneElement inherits from anything other than Object 2016-03-29 20:21:39 +01:00
Dan Abramov
291379c272 Elements from functional components in TestUtils should have no owner
Fixes #5292 and #6194
2016-03-28 21:46:33 +01:00
Philip Jackson
4687a03f54 Don't wrap drag events in IE/Edge in dev builds
Dev builds wrap synthetic events inside other events for a better debug
experience. However IE/Edge won't allow access to the
DataTransfer.dropEffect property if it's wrapped in this way.
The first time a drag event is fired, test if we're in an environment
that behaves this way and disable React's improved development
experience if we are.
2016-03-28 00:29:46 +13:00
Boris Yankov
1018e50a1a Add more information to 'Input elements must be either controlled or uncontrolled' warning 2016-03-25 16:36:48 +02:00
1607 changed files with 164707 additions and 138303 deletions

View File

@@ -2,8 +2,9 @@
"presets": ["react"],
"ignore": ["third_party"],
"plugins": [
"fbjs-scripts/babel-6/dev-expression",
"transform-class-properties",
"syntax-trailing-function-commas",
["transform-object-rest-spread", { "useBuiltIns": true }],
"transform-es2015-template-literals",
"transform-es2015-literals",
"transform-es2015-arrow-functions",
@@ -17,10 +18,8 @@
["transform-es2015-spread", { "loose": true }],
"transform-es2015-parameters",
["transform-es2015-destructuring", { "loose": true }],
"transform-es2015-block-scoping",
"transform-es2015-modules-commonjs",
["transform-es2015-block-scoping", { "throwIfClosureRequired": true }],
"transform-es3-member-expression-literals",
"transform-es3-property-literals",
"./scripts/babel/transform-object-assign-require"
"transform-es3-property-literals"
]
}

View File

@@ -1,16 +1,14 @@
# We can probably lint these later but not important at this point
src/shared/vendor
# But not in docs/_js/examples/*
docs/_js/*.js
docs/js/
docs/_site/
# gems
docs/vendor/bundle/
# This should be more like examples/**/thirdparty/** but
# we should fix https://github.com/facebook/esprima/pull/85 first
examples/
# Ignore built files.
# Third party
**/node_modules
# Not written by hand
packages/react-art/npm/lib
# Build products
build/
coverage/
scripts/bench/bench-*.js
vendor/*
fixtures/
scripts/bench/benchmarks/**/*.js
# React repository clone
scripts/bench/remote-repo/

View File

@@ -1,73 +1,64 @@
'use strict';
const OFF = 0;
const WARNING = 1;
const ERROR = 2;
module.exports = {
parser: 'babel-eslint',
extends: './node_modules/fbjs-scripts/eslint/.eslintrc.js',
extends: 'fbjs',
plugins: [
'react',
'react-internal',
],
ecmaFeatures: {
modules: false
},
// We're stricter than the default config, mostly. We'll override a few rules
// and then enable some React specific ones.
rules: {
'accessor-pairs': OFF,
'brace-style': [ERROR, '1tbs'],
'comma-dangle': [ERROR, 'always-multiline'],
'consistent-return': ERROR,
'consistent-return': OFF,
'dot-location': [ERROR, 'property'],
'dot-notation': ERROR,
'eol-last': ERROR,
'eqeqeq': [ERROR, 'allow-null'],
'indent': [ERROR, 2, {SwitchCase: 1}],
'indent': OFF,
'jsx-quotes': [ERROR, 'prefer-double'],
'keyword-spacing': [ERROR, {after: true, before: true}],
'no-bitwise': OFF,
'no-inner-declarations': [ERROR, 'functions'],
'no-multi-spaces': ERROR,
'no-restricted-syntax': [ERROR, 'WithStatement'],
'no-shadow': ERROR,
'no-unused-expressions': ERROR,
'no-unused-vars': [ERROR, {args: 'none'}],
'quotes': [ERROR, 'single', 'avoid-escape'],
'space-after-keywords': ERROR,
'no-useless-concat': OFF,
'quotes': [ERROR, 'single', {avoidEscape: true, allowTemplateLiterals: true }],
'space-before-blocks': ERROR,
'space-before-function-paren': [ERROR, {anonymous: 'never', named: 'never'}],
'space-before-keywords': ERROR,
'strict': [ERROR, 'global'],
'space-before-function-paren': OFF,
// React & JSX
// Our transforms set this automatically
'react/display-name': OFF,
'react/jsx-boolean-value': [ERROR, 'always'],
'react/jsx-no-undef': ERROR,
// We don't care to do this
'react/jsx-sort-prop-types': OFF,
'react/jsx-sort-props': OFF,
'react/jsx-space-before-closing': ERROR,
'react/jsx-uses-react': ERROR,
'react/jsx-uses-vars': ERROR,
// It's easier to test some things this way
'react/no-did-mount-set-state': OFF,
'react/no-did-update-set-state': OFF,
// We define multiple components in test files
'react/no-multi-comp': OFF,
'react/no-unknown-property': OFF,
'react/no-is-mounted': OFF,
// This isn't useful in our test code
'react/prop-types': OFF,
'react/react-in-jsx-scope': ERROR,
'react/self-closing-comp': ERROR,
// We don't care to do this
'react/sort-comp': OFF,
'react/wrap-multilines': [ERROR, {declaration: false, assignment: false}],
'react/jsx-wrap-multilines': [ERROR, {declaration: false, assignment: false}],
// CUSTOM RULES
// the second argument of warning/invariant should be a literal string
'react-internal/warning-and-invariant-args': ERROR,
}
'react-internal/no-primitive-constructors': ERROR,
},
globals: {
expectDev: true,
},
};

37
.flowconfig Normal file
View File

@@ -0,0 +1,37 @@
[ignore]
<PROJECT_ROOT>/fixtures/.*
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/scripts/.*
<PROJECT_ROOT>/.*/node_modules/y18n/.*
<PROJECT_ROOT>/node_modules/chrome-devtools-frontend/.*
<PROJECT_ROOT>/node_modules/devtools-timeline-model/.*
<PROJECT_ROOT>/node_modules/create-react-class/.*
<PROJECT_ROOT>/.*/__mocks__/.*
<PROJECT_ROOT>/.*/__tests__/.*
[include]
[libs]
./node_modules/fbjs/flow/lib/dev.js
./scripts/flow
[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
unsafe.enable_getters_and_setters=true
munge_underscores=false
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_type=$FlowExpectedError
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[version]
^0.53.1

14
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,14 @@
<!--
Note: if the issue is about documentation or the website, please file it at:
https://github.com/reactjs/reactjs.org/issues/new
-->
**Do you want to request a *feature* or report a *bug*?**
**What is the current behavior?**
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template for React 16: https://jsfiddle.net/Luktwrdm/, template for React 15: https://jsfiddle.net/hmbg7e9w/).**
**What is the expected behavior?**
**Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?**

12
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,12 @@
**Before submitting a pull request,** please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/react) and create your branch from `master`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
5. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
6. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
7. Run the [Flow](https://flowtype.org/) typechecks (`yarn flow`).
8. If you haven't already, complete the CLA.
**Learn more about contributing:** https://reactjs.org/docs/how-to-contribute.html

15
.gitignore vendored
View File

@@ -2,22 +2,15 @@
node_modules
*~
*.pyc
static
.grunt
_SpecRunner.html
__benchmarks__
build/
remote-repo/
coverage/
.module-cache
*.gem
docs/.bundle
docs/code
docs/_site
docs/.sass-cache
docs/js/*
docs/downloads
docs/vendor/bundle
examples/shared/*.js
fixtures/dom/public/react-dom.js
fixtures/dom/public/react.js
test/the-files-to-test.generated.js
*.log*
chrome-user-data
@@ -26,3 +19,5 @@ chrome-user-data
.idea
*.iml
.vscode
*.swp
*.swo

View File

@@ -11,8 +11,6 @@ Andrew Kulakov <avk@8xx8.ru>
Andrew Sokolov <asokolov@atlassian.com>
Anto Aravinth <anto.aravinth.cse@gmail.com>
Baraa Hamodi <bhamodi@uwaterloo.ca> <baraa@optimizely.com>
Ben Alpert <ben@benalpert.com> <balpert@fb.com>
Ben Alpert <ben@benalpert.com> <spicyjalapeno@gmail.com>
Ben Halpern <bendhalpern@gmail.com>
Ben Newman <bn@cs.stanford.edu> <benjamn@fb.com>
Benjamin Woodruff <github@benjam.info> <bgw@fb.com>
@@ -137,6 +135,10 @@ Sebastian Markbåge <sebastian@calyptus.eu> <sema@fb.com>
Sergey Rubanov <chi187@gmail.com>
Shogun Sea <shogunsea08@gmail.com> <xxin@groupon.com>
Soichiro Kawamura <mail@w-st.com>
Sophie Alpert <git@sophiebits.com> <balpert@fb.com>
Sophie Alpert <git@sophiebits.com> <ben@benalpert.com>
Sophie Alpert <git@sophiebits.com> <sophiebits@fb.com>
Sophie Alpert <git@sophiebits.com> <spicyjalapeno@gmail.com>
Sota Ohara <ohrst.18@gmail.com>
Steven Luscher <react@steveluscher.com> <github@steveluscher.com>
Steven Luscher <react@steveluscher.com> <steveluscher@fb.com>

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
v8.4.0

View File

@@ -1,101 +0,0 @@
---
language: node_js
node_js:
- 4
sudo: false
cache:
directories:
- docs/vendor/bundle
- node_modules
before_install:
- |
if [ "$TEST_TYPE" != build_website ] && \
! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
then
echo "Only docs were updated, stopping build process."
exit
fi
npm install -g npm@latest-2
npm --version
script:
- |
if [ "$TEST_TYPE" = build_website ]; then
if [ "$TRAVIS_BRANCH" = "$REACT_WEBSITE_BRANCH" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
set -e
GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/../react-gh-pages
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc
git config --global user.name "Travis CI"
git config --global user.email "travis@reactjs.org"
git clone --branch gh-pages --depth=50 \
https://reactjs-bot@github.com/facebook/react.git \
$GH_PAGES_DIR
pushd docs
bundle install --jobs=3 --retry=3 --path=vendor/bundle
bundle exec rake release
cd $GH_PAGES_DIR
git status
if ! git diff-index --quiet HEAD --; then
git add -A .
git commit -m "Rebuild website"
git push origin gh-pages
fi
popd
fi
elif [ "$TEST_TYPE" = build ]; then
if [ "$SERVER" ]; then
set -e
./node_modules/.bin/grunt build
curl \
-F "react=@build/react.js" \
-F "react.min=@build/react.min.js" \
-F "react-with-addons=@build/react-with-addons.js" \
-F "react-with-addons.min=@build/react-with-addons.min.js" \
-F "react-dom=@build/react-dom.js" \
-F "react-dom.min=@build/react-dom.min.js" \
-F "react-dom-server=@build/react-dom-server.js" \
-F "react-dom-server.min=@build/react-dom-server.min.js" \
-F "npm-react=@build/packages/react.tgz" \
-F "npm-react-dom=@build/packages/react-dom.tgz" \
-F "commit=$TRAVIS_COMMIT" \
-F "date=`git log --format='%ct' -1`" \
-F "pull_request=$TRAVIS_PULL_REQUEST" \
-F "token=$SECRET_TOKEN" \
-F "branch=$TRAVIS_BRANCH" \
$SERVER
fi
elif [ "$TEST_TYPE" = test ]; then
set -e
./node_modules/.bin/grunt jest:normal
echo 'Testing in server-render (HTML generation) mode...'
printf '\nmodule.exports.useCreateElement = false;\n' \
>> src/renderers/dom/shared/ReactDOMFeatureFlags.js
./node_modules/.bin/grunt jest:normal
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
else
./node_modules/.bin/grunt $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=build
- TEST_TYPE=test
- TEST_TYPE=lint
- TEST_TYPE=build_website
global:
# SERVER
- secure: qPvsJ46XzGrdIuPA70b55xQNGF8jcK7N1LN5CCQYYocXLa+fBrl+fTE77QvehOPhqwJXcj6kOxI+sY0KrVwV7gmq2XY2HZGWUSCxTN0SZlNIzqPA80Y7G/yOjA4PUt8LKgP+8tptyhTAY56qf+hgW8BoLiKOdztYF2p+3zXOLuA=
# SECRET_TOKEN
- secure: dkpPW+VnoqC/okhRdV90m36NcyBFhcwEKL3bNFExAwi0dXnFao8RoFlvnwiPlA23h2faROkMIetXlti6Aju08BgUFV+f9aL6vLyU7gUent4Nd3413zf2fwDtXIWIETg6uLnOpSykGKgCAT/hY3Q2oPLqOoY0OxfgnbqwxkxljrE=
# GITHUB_TOKEN
- secure: EHCyCSKMwKlLHNtcj9nmkRzmiiPE3aDGlPcnEyrDJeRI0SeN/iCXHXfFivR0vFq3vr+9naMBczAR2AEidtps5KbJrKqdZnjPFRbmfVtzWr/LlvVCub3u13Pub6TdKIVBTny1PuZ5X8GvdxMNVig89jGjvzhhWuQRaz3VhJnTra4=
# COVERALLS_TOKEN
- secure: h/cUq+TrUMZOQmkFD7CvuwX0uAwmjIfKZ4qSUzY+QzUtDzOzA0L/XF84xTBq1Q5YYsEiaoF6GxxGCdrLQiBA/ZTd+88UHgeZPMRvi0xG9Q+PeePVOsZMTxy4/WWFgOfSQCk49Mj9zizGgO78i6vxq+SDXMtFHnZ+TpPJIEW6/m0=
notifications:
irc:
use_notice: true
skip_join: true
on_success: change
on_failure: change
channels:
- chat.freenode.net#reactjs

437
AUTHORS

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,554 @@
## [Unreleased]
<details>
<summary>
Changes that have landed in master but are not yet released.
Click to see more.
</summary>
### Discontinuing Bower Releases
Starting with 16.1.0, we will no longer be publishing new releases on Bower. You can continue using Bower for old releases, or point your Bower configs to the [React UMD builds hosted on unpkg](https://reactjs.org/docs/installation.html#using-a-cdn) that mirror npm releases and will continue to be updated.
### All Packages
* Fix an accidental extra global variable in the UMD builds. ([@gaearon](https://github.com/gaearon) in [#10935](https://github.com/facebook/react/pull/10935))
### React DOM
* Allow `on` as a custom attribute for AMP. ([@nuc](https://github.com/nuc) in [#11153](https://github.com/facebook/react/pull/11153))
* Fix `onMouseEnter` and `onMouseLeave` firing on wrong elements. ([@gaearon](https://github.com/gaearon) in [#11164](https://github.com/facebook/react/pull/11164))
* Fix `null` showing up in a warning instead of the component stack. ([@gaearon](https://github.com/gaearon) in [#10915](https://github.com/facebook/react/pull/10915))
* Fix IE11 crash in development mode. ([@leidegre](https://github.com/leidegre) in [#10921](https://github.com/facebook/react/pull/10921))
* Fix `tabIndex` not getting applied to SVG elements. ([@gaearon](http://github.com/gaearon) in [#11034](https://github.com/facebook/react/pull/11034))
* Fix SVG children not getting cleaned up on `dangerouslySetInnerHTML` in IE. ([@OriR](https://github.com/OriR) in [#11108](https://github.com/facebook/react/pull/11108))
* Fix false positive text mismatch warning caused by newline normalization. ([@gaearon](http://github.com/gaearon) in [#11119](https://github.com/facebook/react/pull/11119))
* Fix `form.reset()` to respect `defaultValue` on uncontrolled `<select>`. ([@aweary](https://github.com/aweary) in [#11057](https://github.com/facebook/react/pull/11057))
* Fix `<textarea>` placeholder not rendering on IE11. ([@gaearon](https://github.com/gaearon) in [#11177](https://github.com/facebook/react/pull/11177))
* Fix a crash rendering into shadow root. ([@gaearon](https://github.com/gaearon) in [#11037](https://github.com/facebook/react/pull/11037))
* Fix false positive warning about hydrating mixed case SVG tags. ([@gaearon](http://github.com/gaearon) in [#11174](https://github.com/facebook/react/pull/11174))
* Suppress the new unknown tag warning for `<dialog>` element. ([@gaearon](http://github.com/gaearon) in [#11035](https://github.com/facebook/react/pull/11035))
* Warn about function child no more than once. ([@andreysaleba](https://github.com/andreysaleba) in [#11120](https://github.com/facebook/react/pull/11120))
* Warn about nested updates no more than once. ([@anushreesubramani](https://github.com/anushreesubramani) in [#11113](https://github.com/facebook/react/pull/11113))
* Include helpful component stack into the warning about `contentEditable` and `children`. ([@Ethan-Arrowood](https://github.com/Ethan-Arrowood) in [#11208](https://github.com/facebook/react/pull/11208))
* Removing unused code. ([@gaearon](https://github.com/gaearon) in [#10802](https://github.com/facebook/react/pull/10802), [#10803](https://github.com/facebook/react/pull/10803))
### React DOM Server
* Fix markup generation when components return strings. ([@gaearon](http://github.com/gaearon) in [#11109](https://github.com/facebook/react/pull/11109))
* Fix obscure error message when passing an invalid style value. ([@iamdustan](https://github.com/iamdustan) in [#11173](https://github.com/facebook/react/pull/11173))
* Include the `autoFocus` attribute into SSR markup. ([@gaearon](http://github.com/gaearon) in [#11192](https://github.com/facebook/react/pull/11192))
* Include the component stack into more warnings. ([@gaearon](http://github.com/gaearon) in [#11284](https://github.com/facebook/react/pull/11284))
### React Test Renderer and Test Utils
* Fix multiple `setState()` calls in `componentWillMount()` in shallow renderer. ([@Hypnosphi](https://github.com/Hypnosphi) in [#11167](https://github.com/facebook/react/pull/11167))
* Fix shallow renderer to ignore `shouldComponentUpdate()` after `forceUpdate()`. ([@d4rky-pl](https://github.com/d4rky-pl) in [#11239](https://github.com/facebook/react/pull/11239))
* Add back support for running in production mode. ([@gaearon](https://github.com/gaearon) in [#11112](https://github.com/facebook/react/pull/11112))
* Add a missing `package.json` dependency. ([@gaearon](https://github.com/gaearon) in [#11340](https://github.com/facebook/react/pull/11340))
### React ART
* Add a missing `package.json` dependency. ([@gaearon](https://github.com/gaearon) in [#11341](https://github.com/facebook/react/pull/11341))
</details>
## 16.0.0 (September 26, 2017)
### New JS Environment Requirements
* 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).
### New Features
* Components can now return arrays and strings from `render`. (Docs coming soon!)
* Improved error handling with introduction of "error boundaries". [Error boundaries](https://reactjs.org/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.
* First-class support for declaratively rendering a subtree into another DOM node with `ReactDOM.createPortal()`. (Docs coming soon!)
* 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.)
* [React DOM now allows passing non-standard attributes](https://reactjs.org/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)
### Breaking Changes
- There are several changes to the behavior of scheduling and lifecycle methods:
* `ReactDOM.render()` and `ReactDOM.unstable_renderIntoContainer()` now return `null` if called from inside a lifecycle method.
* 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).
* Minor changes to `setState` behavior:
* Calling `setState` with null no longer triggers an update. This allows you to decide in an updater function if you want to re-render.
* Calling `setState` directly in render always causes an update. This was not previously the case. Regardless, you should not be calling `setState` from render.
* `setState` callback (second argument) now fires immediately after `componentDidMount` / `componentDidUpdate` instead of after all components have rendered.
* When replacing `<A />` with `<B />`, `B.componentWillMount` now always happens before `A.componentWillUnmount`. Previously, `A.componentWillUnmount` could fire first in some cases.
* 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.
* 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)
* `componentDidUpdate` lifecycle no longer receives `prevContext` param. ([@bvaughn](https://github.com/bvaughn) in [#8631](https://github.com/facebook/react/pull/8631))
* 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.
* 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).
* Shallow renderer does not implement `unstable_batchedUpdates()` anymore.
* `ReactDOM.unstable_batchedUpdates` now only takes one extra argument after the callback.
- The names and paths to the single-file browser builds have changed to emphasize the difference between development and production builds. For example:
- `react/dist/react.js``react/umd/react.development.js`
- `react/dist/react.min.js``react/umd/react.production.min.js`
- `react-dom/dist/react-dom.js``react-dom/umd/react-dom.development.js`
- `react-dom/dist/react-dom.min.js``react-dom/umd/react-dom.production.min.js`
* The server renderer has been completely rewritten, with some improvements:
* 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.
* 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.
* 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://reactjs.org/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)
* Errors in the render and lifecycle methods now unmount the component tree by default. To prevent this, add [error boundaries](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) to the appropriate places in the UI.
### Removed Deprecations
- 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.
- 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://reactjs.org/blog/2017/04/07/react-v15.5.0.html) and [15.6.0](https://reactjs.org/blog/2017/06/13/react-v15.6.0.html) blog posts for instructions on migrating code and automated codemods.
## 15.6.2 (September 25, 2017)
### All Packages
* Switch from BSD + Patents to MIT license
### React DOM
* 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))
* CSS Columns are treated as unitless numbers. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/10115))
* Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011))
* Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363))
* 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))
* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
* 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))
## 15.6.1 (June 14, 2017)
### React DOM
* Fix a crash on iOS Safari. ([@jquense](https://github.com/jquense) in [#9960](https://github.com/facebook/react/pull/9960))
* Don't add `px` to custom CSS property values. ([@TrySound](https://github.com/TrySound) in [#9966](https://github.com/facebook/react/pull/9966))
## 15.6.0 (June 13, 2017)
### React
* Downgrade deprecation warnings to use `console.warn` instead of `console.error`. ([@flarnie](https://github.com/flarnie) in [#9753](https://github.com/facebook/react/pull/9753))
* Add a deprecation warning for `React.createClass`. Points users to `create-react-class` instead. ([@flarnie](https://github.com/flarnie) in [#9771](https://github.com/facebook/react/pull/9771))
* Add deprecation warnings and separate module for `React.DOM` factory helpers. ([@nhunzaker](https://github.com/nhunzaker) in [#8356](https://github.com/facebook/react/pull/8356))
* Warn for deprecation of `React.createMixin` helper, which was never used. ([@aweary](https://github.com/aweary) in [#8853](https://github.com/facebook/react/pull/8853))
### React DOM
* Add support for CSS variables in `style` attribute. ([@aweary](https://github.com/aweary) in [#9302](https://github.com/facebook/react/pull/9302))
* Add support for CSS Grid style properties. ([@ericsakmar](https://github.com/ericsakmar) in [#9185](https://github.com/facebook/react/pull/9185))
* Fix bug where inputs mutated value on type conversion. ([@nhunzaker](https://github.com/mhunzaker) in [#9806](https://github.com/facebook/react/pull/9806))
* Fix issues with `onChange` not firing properly for some inputs. ([@jquense](https://github.com/jquense) in [#8575](https://github.com/facebook/react/pull/8575))
* Fix bug where controlled number input mistakenly allowed period. ([@nhunzaker](https://github.com/nhunzaker) in [#9584](https://github.com/facebook/react/pull/9584))
* Fix bug where performance entries were being cleared. ([@chrisui](https://github.com/chrisui) in [#9451](https://github.com/facebook/react/pull/9451))
### React Addons
* Fix AMD support for addons depending on `react`. ([@flarnie](https://github.com/flarnie) in [#9919](https://github.com/facebook/react/issues/9919))
* Fix `isMounted()` to return `true` in `componentWillUnmount`. ([@mridgway](https://github.com/mridgway) in [#9638](https://github.com/facebook/react/issues/9638))
* Fix `react-addons-update` to not depend on native `Object.assign`. ([@gaearon](https://github.com/gaearon) in [#9937](https://github.com/facebook/react/pull/9937))
* Remove broken Google Closure Compiler annotation from `create-react-class`. ([@gaearon](https://github.com/gaearon) in [#9933](https://github.com/facebook/react/pull/9933))
* Remove unnecessary dependency from `react-linked-input`. ([@gaearon](https://github.com/gaearon) in [#9766](https://github.com/facebook/react/pull/9766))
* Point `react-addons-(css-)transition-group` to the new package. ([@gaearon](https://github.com/gaearon) in [#9937](https://github.com/facebook/react/pull/9937))
## 15.5.4 (April 11, 2017)
### React Addons
* **Critical Bugfix:** Update the version of `prop-types` to fix critical bug. ([@gaearon](https://github.com/gaearon) in [545c87f](https://github.com/facebook/react/commit/545c87fdc348f82eb0c3830bef715ed180785390))
* Fix `react-addons-create-fragment` package to include `loose-envify` transform for Browserify users. ([@mridgway](https://github.com/mridgway) in [#9642](https://github.com/facebook/react/pull/9642))
### React Test Renderer
* Fix compatibility with Enzyme by exposing `batchedUpdates` on shallow renderer. ([@gaearon](https://github.com/gaearon) in [9382](https://github.com/facebook/react/commit/69933e25c37cf5453a9ef132177241203ee8d2fd))
## 15.5.3 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React Addons
* Fix `react-addons-create-fragment` package to export correct thing. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
* Fix `create-react-class` package to include `loose-envify` transform for Browserify users. ([@mridgway](https://github.com/mridgway) in [#9642](https://github.com/facebook/react/pull/9642))
## 15.5.2 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React Addons
* Fix the production single-file builds to not include the development code. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
* Apply better minification to production single-file builds. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
* Add missing and remove unnecessary dependencies to packages. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
## 15.5.1 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React
* Fix erroneous PropTypes access warning. ([@acdlite](https://github.com/acdlite) in ([ec97ebb](https://github.com/facebook/react/commit/ec97ebbe7f15b58ae2f1323df39d06f119873344))
## 15.5.0 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React
* <s>Added a deprecation warning for `React.createClass`. Points users to create-react-class instead. ([@acdlite](https://github.com/acdlite) in [#d9a4fa4](https://github.com/facebook/react/commit/d9a4fa4f51c6da895e1655f32255cf72c0fe620e))</s>
* Added a deprecation warning for `React.PropTypes`. Points users to prop-types instead. ([@acdlite](https://github.com/acdlite) in [#043845c](https://github.com/facebook/react/commit/043845ce75ea0812286bbbd9d34994bb7e01eb28))
* Fixed an issue when using `ReactDOM` together with `ReactDOMServer`. ([@wacii](https://github.com/wacii) in [#9005](https://github.com/facebook/react/pull/9005))
* Fixed issue with Closure Compiler. ([@anmonteiro](https://github.com/anmonteiro) in [#8895](https://github.com/facebook/react/pull/8895))
* Another fix for Closure Compiler. ([@Shastel](https://github.com/Shastel) in [#8882](https://github.com/facebook/react/pull/8882))
* Added component stack info to invalid element type warning. ([@n3tr](https://github.com/n3tr) in [#8495](https://github.com/facebook/react/pull/8495))
### React DOM
* Fixed Chrome bug when backspacing in number inputs. ([@nhunzaker](https://github.com/nhunzaker) in [#7359](https://github.com/facebook/react/pull/7359))
* Added `react-dom/test-utils`, which exports the React Test Utils. ([@bvaughn](https://github.com/bvaughn))
### React Test Renderer
* Fixed bug where `componentWillUnmount` was not called for children. ([@gre](https://github.com/gre) in [#8512](https://github.com/facebook/react/pull/8512))
* Added `react-test-renderer/shallow`, which exports the shallow renderer. ([@bvaughn](https://github.com/bvaughn))
### React Addons
* Last release for addons; they will no longer be actively maintained.
* Removed `peerDependencies` so that addons continue to work indefinitely. ([@acdlite](https://github.com/acdlite) and [@bvaughn](https://github.com/bvaughn) in [8a06cd7](https://github.com/facebook/react/commit/8a06cd7a786822fce229197cac8125a551e8abfa) and [67a8db3](https://github.com/facebook/react/commit/67a8db3650d724a51e70be130e9008806402678a))
* Updated to remove references to `React.createClass` and `React.PropTypes` ([@acdlite](https://github.com/acdlite) in [12a96b9](https://github.com/facebook/react/commit/12a96b94823d6b6de6b1ac13bd576864abd50175))
* `react-addons-test-utils` is deprecated. Use `react-dom/test-utils` and `react-test-renderer/shallow` instead. ([@bvaughn](https://github.com/bvaughn))
## 15.4.2 (January 6, 2017)
### React
* Fixed build issues with the Brunch bundler. ([@gaearon](https://github.com/gaearon) in [#8686](https://github.com/facebook/react/pull/8686))
* Improved error messages for invalid element types. ([@sophiebits](https://github.com/sophiebits) in [#8612](https://github.com/facebook/react/pull/8612))
* Removed a warning about `getInitialState` when `this.state` is set. ([@bvaughn](https://github.com/bvaughn) in [#8594](https://github.com/facebook/react/pull/8594))
* Removed some dead code. ([@diegomura](https://github.com/diegomura) in [#8050](https://github.com/facebook/react/pull/8050), [@dfrownfelter](https://github.com/dfrownfelter) in [#8597](https://github.com/facebook/react/pull/8597))
### React DOM
* Fixed a decimal point issue on uncontrolled number inputs. ([@nhunzaker](https://github.com/nhunzaker) in [#7750](https://github.com/facebook/react/pull/7750))
* Fixed rendering of textarea placeholder in IE11. ([@aweary](https://github.com/aweary) in [#8020](https://github.com/facebook/react/pull/8020))
* Worked around a script engine bug in IE9. ([@eoin](https://github.com/eoin) in [#8018](https://github.com/facebook/react/pull/8018))
### React Addons
* Fixed build issues in RequireJS and SystemJS environments. ([@gaearon](https://github.com/gaearon) in [#8686](https://github.com/facebook/react/pull/8686))
* Added missing package dependencies. ([@kweiberth](https://github.com/kweiberth) in [#8467](https://github.com/facebook/react/pull/8467))
## 15.4.1 (November 22, 2016)
### React
* Restructure variable assignment to work around a Rollup bug ([@gaearon](https://github.com/gaearon) in [#8384](https://github.com/facebook/react/pull/8384))
### React DOM
* Fixed event handling on disabled button elements ([@sophiebits](https://github.com/sophiebits) in [#8387](https://github.com/facebook/react/pull/8387))
* Fixed compatibility of browser build with AMD environments ([@zpao](https://github.com/zpao) in [#8374](https://github.com/facebook/react/pull/8374))
## 15.4.0 (November 16, 2016)
### React
* React package and browser build no longer "secretly" includes React DOM. ([@sebmarkbage](https://github.com/sebmarkbage) in [#7164](https://github.com/facebook/react/pull/7164) and [#7168](https://github.com/facebook/react/pull/7168))
* Required PropTypes now fail with specific messages for null and undefined. ([@chenglou](https://github.com/chenglou) in [#7291](https://github.com/facebook/react/pull/7291))
* Improved development performance by freezing children instead of copying. ([@keyanzhang](https://github.com/keyanzhang) in [#7455](https://github.com/facebook/react/pull/7455))
### React DOM
* Fixed occasional test failures when React DOM is used together with shallow renderer. ([@goatslacker](https://github.com/goatslacker) in [#8097](https://github.com/facebook/react/pull/8097))
* Added a warning for invalid `aria-` attributes. ([@jessebeach](https://github.com/jessebeach) in [#7744](https://github.com/facebook/react/pull/7744))
* Added a warning for using `autofocus` rather than `autoFocus`. ([@hkal](https://github.com/hkal) in [#7694](https://github.com/facebook/react/pull/7694))
* Removed an unnecessary warning about polyfilling `String.prototype.split`. ([@nhunzaker](https://github.com/nhunzaker) in [#7629](https://github.com/facebook/react/pull/7629))
* Clarified the warning about not calling PropTypes manually. ([@jedwards1211](https://github.com/jedwards1211) in [#7777](https://github.com/facebook/react/pull/7777))
* The unstable `batchedUpdates` API now passes the wrapped function's return value through. ([@bgnorlov](https://github.com/bgnorlov) in [#7444](https://github.com/facebook/react/pull/7444))
* Fixed a bug with updating text in IE 8. ([@mnpenner](https://github.com/mnpenner) in [#7832](https://github.com/facebook/react/pull/7832))
### React Perf
* When ReactPerf is started, you can now view the relative time spent in components as a chart in Chrome Timeline. ([@gaearon](https://github.com/gaearon) in [#7549](https://github.com/facebook/react/pull/7549))
### React Test Utils
* If you call `Simulate.click()` on a `<input disabled onClick={foo} />` then `foo` will get called whereas it didn't before. ([@nhunzaker](https://github.com/nhunzaker) in [#7642](https://github.com/facebook/react/pull/7642))
### React Test Renderer
* Due to packaging changes, it no longer crashes when imported together with React DOM in the same file. ([@sebmarkbage](https://github.com/sebmarkbage) in [#7164](https://github.com/facebook/react/pull/7164) and [#7168](https://github.com/facebook/react/pull/7168))
* `ReactTestRenderer.create()` now accepts `{createNodeMock: element => mock}` as an optional argument so you can mock refs with snapshot testing. ([@Aweary](https://github.com/Aweary) in [#7649](https://github.com/facebook/react/pull/7649), [#8261](https://github.com/facebook/react/pull/8261))
## 15.3.2 (September 19, 2016)
### React
- Remove plain object warning from React.createElement & React.cloneElement. ([@spudly](https://github.com/spudly) in [#7724](https://github.com/facebook/react/pull/7724))
### React DOM
- Add `playsInline` to supported HTML attributes. ([@reaperhulk](https://github.com/reaperhulk) in [#7519](https://github.com/facebook/react/pull/7519))
- Add `as` to supported HTML attributes. ([@kevinslin](https://github.com/kevinslin) in [#7582](https://github.com/facebook/react/pull/7582))
- Improve DOM nesting validation warning about whitespace. ([@sophiebits](https://github.com/sophiebits) in [#7515](https://github.com/facebook/react/pull/7515))
- Avoid "Member not found" exception in IE10 when calling `preventDefault()` in Synthetic Events. ([@g-palmer](https://github.com/g-palmer) in [#7411](https://github.com/facebook/react/pull/7411))
- Fix memory leak in `onSelect` implementation. ([@AgtLucas](https://github.com/AgtLucas) in [#7533](https://github.com/facebook/react/pull/7533))
- Improve robustness of `document.documentMode` checks to handle Google Tag Manager. ([@SchleyB](https://github.com/SchleyB) in [#7594](https://github.com/facebook/react/pull/7594))
- Add more cases to controlled inputs warning. ([@marcin-mazurek](https://github.com/marcin-mazurek) in [#7544](https://github.com/facebook/react/pull/7544))
- Handle case of popup blockers overriding `document.createEvent`. ([@Andarist](https://github.com/Andarist) in [#7621](https://github.com/facebook/react/pull/7621))
- Fix issue with `dangerouslySetInnerHTML` and SVG in Internet Explorer. ([@zpao](https://github.com/zpao) in [#7618](https://github.com/facebook/react/pull/7618))
- Improve handling of Japanese IME on Internet Explorer. ([@msmania](https://github.com/msmania) in [#7107](https://github.com/facebook/react/pull/7107))
### React Test Renderer
- Support error boundaries. ([@millermedeiros](https://github.com/millermedeiros) in [#7558](https://github.com/facebook/react/pull/7558), [#7569](https://github.com/facebook/react/pull/7569), [#7619](https://github.com/facebook/react/pull/7619))
- Skip null ref warning. ([@Aweary](https://github.com/Aweary) in [#7658](https://github.com/facebook/react/pull/7658))
### React Perf Add-on
- Ensure lifecycle timers are stopped on errors. ([@gaearon](https://github.com/gaearon) in [#7548](https://github.com/facebook/react/pull/7548))
## 15.3.1 (August 19, 2016)
### React
- Improve performance of development builds in various ways. ([@gaearon](https://github.com/gaearon) in [#7461](https://github.com/facebook/react/pull/7461), [#7463](https://github.com/facebook/react/pull/7463), [#7483](https://github.com/facebook/react/pull/7483), [#7488](https://github.com/facebook/react/pull/7488), [#7491](https://github.com/facebook/react/pull/7491), [#7510](https://github.com/facebook/react/pull/7510))
- Cleanup internal hooks to improve performance of development builds. ([@gaearon](https://github.com/gaearon) in [#7464](https://github.com/facebook/react/pull/7464), [#7472](https://github.com/facebook/react/pull/7472), [#7481](https://github.com/facebook/react/pull/7481), [#7496](https://github.com/facebook/react/pull/7496))
- Upgrade fbjs to pick up another performance improvement from [@gaearon](https://github.com/gaearon) for development builds. ([@zpao](https://github.com/zpao) in [#7532](https://github.com/facebook/react/pull/7532))
- Improve startup time of React in Node. ([@zertosh](https://github.com/zertosh) in [#7493](https://github.com/facebook/react/pull/7493))
- Improve error message of `React.Children.only`. ([@sophiebits](https://github.com/sophiebits) in [#7514](https://github.com/facebook/react/pull/7514))
### React DOM
- Avoid `<input>` validation warning from browsers when changing `type`. ([@nhunzaker](https://github.com/nhunzaker) in [#7333](https://github.com/facebook/react/pull/7333))
- Avoid "Member not found" exception in IE10 when calling `stopPropagation()` in Synthetic Events. ([@nhunzaker](https://github.com/nhunzaker) in [#7343](https://github.com/facebook/react/pull/7343))
- Fix issue resulting in inability to update some `<input>` elements in mobile browsers. ([@keyanzhang](https://github.com/keyanzhang) in [#7397](https://github.com/facebook/react/pull/7397))
- Fix memory leak in server rendering. ([@keyanzhang](https://github.com/keyanzhang) in [#7410](https://github.com/facebook/react/pull/7410))
- Fix issue resulting in `<input type="range">` values not updating when changing `min` or `max`. ([@troydemonbreun](https://github.com/troydemonbreun) in [#7486](https://github.com/facebook/react/pull/7486))
- Add new warning for rare case of attempting to unmount a container owned by a different copy of React. ([@ventuno](https://github.com/ventuno) in [#7456](https://github.com/facebook/react/pull/7456))
### React Test Renderer
- Fix ReactTestInstance::toJSON() with empty top-level components. ([@Morhaus](https://github.com/Morhaus) in [#7523](https://github.com/facebook/react/pull/7523))
### React Native Renderer
- Change `trackedTouchCount` invariant into a console.error for better reliability. ([@yungsters](https://github.com/yungsters) in [#7400](https://github.com/facebook/react/pull/7400))
## 15.3.0 (July 29, 2016)
### React
- Add `React.PureComponent` - a new base class to extend, replacing `react-addons-pure-render-mixin` now that mixins don't work with ES2015 classes. ([@sophiebits](https://github.com/sophiebits) in [#7195](https://github.com/facebook/react/pull/7195))
- Add new warning when modifying `this.props.children`. ([@jimfb](https://github.com/jimfb) in [#7001](https://github.com/facebook/react/pull/7001))
- Fixed issue with ref resolution order. ([@gaearon](https://github.com/gaearon) in [#7101](https://github.com/facebook/react/pull/7101))
- Warn when mixin is undefined. ([@swaroopsm](https://github.com/swaroopsm) in [#6158](https://github.com/facebook/react/pull/6158))
- Downgrade "unexpected batch number" invariant to a warning. ([@sophiebits](https://github.com/sophiebits) in [#7133](https://github.com/facebook/react/pull/7133))
- Validate arguments to `oneOf` and `oneOfType` PropTypes sooner. ([@troydemonbreun](https://github.com/troydemonbreun) in [#6316](https://github.com/facebook/react/pull/6316))
- Warn when calling PropTypes directly. ([@Aweary](https://github.com/Aweary) in [#7132](https://github.com/facebook/react/pull/7132), [#7194](https://github.com/facebook/react/pull/7194))
- Improve warning when using Maps as children. ([@keyanzhang](https://github.com/keyanzhang) in [#7260](https://github.com/facebook/react/pull/7260))
- Add additional type information to the `PropTypes.element` warning. ([@alexzherdev](https://github.com/alexzherdev) in [#7319](https://github.com/facebook/react/pull/7319))
- Improve component identification in no-op `setState` warning. ([@keyanzhang](https://github.com/keyanzhang) in [#7326](https://github.com/facebook/react/pull/7326))
### React DOM
- Fix issue with nested server rendering. ([@Aweary](https://github.com/Aweary) in [#7033](https://github.com/facebook/react/pull/7033))
- Add `xmlns`, `xmlnsXlink` to supported SVG attributes. ([@salzhrani](https://github.com/salzhrani) in [#6471](https://github.com/facebook/react/pull/6471))
- Add `referrerPolicy` to supported HTML attributes. ([@Aweary](https://github.com/Aweary) in [#7274](https://github.com/facebook/react/pull/7274))
- Fix issue resulting in `<input type="range">` initial value being rounded. ([@troydemonbreun](https://github.com/troydemonbreun) in [#7251](https://github.com/facebook/react/pull/7251))
### React Test Renderer
- Initial public release of package allowing more focused testing. Install with `npm install react-test-renderer`. ([@sophiebits](https://github.com/sophiebits) in [#6944](https://github.com/facebook/react/pull/6944), [#7258](https://github.com/facebook/react/pull/7258), [@iamdustan](https://github.com/iamdustan) in [#7362](https://github.com/facebook/react/pull/7362))
### React Perf Add-on
- Fix issue resulting in excessive warnings when encountering an internal measurement error. ([@sassanh](https://github.com/sassanh) in [#7299](https://github.com/facebook/react/pull/7299))
### React TestUtils Add-on
- Implement `type` property on for events created via `TestUtils.Simulate.*`. ([@yaycmyk](https://github.com/yaycmyk) in [#6154](https://github.com/facebook/react/pull/6154))
- Fix crash when running TestUtils with the production build of React. ([@gaearon](https://github.com/gaearon) in [#7246](https://github.com/facebook/react/pull/7246))
## 15.2.1 (July 8, 2016)
### React
- Fix errant warning about missing React element. ([@gaearon](https://github.com/gaearon) in [#7193](https://github.com/facebook/react/pull/7193))
- Better removal of dev-only code, leading to a small reduction in the minified production bundle size. ([@gaearon](https://github.com/gaearon) in [#7188](https://github.com/facebook/react/pull/7188), [#7189](https://github.com/facebook/react/pull/7189))
### React DOM
- Add stack trace to null input value warning. ([@jimfb](https://github.com/jimfb) in [#7040](https://github.com/facebook/react/pull/7040))
- Fix webcomponents example. ([@jalexanderfox](https://github.com/jalexanderfox) in [#7057](https://github.com/facebook/react/pull/7057))
- Fix `unstable_renderSubtreeIntoContainer` so that context properly updates when linked to state. ([@gaearon](https://github.com/gaearon) in [#7125](https://github.com/facebook/react/pull/7125))
- Improve invariant wording for void elements. ([@starkch](https://github.com/starkch) in [#7066](https://github.com/facebook/react/pull/7066))
- Ensure no errors are thrown due to event handlers in server rendering. ([@rricard](https://github.com/rricard) in [#7127](https://github.com/facebook/react/pull/7127))
- Fix regression resulting in `value`-less submit and reset inputs removing the browser-default text. ([@zpao](https://github.com/zpao) in [#7197](https://github.com/facebook/react/pull/7197))
- Fix regression resulting in empty `name` attribute being added to inputs when not provided. ([@okonet](https://github.com/okonet) in [#7199](https://github.com/facebook/react/pull/7199))
- Fix issue with nested server rendering. ([@Aweary](https://github.com/Aweary) in [#7033](https://github.com/facebook/react/pull/7033))
### React Perf Add-on
- Make `ReactPerf.start()` work properly during lifecycle methods. ([@gaearon](https://github.com/gaearon) in [#7208](https://github.com/facebook/react/pull/7208)).
### React CSSTransitionGroup Add-on
- Fix issue resulting in spurious unknown property warnings. ([@batusai513](https://github.com/batusai513) in [#7165](https://github.com/facebook/react/pull/7165))
### React Native Renderer
- Improve error handling in cross-platform touch event handling. ([@yungsters](https://github.com/yungsters) in [#7143](https://github.com/facebook/react/pull/7143))
## 15.2.0 (July 1, 2016)
### React
- Add error codes to production invariants, with links to the view the full error text. ([@keyanzhang](https://github.com/keyanzhang) in [#6948](https://github.com/facebook/react/pull/6948))
- Include component stack information in PropType validation warnings. ([@troydemonbreun](https://github.com/troydemonbreun) in [#6398](https://github.com/facebook/react/pull/6398), [@sophiebits](https://github.com/sophiebits) in [#6771](https://github.com/facebook/react/pull/6771))
- Include component stack information in key warnings. ([@keyanzhang](https://github.com/keyanzhang) in [#6799](https://github.com/facebook/react/pull/6799))
- Stop validating props at mount time, only validate at element creation. ([@keyanzhang](https://github.com/keyanzhang) in [#6824](https://github.com/facebook/react/pull/6824))
- New invariant providing actionable error in missing instance case. ([@yungsters](https://github.com/yungsters) in [#6990](https://github.com/facebook/react/pull/6990))
- Add `React.PropTypes.symbol` to support ES2015 Symbols as props. ([@puradox](https://github.com/puradox) in [#6377](https://github.com/facebook/react/pull/6377))
- Fix incorrect coercion of ref or key that are undefined in development ([@gaearon](https://github.com/gaearon) in [#6880](https://github.com/facebook/react/pull/6880))
- Fix a false positive when passing other elements props to cloneElement ([@ericmatthys](https://github.com/ericmatthys) in [#6268](https://github.com/facebook/react/pull/6268))
- Warn if you attempt to define `childContextTypes` on a functional component ([@Aweary](https://github.com/Aweary) in [#6933](https://github.com/facebook/react/pull/6933))
### React DOM
- Add warning for unknown properties on DOM elements. ([@jimfb](https://github.com/jimfb) in [#6800](https://github.com/facebook/react/pull/6800), [@gm758](https://github.com/gm758) in [#7152](https://github.com/facebook/react/pull/7152))
- Properly remove attributes from custom elements. ([@grassator](https://github.com/grassator) in [#6748](https://github.com/facebook/react/pull/6748))
- Fix invalid unicode escape in attribute name regular expression. ([@nbjahan](https://github.com/nbjahan) in [#6772](https://github.com/facebook/react/pull/6772))
- Add `onLoad` handling to `<link>` element. ([@roderickhsiao](https://github.com/roderickhsiao) in [#6815](https://github.com/facebook/react/pull/6815))
- Add `onError` handling to `<source>` element. ([@wadahiro](https://github.com/wadahiro) in [#6941](https://github.com/facebook/react/pull/6941))
- Handle `value` and `defaultValue` more accurately in the DOM. ([@jimfb](https://github.com/jimfb) in [#6406](https://github.com/facebook/react/pull/6406))
- Fix events issue in environments with mutated `Object.prototype`. ([@Weizenlol](https://github.com/Weizenlol) in [#6886](https://github.com/facebook/react/pull/6886))
- Fix issue where `is="null"` ended up in the DOM in Firefox. ([@darobin](https://github.com/darobin) in [#6896](https://github.com/facebook/react/pull/6896))
- Improved performance of text escaping by using [escape-html](https://github.com/component/escape-html). ([@aickin](https://github.com/aickin) in [#6862](https://github.com/facebook/react/pull/6862))
- Fix issue with `dangerouslySetInnerHTML` and SVG in Internet Explorer. ([@joshhunt](https://github.com/joshhunt) in [#6982](https://github.com/facebook/react/pull/6982))
- Fix issue with `<textarea>` placeholders. ([@jimfb](https://github.com/jimfb) in [#7002](https://github.com/facebook/react/pull/7002))
- Fix controlled vs uncontrolled detection of `<input type="radio"/>`. ([@jimfb](https://github.com/jimfb) in [#7003](https://github.com/facebook/react/pull/7003))
- Improve performance of updating text content. ([@trueadm](https://github.com/trueadm) in [#7005](https://github.com/facebook/react/pull/7005))
- Ensure controlled `<select>` components behave the same on initial render as they do on updates. ([@yiminghe](https://github.com/yiminghe) in [#5362](https://github.com/facebook/react/pull/5362))
### React Perf Add-on
- Add `isRunning()` API. ([@nfcampos](https://github.com/nfcampos) in [#6763](https://github.com/facebook/react/pull/6763))
- Improve accuracy of lifecycle hook timing. ([@gaearon](https://github.com/gaearon) in [#6858](https://github.com/facebook/react/pull/6858))
- Fix internal errors when using ReactPerf with portal components. ([@gaearon](https://github.com/gaearon) in [#6860](https://github.com/facebook/react/pull/6860))
- Fix performance regression. ([@sophiebits](https://github.com/sophiebits) in [#6770](https://github.com/facebook/react/pull/6770))
- Add warning that ReactPerf is not enabled in production. ([@sashashakun](https://github.com/sashashakun) in [#6884](https://github.com/facebook/react/pull/6884))
### React CSSTransitionGroup Add-on
- Fix timing issue with `null` node. ([@keyanzhang](https://github.com/keyanzhang) in [#6958](https://github.com/facebook/react/pull/6958))
### React Native Renderer
- Dependencies on React Native modules use CommonJS requires instead of providesModule. ([@davidaurelio](https://github.com/davidaurelio) in [#6715](https://github.com/facebook/react/pull/6715))
## 15.1.0 (May 20, 2016)
### React
- Ensure we're using the latest `object-assign`, which has protection against a non-spec-compliant native `Object.assign`. ([@zpao](https://github.com/zpao) in [#6681](https://github.com/facebook/react/pull/6681))
- Add a new warning to communicate that `props` objects passed to `createElement` must be plain objects. ([@richardscarrott](https://github.com/richardscarrott) in [#6134](https://github.com/facebook/react/pull/6134))
- Fix a batching bug resulting in some lifecycle methods incorrectly being called multiple times. ([@sophiebits](https://github.com/sophiebits) in [#6650](https://github.com/facebook/react/pull/6650))
### React DOM
- Fix regression in custom elements support. ([@jscissr](https://github.com/jscissr) in [#6570](https://github.com/facebook/react/pull/6570))
- Stop incorrectly warning about using `onScroll` event handler with server rendering. ([@Aweary](https://github.com/Aweary) in [#6678](https://github.com/facebook/react/pull/6678))
- Fix grammar in the controlled input warning. ([@jakeboone02](https://github.com/jakeboone02) in [#6657](https://github.com/facebook/react/pull/6657))
- Fix issue preventing `<object>` nodes from being able to read `<param>` nodes in IE. ([@syranide](https://github.com/syranide) in [#6691](https://github.com/facebook/react/pull/6691))
- Fix issue resulting in crash when using experimental error boundaries with server rendering. ([@jimfb](https://github.com/jimfb) in [#6694](https://github.com/facebook/react/pull/6694))
- Add additional information to the controlled input warning. ([@borisyankov](https://github.com/borisyankov) in [#6341](https://github.com/facebook/react/pull/6341))
### React Perf Add-on
- Completely rewritten to collect data more accurately and to be easier to maintain. ([@gaearon](https://github.com/gaearon) in [#6647](https://github.com/facebook/react/pull/6647), [#6046](https://github.com/facebook/react/pull/6046))
### React Native Renderer
- Remove some special cases for platform specific branching. ([@sebmarkbage](https://github.com/sebmarkbage) in [#6660](https://github.com/facebook/react/pull/6660))
- Remove use of `merge` utility. ([@sebmarkbage](https://github.com/sebmarkbage) in [#6634](https://github.com/facebook/react/pull/6634))
- Renamed some modules to better indicate usage ([@javache](https://github.com/javache) in [#6643](https://github.com/facebook/react/pull/6643))
## 15.0.2 (April 29, 2016)
### React
- Removed extraneous files from npm package. ([@gaearon](https://github.com/gaearon) in [#6388](https://github.com/facebook/react/pull/6388))
- Ensure `componentWillUnmount` is only called once. ([@jimfb](https://github.com/jimfb) in [#6613](https://github.com/facebook/react/pull/6613))
### ReactDOM
- Fixed bug resulting in disabled buttons responding to mouse events in IE. ([@nhunzaker](https://github.com/nhunzaker) in [#6215](https://github.com/facebook/react/pull/6215))
- Ensure `<option>`s are correctly selected when inside `<optgroup>`. ([@trevorsmith](https://github.com/trevorsmith) in [#6442](https://github.com/facebook/react/pull/6442))
- Restore support for rendering into a shadow root. ([@Wildhoney](https://github.com/Wildhoney) in [#6462](https://github.com/facebook/react/pull/6462))
- Ensure nested `<body>` elements are caught when warning for invalid markup. ([@keyanzhang](https://github.com/keyanzhang) in [#6469](https://github.com/facebook/react/pull/6469))
- Improve warning when encountering multiple elements with the same key. ([@hkal](https://github.com/hkal) in [#6500](https://github.com/facebook/react/pull/6500))
### React TestUtils Add-on
- Ensure that functional components do not have an owner. ([@gaearon](https://github.com/gaearon) in [#6362](https://github.com/facebook/react/pull/6362))
- Handle invalid arguments to `scryRenderedDOMComponentsWithClass` better. ([@ipeters90](https://github.com/ipeters90) in [#6529](https://github.com/facebook/react/pull/6529))
### React Perf Add-on
- Ignore DOM operations that occur outside the batch operation. ([@gaearon](https://github.com/gaearon) in [#6516](https://github.com/facebook/react/pull/6516))
### React Native Renderer
- These files are now shipped inside the React npm package. They have no impact on React core or ReactDOM.
## 15.0.1 (April 8, 2016)
### React
- Restore `React.__spread` API to unbreak code compiled with some tools making use of this undocumented API. It is now officially deprecated. ([@zpao](https://github.com/zpao) in [#6444](https://github.com/facebook/react/pull/6444))
### ReactDOM
- Fixed issue resulting in loss of cursor position in controlled inputs. ([@sophiebits](https://github.com/sophiebits) in [#6449](https://github.com/facebook/react/pull/6449))
## 15.0.0 (April 7, 2016)
### Major changes
- **Initial render now uses `document.createElement` instead of generating HTML.** Previously we would generate a large string of HTML and then set `node.innerHTML`. At the time, this was decided to be faster than using `document.createElement` for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using `createElement` we can make other parts of React faster. ([@sophiebits](https://github.com/sophiebits) in [#5205](https://github.com/facebook/react/pull/5205))
- **`data-reactid` is no longer on every node.** As a result of using `document.createElement`, we can prime the node cache as we create DOM nodes, allowing us to skip a potential lookup (which used the `data-reactid` attribute). Root nodes will have a `data-reactroot` attribute and server generated markup will still contain `data-reactid`. ([@sophiebits](https://github.com/sophiebits) in [#5205](https://github.com/facebook/react/pull/5205))
- **No more extra `<span>`s.** ReactDOM will now render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. If you were targeting these `<span>`s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components. ([@mwiencek](https://github.com/mwiencek) in [#5753](https://github.com/facebook/react/pull/5753))
- **Rendering `null` now uses comment nodes.** Previously `null` would render to `<noscript>` elements. We now use comment nodes. This may cause issues if making use of `:nth-child` CSS selectors. While we consider this rendering behavior an implementation detail of React, it's worth noting the potential problem. ([@sophiebits](https://github.com/sophiebits) in [#5451](https://github.com/facebook/react/pull/5451))
- **Functional components can now return `null`.** We added support for [defining stateless components as functions](/react/blog/2015/09/10/react-v0.14-rc1.html#stateless-function-components) in React 0.14. However, React 0.14 still allowed you to define a class component without extending `React.Component` or using `React.createClass()`, so [we couldnt reliably tell if your component is a function or a class](https://github.com/facebook/react/issues/5355), and did not allow returning `null` from it. This issue is solved in React 15, and you can now return `null` from any component, whether it is a class or a function. ([@jimfb](https://github.com/jimfb) in [#5884](https://github.com/facebook/react/pull/5884))
- **Improved SVG support.** All SVG tags are now fully supported. (Uncommon SVG tags are not present on the `React.DOM` element helper, but JSX and `React.createElement` work on all tag names.) All SVG attributes that are implemented by the browsers should be supported too. If you find any attributes that we have missed, please [let us know in this issue](https://github.com/facebook/react/issues/1657). ([@zpao](https://github.com/zpao) in [#6243](https://github.com/facebook/react/pull/6243))
### Breaking changes
- **No more extra `<span>`s.**
- **`React.cloneElement()` now resolves `defaultProps`.** We fixed a bug in `React.cloneElement()` that some components may rely on. If some of the `props` received by `cloneElement()` are `undefined`, it used to return an element with `undefined` values for those props. Were changing it to be consistent with `createElement()`. Now any `undefined` props passed to `cloneElement()` are resolved to the corresponding components `defaultProps`. ([@truongduy134](https://github.com/truongduy134) in [#5997](https://github.com/facebook/react/pull/5997))
- **`ReactPerf.getLastMeasurements()` is opaque.** This change wont affect applications but may break some third-party tools. We are [revamping `ReactPerf` implementation](https://github.com/facebook/react/pull/6046) and plan to release it during the 15.x cycle. The internal performance measurement format is subject to change so, for the time being, we consider the return value of `ReactPerf.getLastMeasurements()` an opaque data structure that should not be relied upon. ([@gaearon](https://github.com/gaearon) in [#6286](https://github.com/facebook/react/pull/6286))
#### Removed deprecations
These deprecations were introduced nine months ago in v0.14 with a warning and are removed:
- Deprecated APIs are removed from the `React` top-level export: `findDOMNode`, `render`, `renderToString`, `renderToStaticMarkup`, and `unmountComponentAtNode`. As a reminder, they are now available on `ReactDOM` and `ReactDOMServer`. ([@jimfb](https://github.com/jimfb) in [#5832](https://github.com/facebook/react/pull/5832))
- Deprecated addons are removed: `batchedUpdates` and `cloneWithProps`. ([@jimfb](https://github.com/jimfb) in [#5859](https://github.com/facebook/react/pull/5859), [@zpao](https://github.com/zpao) in [#6016](https://github.com/facebook/react/pull/6016))
- Deprecated component instance methods are removed: `setProps`, `replaceProps`, and `getDOMNode`. ([@jimfb](https://github.com/jimfb) in [#5570](https://github.com/facebook/react/pull/5570))
- Deprecated CommonJS `react/addons` entry point is removed. As a reminder, you should use separate `react-addons-*` packages instead. This only applies if you use the CommonJS builds. ([@gaearon](https://github.com/gaearon) in [#6285](https://github.com/facebook/react/pull/6285))
- Passing `children` to void elements like `<input>` was deprecated, and now throws an error. ([@jonhester](https://github.com/jonhester) in [#3372](https://github.com/facebook/react/pull/3372))
- React-specific properties on DOM `refs` (e.g. `this.refs.div.props`) were deprecated, and are removed now. ([@jimfb](https://github.com/jimfb) in [#5495](https://github.com/facebook/react/pull/5495))
### New deprecations, introduced with a warning
Each of these changes will continue to work as before with a new warning until the release of React 16 so you can upgrade your code gradually.
- `LinkedStateMixin` and `valueLink` are now deprecated due to very low popularity. If you need this, you can use a wrapper component that implements the same behavior: [react-linked-input](https://www.npmjs.com/package/react-linked-input). ([@jimfb](https://github.com/jimfb) in [#6127](https://github.com/facebook/react/pull/6127))
- Future versions of React will treat `<input value={null}>` as a request to clear the input. However, React 0.14 has been ignoring `value={null}`. React 15 warns you on a `null` input value and offers you to clarify your intention. To fix the warning, you may explicitly pass an empty string to clear a controlled input, or pass `undefined` to make the input uncontrolled. ([@antoaravinth](https://github.com/antoaravinth) in [#5048](https://github.com/facebook/react/pull/5048))
- `ReactPerf.printDOM()` was renamed to `ReactPerf.printOperations()`, and `ReactPerf.getMeasurementsSummaryMap()` was renamed to `ReactPerf.getWasted()`. ([@gaearon](https://github.com/gaearon) in [#6287](https://github.com/facebook/react/pull/6287))
### New helpful warnings
- If you use a minified copy of the _development_ build, React DOM kindly encourages you to use the faster production build instead. ([@sophiebits](https://github.com/sophiebits) in [#5083](https://github.com/facebook/react/pull/5083))
- React DOM: When specifying a unit-less CSS value as a string, a future version will not add `px` automatically. This version now warns in this case (ex: writing `style={{width: '300'}}`. Unitless *number* values like `width: 300` are unchanged. ([@pluma](https://github.com/pluma) in [#5140](https://github.com/facebook/react/pull/5140))
- Synthetic Events will now warn when setting and accessing properties (which will not get cleared appropriately), as well as warn on access after an event has been returned to the pool. ([@kentcdodds](https://github.com/kentcdodds) in [#5940](https://github.com/facebook/react/pull/5940) and [@koba04](https://github.com/koba04) in [#5947](https://github.com/facebook/react/pull/5947))
- Elements will now warn when attempting to read `ref` and `key` from the props. ([@prometheansacrifice](https://github.com/prometheansacrifice) in [#5744](https://github.com/facebook/react/pull/5744))
- React will now warn if you pass a different `props` object to `super()` in the constructor. ([@prometheansacrifice](https://github.com/prometheansacrifice) in [#5346](https://github.com/facebook/react/pull/5346))
- React will now warn if you call `setState()` inside `getChildContext()`. ([@raineroviir](https://github.com/raineroviir) in [#6121](https://github.com/facebook/react/pull/6121))
- React DOM now attempts to warn for mistyped event handlers on DOM elements, such as `onclick` which should be `onClick`. ([@ali](https://github.com/ali) in [#5361](https://github.com/facebook/react/pull/5361))
- React DOM now warns about `NaN` values in `style`. ([@jontewks](https://github.com/jontewks) in [#5811](https://github.com/facebook/react/pull/5811))
- React DOM now warns if you specify both `value` and `defaultValue` for an input. ([@mgmcdermott](https://github.com/mgmcdermott) in [#5823](https://github.com/facebook/react/pull/5823))
- React DOM now warns if an input switches between being controlled and uncontrolled. ([@TheBlasfem](https://github.com/TheBlasfem) in [#5864](https://github.com/facebook/react/pull/5864))
- React DOM now warns if you specify `onFocusIn` or `onFocusOut` handlers as they are unnecessary in React. ([@jontewks](https://github.com/jontewks) in [#6296](https://github.com/facebook/react/pull/6296))
- React now prints a descriptive error message when you pass an invalid callback as the last argument to `ReactDOM.render()`, `this.setState()`, or `this.forceUpdate()`. ([@conorhastings](https://github.com/conorhastings) in [#5193](https://github.com/facebook/react/pull/5193) and [@gaearon](https://github.com/gaearon) in [#6310](https://github.com/facebook/react/pull/6310))
- Add-Ons: `TestUtils.Simulate()` now prints a helpful message if you attempt to use it with shallow rendering. ([@conorhastings](https://github.com/conorhastings) in [#5358](https://github.com/facebook/react/pull/5358))
- PropTypes: `arrayOf()` and `objectOf()` provide better error messages for invalid arguments. ([@chicoxyzzy](https://github.com/chicoxyzzy) in [#5390](https://github.com/facebook/react/pull/5390))
### Notable bug fixes
- Fixed multiple small memory leaks. ([@sophiebits](https://github.com/sophiebits) in [#4983](https://github.com/facebook/react/pull/4983) and [@victor-homyakov](https://github.com/victor-homyakov) in [#6309](https://github.com/facebook/react/pull/6309))
- Input events are handled more reliably in IE 10 and IE 11; spurious events no longer fire when using a placeholder. ([@jquense](https://github.com/jquense) in [#4051](https://github.com/facebook/react/pull/4051))
- The `componentWillReceiveProps()` lifecycle method is now consistently called when `context` changes. ([@milesj](https://github.com/milesj) in [#5787](https://github.com/facebook/react/pull/5787))
- `React.cloneElement()` doesnt append slash to an existing `key` when used inside `React.Children.map()`. ([@ianobermiller](https://github.com/ianobermiller) in [#5892](https://github.com/facebook/react/pull/5892))
- React DOM now supports the `cite` and `profile` HTML attributes. ([@AprilArcus](https://github.com/AprilArcus) in [#6094](https://github.com/facebook/react/pull/6094) and [@saiichihashimoto](https://github.com/saiichihashimoto) in [#6032](https://github.com/facebook/react/pull/6032))
- React DOM now supports `cssFloat`, `gridRow` and `gridColumn` CSS properties. ([@stevenvachon](https://github.com/stevenvachon) in [#6133](https://github.com/facebook/react/pull/6133) and [@mnordick](https://github.com/mnordick) in [#4779](https://github.com/facebook/react/pull/4779))
- React DOM now correctly handles `borderImageOutset`, `borderImageWidth`, `borderImageSlice`, `floodOpacity`, `strokeDasharray`, and `strokeMiterlimit` as unitless CSS properties. ([@rofrischmann](https://github.com/rofrischmann) in [#6210](https://github.com/facebook/react/pull/6210) and [#6270](https://github.com/facebook/react/pull/6270))
- React DOM now supports the `onAnimationStart`, `onAnimationEnd`, `onAnimationIteration`, `onTransitionEnd`, and `onInvalid` events. Support for `onLoad` has been added to `object` elements. ([@tomduncalf](https://github.com/tomduncalf) in [#5187](https://github.com/facebook/react/pull/5187), [@milesj](https://github.com/milesj) in [#6005](https://github.com/facebook/react/pull/6005), and [@ara4n](https://github.com/ara4n) in [#5781](https://github.com/facebook/react/pull/5781))
- React DOM now defaults to using DOM attributes instead of properties, which fixes a few edge case bugs. Additionally the nullification of values (ex: `href={null}`) now results in the forceful removal, no longer trying to set to the default value used by browsers in the absence of a value. ([@syranide](https://github.com/syranide) in [#1510](https://github.com/facebook/react/pull/1510))
- React DOM does not mistakingly coerce `children` to strings for Web Components. ([@jimfb](https://github.com/jimfb) in [#5093](https://github.com/facebook/react/pull/5093))
- React DOM now correctly normalizes SVG `<use>` events. ([@edmellum](https://github.com/edmellum) in [#5720](https://github.com/facebook/react/pull/5720))
- React DOM does not throw if a `<select>` is unmounted while its `onChange` handler is executing. ([@sambev](https://github.com/sambev) in [#6028](https://github.com/facebook/react/pull/6028))
- React DOM does not throw in Windows 8 apps. ([@Andrew8xx8](https://github.com/Andrew8xx8) in [#6063](https://github.com/facebook/react/pull/6063))
- React DOM does not throw when asynchronously unmounting a child with a `ref`. ([@yiminghe](https://github.com/yiminghe) in [#6095](https://github.com/facebook/react/pull/6095))
- React DOM no longer forces synchronous layout because of scroll position tracking. ([@syranide](https://github.com/syranide) in [#2271](https://github.com/facebook/react/pull/2271))
- `Object.is` is used in a number of places to compare values, which leads to fewer false positives, especially involving `NaN`. In particular, this affects the `shallowCompare` add-on. ([@chicoxyzzy](https://github.com/chicoxyzzy) in [#6132](https://github.com/facebook/react/pull/6132))
- Add-Ons: ReactPerf no longer instruments adding or removing an event listener because they dont really touch the DOM due to event delegation. ([@antoaravinth](https://github.com/antoaravinth) in [#5209](https://github.com/facebook/react/pull/5209))
### Other improvements
- React now uses `loose-envify` instead of `envify` so it installs fewer transitive dependencies. ([@qerub](https://github.com/qerub) in [#6303](https://github.com/facebook/react/pull/6303))
- Shallow renderer now exposes `getMountedInstance()`. ([@glenjamin](https://github.com/glenjamin) in [#4918](https://github.com/facebook/react/pull/4918))
- Shallow renderer now returns the rendered output from `render()`. ([@simonewebdesign](https://github.com/simonewebdesign) in [#5411](https://github.com/facebook/react/pull/5411))
- React no longer depends on ES5 *shams* for `Object.create` and `Object.freeze` in older environments. It still, however, requires ES5 *shims* in those environments. ([@dgreensp](https://github.com/dgreensp) in [#4959](https://github.com/facebook/react/pull/4959))
- React DOM now allows `data-` attributes with names that start with numbers. ([@nLight](https://github.com/nLight) in [#5216](https://github.com/facebook/react/pull/5216))
- React DOM adds a new `suppressContentEditableWarning` prop for components like [Draft.js](https://facebook.github.io/draft-js/) that intentionally manage `contentEditable` children with React. ([@mxstbr](https://github.com/mxstbr) in [#6112](https://github.com/facebook/react/pull/6112))
- React improves the performance for `createClass()` on complex specs. ([@sophiebits](https://github.com/sophiebits) in [#5550](https://github.com/facebook/react/pull/5550))
## 0.14.8 (March 29, 2016)
### React
@@ -88,8 +639,8 @@
### Major changes
- Split the main `react` package into two: `react` and `react-dom`. This paves the way to writing components that can be shared between the web version of React and React Native. This means you will need to include both files and some functions have been moved from `React` to `ReactDOM`.
- Addons have been moved to seperate packages (`react-addons-clone-with-props`, `react-addons-create-fragment`, `react-addons-css-transition-group`, `react-addons-linked-state-mixin`, `react-addons-perf`, `react-addons-pure-render-mixin`, `react-addons-shallow-compare`, `react-addons-test-utils`, `react-addons-transition-group`, `react-addons-update`, `ReactDOM.unstable_batchedUpdates`).
- Stateless functional components - React components were previously created using React.createClass or using ES6 classes. This release adds a [new syntax](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions) where a user defines a single [stateless render function](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions) (with one parameter: `props`) which returns a JSX element, and this function may be used as a component.
- Addons have been moved to separate packages (`react-addons-clone-with-props`, `react-addons-create-fragment`, `react-addons-css-transition-group`, `react-addons-linked-state-mixin`, `react-addons-perf`, `react-addons-pure-render-mixin`, `react-addons-shallow-compare`, `react-addons-test-utils`, `react-addons-transition-group`, `react-addons-update`, `ReactDOM.unstable_batchedUpdates`).
- Stateless functional components - React components were previously created using React.createClass or using ES6 classes. This release adds a [new syntax](https://reactjs.org/docs/reusable-components.html#stateless-functions) where a user defines a single [stateless render function](https://reactjs.org/docs/reusable-components.html#stateless-functions) (with one parameter: `props`) which returns a JSX element, and this function may be used as a component.
- Refs to DOM components as the DOM node itself. Previously the only useful thing you can do with a DOM component is call `getDOMNode()` to get the underlying DOM node. Starting with this release, a ref to a DOM component _is_ the actual DOM node. **Note that refs to custom (user-defined) components work exactly as before; only the built-in DOM components are affected by this change.**
@@ -97,8 +648,8 @@
- `React.initializeTouchEvents` is no longer necessary and has been removed completely. Touch events now work automatically.
- Add-Ons: Due to the DOM node refs change mentioned above, `TestUtils.findAllInRenderedTree` and related helpers are no longer able to take a DOM component, only a custom component.
- The `props` object is now frozen, so mutating props after creating a component element is no longer supported. In most cases, [`React.cloneElement`](https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement) should be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.
- Plain objects are no longer supported as React children; arrays should be used instead. You can use the [`createFragment`](https://facebook.github.io/react/docs/create-fragment.html) helper to migrate, which now returns an array.
- The `props` object is now frozen, so mutating props after creating a component element is no longer supported. In most cases, [`React.cloneElement`](https://reactjs.org/docs/react-api.html#cloneelement) should be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.
- Plain objects are no longer supported as React children; arrays should be used instead. You can use the [`createFragment`](https://reactjs.org/docs/create-fragment.html) helper to migrate, which now returns an array.
- Add-Ons: `classSet` has been removed. Use [classnames](https://github.com/JedWatson/classnames) instead.
- Web components (custom elements) now use native property names. Eg: `class` instead of `className`.
@@ -106,9 +657,9 @@
- `this.getDOMNode()` is now deprecated and `ReactDOM.findDOMNode(this)` can be used instead. Note that in the common case, `findDOMNode` is now unnecessary since a ref to the DOM component is now the actual DOM node.
- `setProps` and `replaceProps` are now deprecated. Instead, call ReactDOM.render again at the top level with the new props.
- ES6 component classes must now extend `React.Component` in order to enable stateless function components. The [ES3 module pattern](https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#other-languages) will continue to work.
- ES6 component classes must now extend `React.Component` in order to enable stateless function components. The [ES3 module pattern](https://reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.html#other-languages) will continue to work.
- Reusing and mutating a `style` object between renders has been deprecated. This mirrors our change to freeze the `props` object.
- Add-Ons: `cloneWithProps` is now deprecated. Use [`React.cloneElement`](https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement) instead (unlike `cloneWithProps`, `cloneElement` does not merge `className` or `style` automatically; you can merge them manually if needed).
- Add-Ons: `cloneWithProps` is now deprecated. Use [`React.cloneElement`](https://reactjs.org/docs/react-api.html#cloneelement) instead (unlike `cloneWithProps`, `cloneElement` does not merge `className` or `style` automatically; you can merge them manually if needed).
- Add-Ons: To improve reliability, `CSSTransitionGroup` will no longer listen to transition events. Instead, you should specify transition durations manually using props such as `transitionEnterTimeout={500}`.
### Notable enhancements
@@ -149,7 +700,7 @@
#### Breaking Changes
- The `react-tools` package and `JSXTransformer.js` browser file [have been deprecated](https://facebook.github.io/react/blog/2015/06/12/deprecating-jstransform-and-react-tools.html). You can continue using version `0.13.3` of both, but we no longer support them and recommend migrating to [Babel](http://babeljs.io/), which has built-in support for React and JSX.
- The `react-tools` package and `JSXTransformer.js` browser file [have been deprecated](https://reactjs.org/blog/2015/06/12/deprecating-jstransform-and-react-tools.html). You can continue using version `0.13.3` of both, but we no longer support them and recommend migrating to [Babel](http://babeljs.io/), which has built-in support for React and JSX.
#### New Features
@@ -202,7 +753,7 @@
#### Bug Fixes
* Immutabilty Helpers: Ensure it supports `hasOwnProperty` as an object key
* Immutability Helpers: Ensure it supports `hasOwnProperty` as an object key
### React Tools
@@ -249,9 +800,9 @@
#### New Features
* Support for using ES6 classes to build React components; see the [v0.13.0 beta 1 notes](https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html) for details.
* Support for using ES6 classes to build React components; see the [v0.13.0 beta 1 notes](https://reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.html) for details.
* Added new top-level API `React.findDOMNode(component)`, which should be used in place of `component.getDOMNode()`. The base class for ES6-based components will not have `getDOMNode`. This change will enable some more patterns moving forward.
* Added a new top-level API `React.cloneElement(el, props)` for making copies of React elements see the [v0.13 RC2 notes](https://facebook.github.io/react/blog/2015/03/03/react-v0.13-rc2.html#react.cloneelement) for more details.
* Added a new top-level API `React.cloneElement(el, props)` for making copies of React elements see the [v0.13 RC2 notes](https://reactjs.org/blog/2015/03/03/react-v0.13-rc2.html#react.cloneelement) for more details.
* New `ref` style, allowing a callback to be used in place of a name: `<Photo ref={(c) => this._photo = c} />` allows you to reference the component with `this._photo` (as opposed to `ref="photo"` which gives `this.refs.photo`).
* `this.setState()` can now take a function as the first argument for transactional state updates, such as `this.setState((state, props) => ({count: state.count + 1}));` this means that you no longer need to use `this._pendingState`, which is now gone.
* Support for iterators and immutable-js sequences as children.
@@ -265,7 +816,7 @@
#### New Features
* [`React.addons.createFragment` was added](https://facebook.github.io/react/docs/create-fragment.html) for adding keys to entire sets of children.
* [`React.addons.createFragment` was added](https://reactjs.org/docs/create-fragment.html) for adding keys to entire sets of children.
#### Deprecations
@@ -491,7 +1042,7 @@
#### New Features
* Added warnings to help migrate towards descriptors
* Made it possible to server render without React-related markup (`data-reactid`, `data-react-checksum`). This DOM will not be mountable by React. [Read the docs for `React.renderComponentToStaticMarkup`](https://facebook.github.io/react/docs/top-level-api.html#react.rendercomponenttostaticmarkup)
* Made it possible to server render without React-related markup (`data-reactid`, `data-react-checksum`). This DOM will not be mountable by React. [Read the docs for `React.renderComponentToStaticMarkup`](https://reactjs.org/docs/top-level-api.html#react.rendercomponenttostaticmarkup)
* Added support for more attributes:
* `srcSet` for `<img>` to specify images at different pixel ratios
* `textAnchor` for SVG
@@ -503,7 +1054,7 @@
### Addons
* `update` function to deal with immutable data. [Read the docs](https://facebook.github.io/react/docs/update.html)
* `update` function to deal with immutable data. [Read the docs](https://reactjs.org/docs/update.html)
### react-tools
* Added an option argument to `transform` function. The only option supported is `harmony`, which behaves the same as `jsx --harmony` on the command line. This uses the ES6 transforms from [jstransform](https://github.com/facebook/jstransform).
@@ -665,7 +1216,7 @@
### React with Addons (New!)
* Introduced a separate build with several "addons" which we think can help improve the React experience. We plan to deprecate this in the long-term, instead shipping each as standalone pieces. [Read more in the docs](https://facebook.github.io/react/docs/addons.html).
* Introduced a separate build with several "addons" which we think can help improve the React experience. We plan to deprecate this in the long-term, instead shipping each as standalone pieces. [Read more in the docs](https://reactjs.org/docs/addons.html).
### JSX
@@ -698,10 +1249,10 @@
* Switch from using `id` attribute to `data-reactid` to track DOM nodes. This allows you to integrate with other JS and CSS libraries more easily.
* Support for more DOM elements and attributes (e.g., `<canvas>`)
* Improved server-side rendering APIs. `React.renderComponentToString(<component>, callback)` allows you to use React on the server and generate markup which can be sent down to the browser.
* `prop` improvements: validation and default values. [Read our blog post for details...](https://facebook.github.io/react/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html)
* Support for the `key` prop, which allows for finer control over reconciliation. [Read the docs for details...](https://facebook.github.io/react/docs/multiple-components.html)
* Removed `React.autoBind`. [Read our blog post for details...](https://facebook.github.io/react/blog/2013/07/02/react-v0-4-autobind-by-default.html)
* Improvements to forms. We've written wrappers around `<input>`, `<textarea>`, `<option>`, and `<select>` in order to standardize many inconsistencies in browser implementations. This includes support for `defaultValue`, and improved implementation of the `onChange` event, and circuit completion. [Read the docs for details...](https://facebook.github.io/react/docs/forms.html)
* `prop` improvements: validation and default values. [Read our blog post for details...](https://reactjs.org/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html)
* Support for the `key` prop, which allows for finer control over reconciliation. [Read the docs for details...](https://reactjs.org/docs/multiple-components.html)
* Removed `React.autoBind`. [Read our blog post for details...](https://reactjs.org/blog/2013/07/02/react-v0-4-autobind-by-default.html)
* Improvements to forms. We've written wrappers around `<input>`, `<textarea>`, `<option>`, and `<select>` in order to standardize many inconsistencies in browser implementations. This includes support for `defaultValue`, and improved implementation of the `onChange` event, and circuit completion. [Read the docs for details...](https://reactjs.org/docs/forms.html)
* We've implemented an improved synthetic event system that conforms to the W3C spec.
* Updates to your component are batched now, which may result in a significantly faster re-render of components. `this.setState` now takes an optional callback as it's second parameter. If you were using `onClick={this.setState.bind(this, state)}` previously, you'll want to make sure you add a third parameter so that the event is not treated as the callback.
@@ -733,14 +1284,14 @@
* Upgrade Commoner so `require` statements are no longer relativized when passing through the transformer. This was a feature needed when building React, but doesn't translate well for other consumers of `bin/jsx`.
* Upgraded our dependencies on Commoner and Recast so they use a different directory for their cache.
* Freeze our esprima dependency.
* Freeze our Esprima dependency.
## 0.3.2 (May 31, 2013)
### JSX
* Improved compatability with other coding styles (specifically, multiple assignments with a single `var`).
* Improved compatibility with other coding styles (specifically, multiple assignments with a single `var`).
### react-tools

View File

@@ -1,100 +1,5 @@
# Contributing to React
React is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on [facebook.com](https://www.facebook.com). We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and answers some questions that you may have.
Want to contribute to React? There are a few things you need to know.
## [Code of Conduct](https://code.facebook.com/codeofconduct)
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
## Our Development Process
Some of the core team will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
### `master` is unsafe
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be.
### Test Suite
Use `grunt test` to run the full test suite with PhantomJS.
This command is just a facade to [Jest](https://facebook.github.io/jest/). You may optionally run `npm install -g jest-cli` and use Jest commands directly to have more control over how tests are executed.
For example, `jest --watch` lets you automatically run the test suite on every file change.
You can also run a subset of tests by passing a prefix to `jest`. For instance, `jest ReactDOMSVG` will only run tests in the files that start with `ReactDOMSVG`, such as `ReactDOMSVG-test.js`.
When you know which tests you want to run, you can achieve a fast feedback loop by using these two features together. For example, `jest ReactDOMSVG --watch` will re-run only the matching tests on every change.
Just make sure to run the whole test suite before submitting a pull request!
### Pull Requests
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
*Before* submitting a pull request, please make sure the following is done…
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes (`grunt test`).
5. Make sure your code lints (`grunt lint`) - we've done our best to make sure these rules match our internal linting guidelines.
6. If you haven't already, complete the CLA.
### Contributor License Agreement (CLA)
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username.
[Complete your CLA here.](https://code.facebook.com/cla)
## Bugs
### Where to Find Known Issues
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist.
### Reporting New Issues
The best way to get your bug fixed is to provide a reduced test case. jsFiddle, jsBin, and other sites provide a way to give live examples. Those are especially helpful though may not work for `JSX`-based code.
### Security Bugs
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
## How to Get in Touch
* IRC - [#reactjs on freenode](https://webchat.freenode.net/?channels=reactjs)
* Discussion forum - [discuss.reactjs.org](https://discuss.reactjs.org/)
## Meeting Notes
React team meets once a week to discuss the development of React, future plans, and priorities.
You can find the meeting notes in a [dedicated repository](https://github.com/reactjs/core-notes/).
## Style Guide
Our linter will catch most styling issues that may exist in your code.
You can check the status of your code styling by simply running: `grunt lint`
However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb's Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction.
### Code Conventions
* Use semicolons `;`
* Commas last `,`
* 2 spaces for indentation (no tabs)
* Prefer `'` over `"`
* `'use strict';`
* 80 character line length
* Write "attractive" code
* Do not use the optional parameters of `setTimeout` and `setInterval`
### Documentation
* Do not wrap lines at 80 characters
## License
By contributing to React, you agree that your contributions will be licensed under its BSD license.
We wrote a **[contribution guide](https://reactjs.org/contributing/how-to-contribute.html)** to help you get started.

View File

@@ -1,160 +0,0 @@
'use strict';
var path = require('path');
var GULP_EXE = 'gulp';
if (process.platform === 'win32') {
GULP_EXE += '.cmd';
}
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: require('./grunt/config/browserify'),
npm: require('./grunt/config/npm'),
clean: [
'./build',
'./*.gem',
'./docs/_site',
'./examples/shared/*.js',
'.module-cache',
],
'compare_size': require('./grunt/config/compare_size'),
});
grunt.config.set('compress', require('./grunt/config/compress'));
function spawnGulp(args, opts, done) {
grunt.util.spawn({
// This could be more flexible (require.resolve & lookup bin in package)
// but if it breaks we'll fix it then.
cmd: path.join('node_modules', '.bin', GULP_EXE),
args: args,
opts: Object.assign({stdio: 'inherit'}, opts),
}, function(err, result, code) {
if (err) {
grunt.fail.fatal('Something went wrong running gulp: ', result);
}
done(code === 0);
});
}
Object.keys(grunt.file.readJSON('package.json').devDependencies)
.filter(function(npmTaskName) {
return npmTaskName.indexOf('grunt-') === 0;
})
.filter(function(npmTaskName) {
return npmTaskName !== 'grunt-cli';
})
.forEach(function(npmTaskName) {
grunt.loadNpmTasks(npmTaskName);
});
grunt.registerTask('eslint', require('./grunt/tasks/eslint'));
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('delete-build-modules', function() {
// Use gulp here.
spawnGulp(['react:clean'], null, this.async());
});
// Our own browserify-based tasks to build a single JS file build.
grunt.registerMultiTask('browserify', require('./grunt/tasks/browserify'));
grunt.registerMultiTask('npm', require('./grunt/tasks/npm'));
var npmReactTasks = require('./grunt/tasks/npm-react');
grunt.registerTask('npm-react:release', npmReactTasks.buildRelease);
grunt.registerTask('npm-react:pack', npmReactTasks.packRelease);
var npmReactDOMTasks = require('./grunt/tasks/npm-react-dom');
grunt.registerTask('npm-react-dom:release', npmReactDOMTasks.buildRelease);
grunt.registerTask('npm-react-dom:pack', npmReactDOMTasks.packRelease);
var npmReactAddonsTasks = require('./grunt/tasks/npm-react-addons');
grunt.registerTask('npm-react-addons:release', npmReactAddonsTasks.buildReleases);
grunt.registerTask('npm-react-addons:pack', npmReactAddonsTasks.packReleases);
grunt.registerTask('version-check', require('./grunt/tasks/version-check'));
grunt.registerTask('build:basic', [
'build-modules',
'version-check',
'browserify:basic',
]);
grunt.registerTask('build:addons', [
'build-modules',
'browserify:addons',
]);
grunt.registerTask('build:min', [
'build-modules',
'version-check',
'browserify:min',
]);
grunt.registerTask('build:addons-min', [
'build-modules',
'browserify:addonsMin',
]);
grunt.registerTask('build:npm-react', [
'version-check',
'build-modules',
'npm-react:release',
]);
grunt.registerTask('build:react-dom', require('./grunt/tasks/react-dom'));
var jestTasks = require('./grunt/tasks/jest');
grunt.registerTask('jest:normal', jestTasks.normal);
grunt.registerTask('jest:coverage', jestTasks.coverage);
grunt.registerTask('test', ['jest:normal']);
grunt.registerTask('npm:test', ['build', 'npm:pack']);
// Optimized build task that does all of our builds. The subtasks will be run
// in order so we can take advantage of that and only run build-modules once.
grunt.registerTask('build', [
'delete-build-modules',
'build-modules',
'version-check',
'browserify:basic',
'browserify:addons',
'browserify:min',
'browserify:addonsMin',
'build:react-dom',
'npm-react:release',
'npm-react:pack',
'npm-react-dom:release',
'npm-react-dom:pack',
'npm-react-addons:release',
'npm-react-addons:pack',
'compare_size',
]);
// Automate the release!
var releaseTasks = require('./grunt/tasks/release');
grunt.registerTask('release:setup', releaseTasks.setup);
grunt.registerTask('release:bower', releaseTasks.bower);
grunt.registerTask('release:docs', releaseTasks.docs);
grunt.registerTask('release:msg', releaseTasks.msg);
grunt.registerTask('release:starter', releaseTasks.starter);
grunt.registerTask('release', [
'release:setup',
'clean',
'build',
'release:bower',
'release:starter',
'compress',
'release:docs',
'release:msg',
]);
grunt.registerTask('build-modules', function() {
spawnGulp(['react:modules'], null, this.async());
});
// The default task - build - to keep setup easy.
grunt.registerTask('default', ['build']);
};

42
LICENSE
View File

@@ -1,31 +1,21 @@
BSD License
For React software
MIT License
Copyright (c) 2013-present, Facebook, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,393 +0,0 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.

View File

@@ -1,9 +0,0 @@
The examples provided by Facebook are for non-commercial testing and evaluation
purposes only. Facebook reserves all rights not expressly granted.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

33
PATENTS
View File

@@ -1,33 +0,0 @@
Additional Grant of Patent Rights Version 2
"Software" means the React software distributed by Facebook, Inc.
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
(subject to the termination provision below) license under any Necessary
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
transfer the Software. For avoidance of doubt, no license is granted under
Facebook's rights in any patent claims that are infringed by (i) modifications
to the Software made by you or any third party or (ii) the Software in
combination with any software or other technology.
The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.
A "Necessary Claim" is a claim of a patent owned by Facebook that is
necessarily infringed by the Software standing alone.
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.

118
README.md
View File

@@ -1,25 +1,37 @@
# [React](https://facebook.github.io/react/) [![Build Status](https://img.shields.io/travis/facebook/react/master.svg?style=flat)](https://travis-ci.org/facebook/react) [![Coverage Status](https://img.shields.io/coveralls/facebook/react/master.svg?style=flat)](https://coveralls.io/github/facebook/react?branch=master) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
# [React](https://reactjs.org/) &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebook/react/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) [![Coverage Status](https://img.shields.io/coveralls/facebook/react/master.svg?style=flat)](https://coveralls.io/github/facebook/react?branch=master) [![CircleCI Status](https://circleci.com/gh/facebook/react.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/facebook/react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
React is a JavaScript library for building user interfaces.
* **Just the UI:** Lots of people use React as the V in MVC. Since React makes no assumptions about the rest of your technology stack, it's easy to try it out on a small feature in an existing project.
* **Virtual DOM:** React abstracts away the DOM from you, giving a simpler programming model and better performance. React can also render on the server using Node, and it can power native apps using [React Native](https://facebook.github.io/react-native/).
* **Data flow:** React implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding.
* **Declarative:** React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
* **Component-Based:** Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
* **Learn Once, Write Anywhere:** We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using [React Native](https://facebook.github.io/react-native/).
**NEW**! Check out our newest project [React Native](https://github.com/facebook/react-native), which uses React and JavaScript to create native mobile apps.
[Learn how to use React in your own project](https://reactjs.org/docs/getting-started.html).
[Learn how to use React in your own project](https://facebook.github.io/react/docs/getting-started.html).
## Documentation
You can find the React documentation [on the website](https://reactjs.org/docs).
It is divided into several sections:
* [Quick Start](https://reactjs.org/docs/hello-world.html)
* [Advanced Guides](https://reactjs.org/docs/jsx-in-depth.html)
* [API Reference](https://reactjs.org/docs/react-api.html)
* [Tutorial](https://reactjs.org/tutorial/tutorial.html)
* [Where to Get Support](https://reactjs.org/community/support.html)
* [Contributing Guide](https://reactjs.org/docs/how-to-contribute.html)
You can improve it by sending pull requests to [this repository](https://github.com/reactjs/reactjs.org).
## Examples
We have several examples [on the website](https://facebook.github.io/react/). Here is the first one to get you started:
We have several examples [on the website](https://reactjs.org/). Here is the first one to get you started:
```js
var HelloMessage = React.createClass({
render: function() {
```jsx
class HelloMessage extends React.Component {
render() {
return <div>Hello {this.props.name}</div>;
}
});
}
ReactDOM.render(
<HelloMessage name="John" />,
@@ -29,88 +41,36 @@ ReactDOM.render(
This example will render "Hello John" into a container on the page.
You'll notice that we used an HTML-like syntax; [we call it JSX](https://facebook.github.io/react/docs/jsx-in-depth.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. A simple transform is included with React that allows converting JSX into native JavaScript for browsers to digest.
You'll notice that we used an HTML-like syntax; [we call it JSX](https://reactjs.org/docs/introducing-jsx.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. We recommend using [Babel](https://babeljs.io/) with a [React preset](https://babeljs.io/docs/plugins/preset-react/) to convert JSX into native JavaScript for browsers to digest.
## Installation
The fastest way to get started is to serve JavaScript from the CDN (also available on [cdnjs](https://cdnjs.com/libraries/react) and [jsdelivr](https://www.jsdelivr.com/projects/react)):
React is available as the `react` package on [npm](https://www.npmjs.com/). It is also available on a [CDN](https://reactjs.org/docs/installation.html#using-a-cdn).
```html
<!-- The core React library -->
<script src="https://fb.me/react-0.14.8.js"></script>
<!-- The ReactDOM Library -->
<script src="https://fb.me/react-dom-0.14.8.js"></script>
```
React is flexible and can be used in a variety of projects. You can create new apps with it, but you can also gradually introduce it into an existing codebase without doing a rewrite.
We've also built a [starter kit](https://facebook.github.io/react/downloads/react-0.14.8.zip) which might be useful if this is your first time using React. It includes a webpage with an example of using React with live code.
The recommended way to install React depends on your project. Here you can find short guides for the most common scenarios:
If you'd like to use [bower](http://bower.io), it's as easy as:
* [Trying Out React](https://reactjs.org/docs/installation.html#trying-out-react)
* [Creating a New Application](https://reactjs.org/docs/installation.html#creating-a-new-application)
* [Adding React to an Existing Application](https://reactjs.org/docs/installation.html#adding-react-to-an-existing-application)
```sh
bower install --save react
```
## Contributing
And it's just as easy with [npm](http://npmjs.com):
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. Development of React happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving React.
```sh
npm i --save react
```
### [Code of Conduct](https://code.facebook.com/codeofconduct)
## Contribute
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. If you're interested in helping with that, then keep reading. If you're not interested in helping right now that's ok too. :) Any feedback you have about using React would be greatly appreciated.
### [Contributing Guide](https://reactjs.org/contributing/how-to-contribute.html)
### Building Your Copy of React
Read our [contributing guide](https://reactjs.org/contributing/how-to-contribute.html) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React.
The process to build `react.js` is built entirely on top of node.js, using many libraries you may already be familiar with.
#### Prerequisites
* You have `node` installed at v4.0.0+ and `npm` at v2.0.0+.
* You are familiar with `npm` and know whether or not you need to use `sudo` when installing packages globally.
* You are familiar with `git`.
#### Build
Once you have the repository cloned, building a copy of `react.js` is really easy.
```sh
# grunt-cli is needed by grunt; you might have this installed already
npm install -g grunt-cli
npm install
grunt build
```
At this point, you should now have a `build/` directory populated with everything you need to use React. The examples should all work.
### Grunt
We use grunt to automate many tasks. Run `grunt -h` to see a mostly complete listing. The important ones to know:
```sh
# Build and run tests with PhantomJS
grunt test
# Lint the code with ESLint
grunt lint
# Wipe out build directory
grunt clean
```
### Good First Bug
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first bugs](https://github.com/facebook/react/labels/good%20first%20bug) that contain bugs which are fairly easy to fix. This is a great place to get started.
### Beginner Friendly Bugs
To help you get your feet wet and get you familiar with our contribution process, we have a list of [beginner friendly bugs](https://github.com/facebook/react/labels/Difficulty%3A%20beginner) that contain bugs which are fairly easy to fix. This is a great place to get started.
### License
React is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).
React documentation is [Creative Commons licensed](./LICENSE-docs).
Examples provided in this repository and in the documentation are [separately licensed](./LICENSE-examples).
### More…
There's only so much we can cram in here. To read more about the community and guidelines for submitting pull requests, please read the [Contributing document](CONTRIBUTING.md).
## Troubleshooting
See the [Troubleshooting Guide](https://github.com/facebook/react/wiki/Troubleshooting)
React is [MIT licensed](./LICENSE).

40
circle.yml Normal file
View File

@@ -0,0 +1,40 @@
---
machine:
timezone: America/Los_Angeles
node:
version: 8
ruby:
version: 2.2.3
environment:
TRAVIS_REPO_SLUG: facebook/react
YARN_VERSION: 1.2.1
PATH: "${PATH}:${HOME}/.yarn/bin"
dependencies:
pre:
# This is equivalent to $TRAVIS_COMMIT_RANGE
- echo $CIRCLE_COMPARE_URL | cut -d/ -f7
# install yarn if it's not already installed
- |
if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
fi
override:
- yarn install
- scripts/circleci/set_up_github_keys.sh
post:
# - npm ls --depth=0
cache_directories:
- ~/.yarn
- ~/.yarn-cache
test:
override:
- ./scripts/circleci/test_entry_point.sh:
parallel: true
deployment:
staging:
branch: /.*/
commands:
- ./scripts/circleci/upload_build.sh

View File

@@ -1,8 +0,0 @@
---
layout: single
title: Page Not Found
---
We couldn't find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

View File

@@ -1,19 +0,0 @@
source 'https://rubygems.org'
gem 'rake'
# jekyll, which builds it all
# 2.0 includes sass processing
gem 'jekyll', '~>2.0'
# Auto redirect pages
gem 'jekyll-redirect-from'
# JSON
gem 'json'
# For `rake watch`
gem 'rb-fsevent'
# For markdown header cleanup
gem 'sanitize', '~>2.0'

View File

@@ -1,85 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
blankslate (2.1.2.4)
celluloid (0.15.2)
timers (~> 1.1.0)
classifier (1.3.4)
fast-stemmer (>= 1.0.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.7.1)
colorator (0.1)
execjs (2.2.1)
fast-stemmer (1.0.2)
ffi (1.9.3)
jekyll (2.2.0)
classifier (~> 1.3)
colorator (~> 0.1)
jekyll-coffeescript (~> 1.0)
jekyll-gist (~> 1.0)
jekyll-paginate (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.0)
kramdown (~> 1.3)
liquid (~> 2.6.1)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
safe_yaml (~> 1.0)
toml (~> 0.1.0)
jekyll-coffeescript (1.0.0)
coffee-script (~> 2.2)
jekyll-gist (1.1.0)
jekyll-paginate (1.0.0)
jekyll-redirect-from (0.5.0)
jekyll (~> 2.0)
jekyll-sass-converter (1.2.0)
sass (~> 3.2)
jekyll-watch (1.1.0)
listen (~> 2.7)
json (1.8.1)
kramdown (1.4.1)
liquid (2.6.1)
listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
mercenary (0.3.4)
mini_portile (0.6.0)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.9)
pygments.rb (0.6.0)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
redcarpet (3.1.2)
safe_yaml (1.0.4)
sanitize (2.0.6)
nokogiri (>= 1.4.4)
sass (3.3.14)
timers (1.1.0)
toml (0.1.1)
parslet (~> 1.5.0)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
jekyll (~> 2.0)
jekyll-redirect-from
json
rake
rb-fsevent
sanitize (~> 2.0)
BUNDLED WITH
1.10.1

View File

@@ -1,67 +0,0 @@
# React Documentation & Website
We use [Jekyll](http://jekyllrb.com/) to build the site using ([mostly](http://zpao.com/posts/adding-line-highlights-to-markdown-code-fences/)) Markdown, and we host it by pushing HTML to [GitHub Pages](http://pages.github.com/).
## Installation
If you are working on the site, you will want to install and run a local copy of it.
### Dependencies
In order to use Jekyll, you will need to have Ruby installed.
- [Ruby](http://www.ruby-lang.org/) (version >= 1.8.7)
- [RubyGems](http://rubygems.org/) (version >= 1.3.7)
- [Bundler](http://gembundler.com/)
Mac OS X comes pre-installed with Ruby, but you may need to update RubyGems (via `gem update --system`).
Otherwise, [RVM](https://rvm.io/) and [rbenv](https://github.com/sstephenson/rbenv) are popular ways to install Ruby.
Once you have RubyGems and installed Bundler (via `gem install bundler`), use it to install the dependencies:
```sh
$ cd react/docs
$ bundle install # Might need sudo.
$ npm install
```
### Instructions
The site requires React, so first make sure you've built the project (via `grunt`).
Use Jekyll to serve the website locally (by default, at `http://localhost:4000`):
```sh
$ cd react/docs
$ bundle exec rake
$ bundle exec jekyll serve -w
$ open http://localhost:4000/react/
```
We use [SASS](http://sass-lang.com/) (with [Bourbon](http://bourbon.io/)) for our CSS, and we use JSX to transform some of our JS.
If you only want to modify the HTML or Markdown, you do not have to do anything because we package pre-compiled copies of the CSS and JS.
If you want to modify the CSS or JS, use [Rake](http://rake.rubyforge.org/) to compile them:
```sh
$ cd react/docs
$ bundle exec rake watch # Automatically compiles as needed.
# bundle exec rake Manually compile CSS and JS.
# bundle exec rake js Manually compile JS, only.
```
## Afterthoughts
### Updating `facebook.github.io/react`
The easiest way to do this is to have a separate clone of this repository, checked out to the `gh-pages` branch. We have a build step that expects this to be in a directory named `react-gh-pages` at the same depth as `react`. Then it's just a matter of running `grunt docs`, which will compile the site and copy it out to this repository. From there, you can check it in.
**Note:** This should only be done for new releases. You should create a tag corresponding to the release tag in the main repository.
We also have a rake task that does the same thing (without creating commits). It expects the directory structure mentioned above.
```sh
$ bundle exec rake release
```
### Removing the Jekyll / Ruby Dependency
In an ideal world, we would not be adding a Ruby dependency on part of our project. We would like to move towards a point where we are using React to render the website.

View File

@@ -1,69 +0,0 @@
require('rubygems')
require('json')
require('yaml')
require('open-uri')
desc "download babel-browser"
task :fetch_remotes do
IO.copy_stream(
open('https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js'),
'js/babel-browser.min.js'
)
end
desc "generate js from jsx"
task :js do
system "../node_modules/.bin/babel _js --out-dir=js"
end
desc "watch js"
task :watch do
Process.spawn "../node_modules/.bin/babel _js --out-dir=js --watch"
Process.waitall
end
desc "update version to match ../package.json"
task :update_version do
react_version = JSON.parse(File.read('../package.json'))['version']
site_config = YAML.load_file('_config.yml')
if site_config['react_version'] != react_version
site_config['react_version'] = react_version
File.open('_config.yml', 'w+') { |f| f.write(site_config.to_yaml) }
end
end
desc "update SRI hashes"
task :update_hashes do
map = {
'react.js' => 'dev',
'react.min.js' => 'prod',
'react-with-addons.js' => 'addons_dev',
'react-with-addons.min.js' => 'addons_prod',
'react-dom.js' => 'dom_dev',
'react-dom.min.js' => 'dom_prod',
'react-dom-server.js' => 'dom_server_dev',
'react-dom-server.min.js' => 'dom_server_prod'
}
site_config = YAML.load_file('_config.yml')
map.each do |file, key|
site_config['react_hashes'][key] = `openssl dgst -sha384 -binary ../../react-bower/#{file} | openssl base64 -A`
end
File.open('_config.yml', 'w+') { |f| f.write(site_config.to_yaml) }
end
desc "update acknowledgements list"
task :update_acknowledgements do
authors = File.readlines('../AUTHORS').map {|author| author.gsub(/ <.*\n/,'')}
# split into cols here because nobody knows how to use liquid
# need to to_f because ruby will keep slice_size as int and round on its own
slice_size = (authors.size / 3.to_f).ceil
cols = authors.each_slice(slice_size).to_a
File.open('_data/acknowledgements.yml', 'w+') { |f| f.write(cols.to_yaml) }
end
desc "build into ../../react-gh-pages"
task :release => [:update_version, :js, :fetch_remotes] do
system "jekyll build -d ../../react-gh-pages"
end
task :default => [:js]

View File

@@ -1,48 +0,0 @@
---
name: React
description: A JavaScript library for building user interfaces
url: https://facebook.github.io
baseurl: "/react"
permalink: "/blog/:year/:month/:day/:title.html"
paginate_path: "/blog/page:num/"
relative_permalinks: true
paginate: 5
timezone: America/Los_Angeles
highlighter: pygments
defaults:
- scope:
path: ''
type: post
values:
layout: post
- scope:
path: docs
type: page
values:
layout: docs
exclude:
- Gemfile
- Gemfile.lock
- README.md
- Rakefile
- vendor/bundle
markdown: redcarpet
redcarpet:
extensions:
- fenced_code_blocks
- footnotes
sass:
style: :compressed
sass_dir: _css
gems:
- jekyll-redirect-from
react_version: 0.14.7
react_hashes:
dev: xQae1pUPdAKUe0u0KUTNt09zzdwheX4VSUsV8vatqM+t6X7rta01qOzessL808ox
prod: zTm/dblzLXQNp3CgY+hfaC/WJ6h4XtNrePh2CW2+rO9GPuNiPb9jmthvAL+oI/dQ
addons_dev: I5TF2q2QDmB31aN5lcClArdUo+WJH/Yi3hcH3PBVXFe5DYtYCFh7Jx/dmpba12zn
addons_prod: KPHTQfiYMhtsIRbZcY4ri1lBYZQbj4ePsSdzODR2Bu5L5ts3APVyqwKPBThO5Hgc
dom_dev: A1t0GCrR06cTHvMjaxeSE8XOiz6j7NvWdmxhN/9z748wEvJTVk13Rr8gMzTUnd8G
dom_prod: ntqCsHbLdMxT352UbhPbT7fqjE8xi4jLmQYQa8mYR+ylAapbXRfdsDweueDObf7m
dom_server_dev: 3I5+eGB/ILYa6pQQX+rM9O0SyDltamM40RiZ5JvIijSYEfVGZU0vY4Iwx9a1eYyD
dom_server_prod: Kt9dEqXzv00orFPW2o3H+kxQtSiNO8EqXsXJT3i99rCcp74N/Km98V0kUxAzy44k

View File

@@ -1,173 +0,0 @@
html * {
color-profile: sRGB;
rendering-intent: auto;
}
.cm-s-solarized-light {
background-color: #f8f5ec;
color: #637c84;
}
.cm-s-solarized-light .emphasis {
font-weight: bold;
}
.cm-s-solarized-light .dotted {
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-light .CodeMirror-gutter {
background-color: #eee8d5;
border-right: 3px solid #eee8d5;
}
.cm-s-solarized-light .CodeMirror-gutter .CodeMirror-gutter-text {
color: #93a1a1;
}
.cm-s-solarized-light .CodeMirror-cursor {
border-left-color: #002b36 !important;
}
.cm-s-solarized-light .CodeMirror-matchingbracket {
color: #002b36;
background-color: #eee8d5;
box-shadow: 0 0 10px #eee8d5;
font-weight: bold;
}
.cm-s-solarized-light .CodeMirror-nonmatchingbracket {
color: #002b36;
background-color: #eee8d5;
box-shadow: 0 0 10px #eee8d5;
font-weight: bold;
color: #dc322f;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-light span.cm-keyword {
color: #268bd2;
}
.cm-s-solarized-light span.cm-atom {
color: #2aa198;
}
.cm-s-solarized-light span.cm-number {
color: #586e75;
}
.cm-s-solarized-light span.cm-def {
color: #637c84;
}
.cm-s-solarized-light span.cm-variable {
color: #637c84;
}
.cm-s-solarized-light span.cm-variable-2 {
color: #b58900;
}
.cm-s-solarized-light span.cm-variable-3 {
color: #cb4b16;
}
.cm-s-solarized-light span.cm-comment {
color: #93a1a1;
}
.cm-s-solarized-light span.cm-property {
color: #637c84;
}
.cm-s-solarized-light span.cm-operator {
color: #657b83;
}
.cm-s-solarized-light span.cm-string {
color: #36958e;
}
.cm-s-solarized-light span.cm-error {
font-weight: bold;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-light span.cm-bracket {
color: #cb4b16;
}
.cm-s-solarized-light span.cm-tag {
color: #657b83;
}
.cm-s-solarized-light span.cm-attribute {
color: #586e75;
font-weight: bold;
}
.cm-s-solarized-light span.cm-meta {
color: #268bd2;
}
.cm-s-solarized-dark {
background-color: #002b36;
color: #839496;
}
.cm-s-solarized-dark .emphasis {
font-weight: bold;
}
.cm-s-solarized-dark .dotted {
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-dark .CodeMirror-gutter {
background-color: #073642;
border-right: 3px solid #073642;
}
.cm-s-solarized-dark .CodeMirror-gutter .CodeMirror-gutter-text {
color: #586e75;
}
.cm-s-solarized-dark .CodeMirror-cursor {
border-left-color: #fdf6e3 !important;
}
.cm-s-solarized-dark .CodeMirror-matchingbracket {
color: #fdf6e3;
background-color: #073642;
box-shadow: 0 0 10px #073642;
font-weight: bold;
}
.cm-s-solarized-dark .CodeMirror-nonmatchingbracket {
color: #fdf6e3;
background-color: #073642;
box-shadow: 0 0 10px #073642;
font-weight: bold;
color: #dc322f;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-dark span.cm-keyword {
color: #839496;
font-weight: bold;
}
.cm-s-solarized-dark span.cm-atom {
color: #2aa198;
}
.cm-s-solarized-dark span.cm-number {
color: #93a1a1;
}
.cm-s-solarized-dark span.cm-def {
color: #268bd2;
}
.cm-s-solarized-dark span.cm-variable {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-variable-2 {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-variable-3 {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-comment {
color: #586e75;
}
.cm-s-solarized-dark span.cm-property {
color: #b58900;
}
.cm-s-solarized-dark span.cm-operator {
color: #839496;
}
.cm-s-solarized-dark span.cm-string {
color: #6c71c4;
}
.cm-s-solarized-dark span.cm-error {
font-weight: bold;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-dark span.cm-bracket {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-tag {
color: #839496;
}
.cm-s-solarized-dark span.cm-attribute {
color: #93a1a1;
font-weight: bold;
}
.cm-s-solarized-dark span.cm-meta {
color: #268bd2;
}

View File

@@ -1,133 +0,0 @@
@import 'variables.scss';
$textColor: $mediumColor;
$textColorLight: lighten($textColor, 20%);
html {
font-family: $helvetica;
font-family: proxima-nova, $helvetica;
color: $textColor;
line-height: 1.28;
}
p {
margin: 0 0 10px;
}
.subHeader {
font-size: 21px;
font-weight: 200;
line-height: 30px;
margin-bottom: 10px;
}
em {
font-style: italic;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 10px 0;
font-family: inherit;
font-weight: bold;
line-height: 20px;
color: inherit;
text-rendering: optimizelegibility;
}
h1 small,
h2 small,
h3 small,
h4 small,
h5 small,
h6 small {
font-weight: normal;
color: $textColorLight
}
h1,
h2,
h3 {
line-height: 40px;
}
h1 {
font-size: 39px;
}
h2 {
font-size: 31px;
}
h3 {
font-size: 23px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 11px;
}
h1 small {
font-size: 24px;
}
h2 small {
font-size: 18px;
}
h3 small {
font-size: 16px;
}
h4 small {
font-size: 14px;
}
ul,
ol {
margin: 0 0 10px 25px;
padding: 0;
}
ul ul,
ul ol,
ol ol,
ol ul {
margin-bottom: 0;
}
li {
line-height: 20px;
}
a {
color: $linkColor;
text-decoration: none;
&:hover,
&:focus {
color: $linkInteract;
text-decoration: underline;
}
&:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
}
.center {
text-align: center;
}

View File

@@ -1,22 +0,0 @@
$primary: #cc7a6f;
$linkColor: darken($primary, 9%);
$linkInteract: darken($linkColor, 9%);
$pageBg: #f9f9f9;
$lightColor: #e9e9e9;
$mediumestColor: #666;
$mediumColor: #484848;
$darkColor: #2d2d2d;
$darkestColor: #222222;
$blueColor: #61dafb;
$orangeColor: complement($blueColor);
$lightTextColor: #fafafa;
$mediumTextColor: #aaa;
$darkTextColor: $mediumColor;
$buttonBlueTop: #77a3d2;
$buttonBlueBottom: #4783c2;
$buttonGreyTop: #9a9a9a;
$buttonGreyBottom: #646464;

View File

@@ -1,8 +0,0 @@
//************************************************************************//
// These mixins/functions are deprecated
// They will be removed in the next MAJOR version release
//************************************************************************//
@mixin inline-block {
display: inline-block;
@warn "inline-block mixin is deprecated and will be removed in the next major version release";
}

View File

@@ -1,79 +0,0 @@
// Settings
@import "settings/prefixer";
@import "settings/px-to-em";
@import "settings/asset-pipeline";
// Custom Helpers
@import "helpers/convert-units";
@import "helpers/gradient-positions-parser";
@import "helpers/is-num";
@import "helpers/linear-angle-parser";
@import "helpers/linear-gradient-parser";
@import "helpers/linear-positions-parser";
@import "helpers/linear-side-corner-parser";
@import "helpers/radial-arg-parser";
@import "helpers/radial-positions-parser";
@import "helpers/radial-gradient-parser";
@import "helpers/render-gradients";
@import "helpers/shape-size-stripper";
@import "helpers/str-to-num";
// Custom Functions
@import "functions/assign";
@import "functions/color-lightness";
@import "functions/flex-grid";
@import "functions/golden-ratio";
@import "functions/grid-width";
@import "functions/modular-scale";
@import "functions/px-to-em";
@import "functions/px-to-rem";
@import "functions/strip-units";
@import "functions/tint-shade";
@import "functions/transition-property-name";
@import "functions/unpack";
// CSS3 Mixins
@import "css3/animation";
@import "css3/appearance";
@import "css3/backface-visibility";
@import "css3/background";
@import "css3/background-image";
@import "css3/border-image";
@import "css3/border-radius";
@import "css3/box-sizing";
@import "css3/calc";
@import "css3/columns";
@import "css3/filter";
@import "css3/flex-box";
@import "css3/font-face";
@import "css3/font-feature-settings";
@import "css3/hyphens";
@import "css3/hidpi-media-query";
@import "css3/image-rendering";
@import "css3/keyframes";
@import "css3/linear-gradient";
@import "css3/perspective";
@import "css3/radial-gradient";
@import "css3/transform";
@import "css3/transition";
@import "css3/user-select";
@import "css3/placeholder";
// Addons & other mixins
@import "addons/button";
@import "addons/clearfix";
@import "addons/directional-values";
@import "addons/ellipsis";
@import "addons/font-family";
@import "addons/hide-text";
@import "addons/html5-input-types";
@import "addons/position";
@import "addons/prefixer";
@import "addons/retina-image";
@import "addons/size";
@import "addons/timing-functions";
@import "addons/triangle";
@import "addons/word-wrap";
// Soon to be deprecated Mixins
@import "bourbon-deprecated-upcoming";

View File

@@ -1,374 +0,0 @@
@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) {
@if type-of($style) == string and type-of($base-color) == color {
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == string and type-of($base-color) == number {
$padding: $text-size;
$text-size: $base-color;
$base-color: #4294f0;
@if $padding == inherit {
$padding: 7px 18px;
}
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == color and type-of($base-color) == color {
$base-color: $style;
$style: simple;
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == color and type-of($base-color) == number {
$padding: $text-size;
$text-size: $base-color;
$base-color: $style;
$style: simple;
@if $padding == inherit {
$padding: 7px 18px;
}
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == number {
$padding: $base-color;
$text-size: $style;
$base-color: #4294f0;
$style: simple;
@if $padding == #4294f0 {
$padding: 7px 18px;
}
@include buttonstyle($style, $base-color, $text-size, $padding);
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
// Selector Style Button
//************************************************************************//
@mixin buttonstyle($type, $b-color, $t-size, $pad) {
// Grayscale button
@if $type == simple and $b-color == grayscale($b-color) {
@include simple($b-color, true, $t-size, $pad);
}
@if $type == shiny and $b-color == grayscale($b-color) {
@include shiny($b-color, true, $t-size, $pad);
}
@if $type == pill and $b-color == grayscale($b-color) {
@include pill($b-color, true, $t-size, $pad);
}
@if $type == flat and $b-color == grayscale($b-color) {
@include flat($b-color, true, $t-size, $pad);
}
// Colored button
@if $type == simple {
@include simple($b-color, false, $t-size, $pad);
}
@else if $type == shiny {
@include shiny($b-color, false, $t-size, $pad);
}
@else if $type == pill {
@include pill($b-color, false, $t-size, $pad);
}
@else if $type == flat {
@include flat($b-color, false, $t-size, $pad);
}
}
// Simple Button
//************************************************************************//
@mixin simple($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
$border: adjust-color($base-color, $saturation: 9%, $lightness: -14%);
$inset-shadow: adjust-color($base-color, $saturation: -8%, $lightness: 15%);
$stop-gradient: adjust-color($base-color, $saturation: 9%, $lightness: -11%);
$text-shadow: adjust-color($base-color, $saturation: 15%, $lightness: -18%);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%);
}
@if $grayscale == true {
$border: grayscale($border);
$inset-shadow: grayscale($inset-shadow);
$stop-gradient: grayscale($stop-gradient);
$text-shadow: grayscale($text-shadow);
}
border: 1px solid $border;
border-radius: 3px;
box-shadow: inset 0 1px 0 0 $inset-shadow;
color: $color;
display: inline-block;
font-size: $textsize;
font-weight: bold;
@include linear-gradient ($base-color, $stop-gradient);
padding: $padding;
text-decoration: none;
text-shadow: 0 1px 0 $text-shadow;
background-clip: padding-box;
&:hover:not(:disabled) {
$base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%);
$inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%);
$stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%);
@if $grayscale == true {
$base-color-hover: grayscale($base-color-hover);
$inset-shadow-hover: grayscale($inset-shadow-hover);
$stop-gradient-hover: grayscale($stop-gradient-hover);
}
box-shadow: inset 0 1px 0 0 $inset-shadow-hover;
cursor: pointer;
@include linear-gradient ($base-color-hover, $stop-gradient-hover);
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$border-active: adjust-color($base-color, $saturation: 9%, $lightness: -14%);
$inset-shadow-active: adjust-color($base-color, $saturation: 7%, $lightness: -17%);
@if $grayscale == true {
$border-active: grayscale($border-active);
$inset-shadow-active: grayscale($inset-shadow-active);
}
border: 1px solid $border-active;
box-shadow: inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active;
}
}
// Shiny Button
//************************************************************************//
@mixin shiny($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
$border: adjust-color($base-color, $red: -117, $green: -111, $blue: -81);
$border-bottom: adjust-color($base-color, $red: -126, $green: -127, $blue: -122);
$fourth-stop: adjust-color($base-color, $red: -79, $green: -70, $blue: -46);
$inset-shadow: adjust-color($base-color, $red: 37, $green: 29, $blue: 12);
$second-stop: adjust-color($base-color, $red: -56, $green: -50, $blue: -33);
$text-shadow: adjust-color($base-color, $red: -140, $green: -141, $blue: -114);
$third-stop: adjust-color($base-color, $red: -86, $green: -75, $blue: -48);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%);
}
@if $grayscale == true {
$border: grayscale($border);
$border-bottom: grayscale($border-bottom);
$fourth-stop: grayscale($fourth-stop);
$inset-shadow: grayscale($inset-shadow);
$second-stop: grayscale($second-stop);
$text-shadow: grayscale($text-shadow);
$third-stop: grayscale($third-stop);
}
border: 1px solid $border;
border-bottom: 1px solid $border-bottom;
border-radius: 5px;
box-shadow: inset 0 1px 0 0 $inset-shadow;
color: $color;
display: inline-block;
font-size: $textsize;
font-weight: bold;
@include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%);
padding: $padding;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 1px $text-shadow;
&:hover:not(:disabled) {
$first-stop-hover: adjust-color($base-color, $red: -13, $green: -15, $blue: -18);
$second-stop-hover: adjust-color($base-color, $red: -66, $green: -62, $blue: -51);
$third-stop-hover: adjust-color($base-color, $red: -93, $green: -85, $blue: -66);
$fourth-stop-hover: adjust-color($base-color, $red: -86, $green: -80, $blue: -63);
@if $grayscale == true {
$first-stop-hover: grayscale($first-stop-hover);
$second-stop-hover: grayscale($second-stop-hover);
$third-stop-hover: grayscale($third-stop-hover);
$fourth-stop-hover: grayscale($fourth-stop-hover);
}
cursor: pointer;
@include linear-gradient(top, $first-stop-hover 0%,
$second-stop-hover 50%,
$third-stop-hover 50%,
$fourth-stop-hover 100%);
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$inset-shadow-active: adjust-color($base-color, $red: -111, $green: -116, $blue: -122);
@if $grayscale == true {
$inset-shadow-active: grayscale($inset-shadow-active);
}
box-shadow: inset 0 0 20px 0 $inset-shadow-active;
}
}
// Pill Button
//************************************************************************//
@mixin pill($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
$border-bottom: adjust-color($base-color, $hue: 8, $saturation: -11%, $lightness: -26%);
$border-sides: adjust-color($base-color, $hue: 4, $saturation: -21%, $lightness: -21%);
$border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%);
$inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 7%);
$stop-gradient: adjust-color($base-color, $hue: 8, $saturation: 14%, $lightness: -10%);
$text-shadow: adjust-color($base-color, $hue: 5, $saturation: -19%, $lightness: -15%);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%);
}
@if $grayscale == true {
$border-bottom: grayscale($border-bottom);
$border-sides: grayscale($border-sides);
$border-top: grayscale($border-top);
$inset-shadow: grayscale($inset-shadow);
$stop-gradient: grayscale($stop-gradient);
$text-shadow: grayscale($text-shadow);
}
border: 1px solid $border-top;
border-color: $border-top $border-sides $border-bottom;
border-radius: 16px;
box-shadow: inset 0 1px 0 0 $inset-shadow;
color: $color;
display: inline-block;
font-size: $textsize;
font-weight: normal;
line-height: 1;
@include linear-gradient ($base-color, $stop-gradient);
padding: $padding;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 1px $text-shadow;
background-clip: padding-box;
&:hover:not(:disabled) {
$base-color-hover: adjust-color($base-color, $lightness: -4.5%);
$border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%);
$border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%);
$border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%);
$inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%);
$stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%);
$text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%);
@if $grayscale == true {
$base-color-hover: grayscale($base-color-hover);
$border-bottom: grayscale($border-bottom);
$border-sides: grayscale($border-sides);
$border-top: grayscale($border-top);
$inset-shadow-hover: grayscale($inset-shadow-hover);
$stop-gradient-hover: grayscale($stop-gradient-hover);
$text-shadow-hover: grayscale($text-shadow-hover);
}
border: 1px solid $border-top;
border-color: $border-top $border-sides $border-bottom;
box-shadow: inset 0 1px 0 0 $inset-shadow-hover;
cursor: pointer;
@include linear-gradient ($base-color-hover, $stop-gradient-hover);
text-shadow: 0 -1px 1px $text-shadow-hover;
background-clip: padding-box;
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$active-color: adjust-color($base-color, $hue: 4, $saturation: -12%, $lightness: -10%);
$border-active: adjust-color($base-color, $hue: 6, $saturation: -2.5%, $lightness: -30%);
$border-bottom-active: adjust-color($base-color, $hue: 11, $saturation: 6%, $lightness: -31%);
$inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%);
$text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%);
@if $grayscale == true {
$active-color: grayscale($active-color);
$border-active: grayscale($border-active);
$border-bottom-active: grayscale($border-bottom-active);
$inset-shadow-active: grayscale($inset-shadow-active);
$text-shadow-active: grayscale($text-shadow-active);
}
background: $active-color;
border: 1px solid $border-active;
border-bottom: 1px solid $border-bottom-active;
box-shadow: inset 0 0 6px 3px $inset-shadow-active;
text-shadow: 0 -1px 1px $text-shadow-active;
}
}
// Flat Button
//************************************************************************//
@mixin flat($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
}
background-color: $base-color;
border-radius: 3px;
border: none;
color: $color;
display: inline-block;
font-size: inherit;
font-weight: bold;
padding: 7px 18px;
text-decoration: none;
background-clip: padding-box;
&:hover:not(:disabled){
$base-color-hover: adjust-color($base-color, $saturation: 4%, $lightness: 5%);
@if $grayscale == true {
$base-color-hover: grayscale($base-color-hover);
}
background-color: $base-color-hover;
cursor: pointer;
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$base-color-active: adjust-color($base-color, $saturation: -4%, $lightness: -5%);
@if $grayscale == true {
$base-color-active: grayscale($base-color-active);
}
background-color: $base-color-active;
cursor: pointer;
}
}

View File

@@ -1,23 +0,0 @@
// Modern micro clearfix provides an easy way to contain floats without adding additional markup.
//
// Example usage:
//
// // Contain all floats within .wrapper
// .wrapper {
// @include clearfix;
// .content,
// .sidebar {
// float : left;
// }
// }
@mixin clearfix {
&:after {
content:"";
display:table;
clear:both;
}
}
// Acknowledgements
// Beat *that* clearfix: [Thierry Koblentz](http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php)

View File

@@ -1,111 +0,0 @@
// directional-property mixins are shorthands
// for writing properties like the following
//
// @include margin(null 0 10px);
// ------
// margin-right: 0;
// margin-bottom: 10px;
// margin-left: 0;
//
// - or -
//
// @include border-style(dotted null);
// ------
// border-top-style: dotted;
// border-bottom-style: dotted;
//
// ------
//
// Note: You can also use false instead of null
@function collapse-directionals($vals) {
$output: null;
$A: nth( $vals, 1 );
$B: if( length($vals) < 2, $A, nth($vals, 2));
$C: if( length($vals) < 3, $A, nth($vals, 3));
$D: if( length($vals) < 2, $A, nth($vals, if( length($vals) < 4, 2, 4) ));
@if $A == 0 { $A: 0 }
@if $B == 0 { $B: 0 }
@if $C == 0 { $C: 0 }
@if $D == 0 { $D: 0 }
@if $A == $B and $A == $C and $A == $D { $output: $A }
@else if $A == $C and $B == $D { $output: $A $B }
@else if $B == $D { $output: $A $B $C }
@else { $output: $A $B $C $D }
@return $output;
}
@function contains-falsy($list) {
@each $item in $list {
@if not $item {
@return true;
}
}
@return false;
}
@mixin directional-property($pre, $suf, $vals) {
// Property Names
$top: $pre + "-top" + if($suf, "-#{$suf}", "");
$bottom: $pre + "-bottom" + if($suf, "-#{$suf}", "");
$left: $pre + "-left" + if($suf, "-#{$suf}", "");
$right: $pre + "-right" + if($suf, "-#{$suf}", "");
$all: $pre + if($suf, "-#{$suf}", "");
$vals: collapse-directionals($vals);
@if contains-falsy($vals) {
@if nth($vals, 1) { #{$top}: nth($vals, 1); }
@if length($vals) == 1 {
@if nth($vals, 1) { #{$right}: nth($vals, 1); }
} @else {
@if nth($vals, 2) { #{$right}: nth($vals, 2); }
}
// prop: top/bottom right/left
@if length($vals) == 2 {
@if nth($vals, 1) { #{$bottom}: nth($vals, 1); }
@if nth($vals, 2) { #{$left}: nth($vals, 2); }
// prop: top right/left bottom
} @else if length($vals) == 3 {
@if nth($vals, 3) { #{$bottom}: nth($vals, 3); }
@if nth($vals, 2) { #{$left}: nth($vals, 2); }
// prop: top right bottom left
} @else if length($vals) == 4 {
@if nth($vals, 3) { #{$bottom}: nth($vals, 3); }
@if nth($vals, 4) { #{$left}: nth($vals, 4); }
}
// prop: top/right/bottom/left
} @else {
#{$all}: $vals;
}
}
@mixin margin($vals...) {
@include directional-property(margin, false, $vals...);
}
@mixin padding($vals...) {
@include directional-property(padding, false, $vals...);
}
@mixin border-style($vals...) {
@include directional-property(border, style, $vals...);
}
@mixin border-color($vals...) {
@include directional-property(border, color, $vals...);
}
@mixin border-width($vals...) {
@include directional-property(border, width, $vals...);
}

View File

@@ -1,7 +0,0 @@
@mixin ellipsis($width: 100%) {
display: inline-block;
max-width: $width;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

View File

@@ -1,5 +0,0 @@
$georgia: Georgia, Cambria, "Times New Roman", Times, serif;
$helvetica: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
$lucida-grande: "Lucida Grande", Tahoma, Verdana, Arial, sans-serif;
$monospace: "Bitstream Vera Sans Mono", Consolas, Courier, monospace;
$verdana: Verdana, Geneva, sans-serif;

View File

@@ -1,10 +0,0 @@
@mixin hide-text {
overflow: hidden;
&:before {
content: "";
display: block;
width: 0;
height: 100%;
}
}

View File

@@ -1,86 +0,0 @@
//************************************************************************//
// Generate a variable ($all-text-inputs) with a list of all html5
// input types that have a text-based input, excluding textarea.
// http://diveintohtml5.org/forms.html
//************************************************************************//
$inputs-list: 'input[type="email"]',
'input[type="number"]',
'input[type="password"]',
'input[type="search"]',
'input[type="tel"]',
'input[type="text"]',
'input[type="url"]',
// Webkit & Gecko may change the display of these in the future
'input[type="color"]',
'input[type="date"]',
'input[type="datetime"]',
'input[type="datetime-local"]',
'input[type="month"]',
'input[type="time"]',
'input[type="week"]';
// Bare inputs
//************************************************************************//
$all-text-inputs: assign-inputs($inputs-list);
// Hover Pseudo-class
//************************************************************************//
$all-text-inputs-hover: assign-inputs($inputs-list, hover);
// Focus Pseudo-class
//************************************************************************//
$all-text-inputs-focus: assign-inputs($inputs-list, focus);
// You must use interpolation on the variable:
// #{$all-text-inputs}
// #{$all-text-inputs-hover}
// #{$all-text-inputs-focus}
// Example
//************************************************************************//
// #{$all-text-inputs}, textarea {
// border: 1px solid red;
// }
//************************************************************************//
// Generate a variable ($all-button-inputs) with a list of all html5
// input types that have a button-based input, excluding button.
//************************************************************************//
$inputs-button-list: 'input[type="button"]',
'input[type="reset"]',
'input[type="submit"]';
// Bare inputs
//************************************************************************//
$all-button-inputs: assign-inputs($inputs-button-list);
// Hover Pseudo-class
//************************************************************************//
$all-button-inputs-hover: assign-inputs($inputs-button-list, hover);
// Focus Pseudo-class
//************************************************************************//
$all-button-inputs-focus: assign-inputs($inputs-button-list, focus);
// Active Pseudo-class
//************************************************************************//
$all-button-inputs-active: assign-inputs($inputs-button-list, active);
// You must use interpolation on the variable:
// #{$all-button-inputs}
// #{$all-button-inputs-hover}
// #{$all-button-inputs-focus}
// #{$all-button-inputs-active}
// Example
//************************************************************************//
// #{$all-button-inputs}, button {
// border: 1px solid red;
// }

View File

@@ -1,32 +0,0 @@
@mixin position ($position: relative, $coordinates: null null null null) {
@if type-of($position) == list {
$coordinates: $position;
$position: relative;
}
$coordinates: unpack($coordinates);
$top: nth($coordinates, 1);
$right: nth($coordinates, 2);
$bottom: nth($coordinates, 3);
$left: nth($coordinates, 4);
position: $position;
@if ($top and $top == auto) or (type-of($top) == number) {
top: $top;
}
@if ($right and $right == auto) or (type-of($right) == number) {
right: $right;
}
@if ($bottom and $bottom == auto) or (type-of($bottom) == number) {
bottom: $bottom;
}
@if ($left and $left == auto) or (type-of($left) == number) {
left: $left;
}
}

View File

@@ -1,45 +0,0 @@
//************************************************************************//
// Example: @include prefixer(border-radius, $radii, webkit ms spec);
//************************************************************************//
// Variables located in /settings/_prefixer.scss
@mixin prefixer ($property, $value, $prefixes) {
@each $prefix in $prefixes {
@if $prefix == webkit {
@if $prefix-for-webkit {
-webkit-#{$property}: $value;
}
}
@else if $prefix == moz {
@if $prefix-for-mozilla {
-moz-#{$property}: $value;
}
}
@else if $prefix == ms {
@if $prefix-for-microsoft {
-ms-#{$property}: $value;
}
}
@else if $prefix == o {
@if $prefix-for-opera {
-o-#{$property}: $value;
}
}
@else if $prefix == spec {
@if $prefix-for-spec {
#{$property}: $value;
}
}
@else {
@warn "Unrecognized prefix: #{$prefix}";
}
}
}
@mixin disable-prefix-for-all() {
$prefix-for-webkit: false !global;
$prefix-for-mozilla: false !global;
$prefix-for-microsoft: false !global;
$prefix-for-opera: false !global;
$prefix-for-spec: false !global;
}

View File

@@ -1,31 +0,0 @@
@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: $asset-pipeline) {
@if $asset-pipeline {
background-image: image-url("#{$filename}.#{$extension}");
}
@else {
background-image: url("#{$filename}.#{$extension}");
}
@include hidpi {
@if $asset-pipeline {
@if $retina-filename {
background-image: image-url("#{$retina-filename}.#{$extension}");
}
@else {
background-image: image-url("#{$filename}#{$retina-suffix}.#{$extension}");
}
}
@else {
@if $retina-filename {
background-image: url("#{$retina-filename}.#{$extension}");
}
@else {
background-image: url("#{$filename}#{$retina-suffix}.#{$extension}");
}
}
background-size: $background-size;
}
}

View File

@@ -1,16 +0,0 @@
@mixin size($size) {
$height: nth($size, 1);
$width: $height;
@if length($size) > 1 {
$height: nth($size, 2);
}
@if $height == auto or (type-of($height) == number and not unitless($height)) {
height: $height;
}
@if $width == auto or (type-of($width) == number and not unitless($width)) {
width: $width;
}
}

View File

@@ -1,32 +0,0 @@
// CSS cubic-bezier timing functions. Timing functions courtesy of jquery.easie (github.com/jaukia/easie)
// Timing functions are the same as demo'ed here: http://jqueryui.com/resources/demos/effect/easing.html
// EASE IN
$ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530);
$ease-in-cubic: cubic-bezier(0.550, 0.055, 0.675, 0.190);
$ease-in-quart: cubic-bezier(0.895, 0.030, 0.685, 0.220);
$ease-in-quint: cubic-bezier(0.755, 0.050, 0.855, 0.060);
$ease-in-sine: cubic-bezier(0.470, 0.000, 0.745, 0.715);
$ease-in-expo: cubic-bezier(0.950, 0.050, 0.795, 0.035);
$ease-in-circ: cubic-bezier(0.600, 0.040, 0.980, 0.335);
$ease-in-back: cubic-bezier(0.600, -0.280, 0.735, 0.045);
// EASE OUT
$ease-out-quad: cubic-bezier(0.250, 0.460, 0.450, 0.940);
$ease-out-cubic: cubic-bezier(0.215, 0.610, 0.355, 1.000);
$ease-out-quart: cubic-bezier(0.165, 0.840, 0.440, 1.000);
$ease-out-quint: cubic-bezier(0.230, 1.000, 0.320, 1.000);
$ease-out-sine: cubic-bezier(0.390, 0.575, 0.565, 1.000);
$ease-out-expo: cubic-bezier(0.190, 1.000, 0.220, 1.000);
$ease-out-circ: cubic-bezier(0.075, 0.820, 0.165, 1.000);
$ease-out-back: cubic-bezier(0.175, 0.885, 0.320, 1.275);
// EASE IN OUT
$ease-in-out-quad: cubic-bezier(0.455, 0.030, 0.515, 0.955);
$ease-in-out-cubic: cubic-bezier(0.645, 0.045, 0.355, 1.000);
$ease-in-out-quart: cubic-bezier(0.770, 0.000, 0.175, 1.000);
$ease-in-out-quint: cubic-bezier(0.860, 0.000, 0.070, 1.000);
$ease-in-out-sine: cubic-bezier(0.445, 0.050, 0.550, 0.950);
$ease-in-out-expo: cubic-bezier(1.000, 0.000, 0.000, 1.000);
$ease-in-out-circ: cubic-bezier(0.785, 0.135, 0.150, 0.860);
$ease-in-out-back: cubic-bezier(0.680, -0.550, 0.265, 1.550);

View File

@@ -1,83 +0,0 @@
@mixin triangle ($size, $color, $direction) {
height: 0;
width: 0;
$width: nth($size, 1);
$height: nth($size, length($size));
$foreground-color: nth($color, 1);
$background-color: if(length($color) == 2, nth($color, 2), transparent);
@if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) {
$width: $width / 2;
$height: if(length($size) > 1, $height, $height/2);
@if $direction == up {
border-left: $width solid $background-color;
border-right: $width solid $background-color;
border-bottom: $height solid $foreground-color;
} @else if $direction == right {
border-top: $width solid $background-color;
border-bottom: $width solid $background-color;
border-left: $height solid $foreground-color;
} @else if $direction == down {
border-left: $width solid $background-color;
border-right: $width solid $background-color;
border-top: $height solid $foreground-color;
} @else if $direction == left {
border-top: $width solid $background-color;
border-bottom: $width solid $background-color;
border-right: $height solid $foreground-color;
}
}
@else if ($direction == up-right) or ($direction == up-left) {
border-top: $height solid $foreground-color;
@if $direction == up-right {
border-left: $width solid $background-color;
} @else if $direction == up-left {
border-right: $width solid $background-color;
}
}
@else if ($direction == down-right) or ($direction == down-left) {
border-bottom: $height solid $foreground-color;
@if $direction == down-right {
border-left: $width solid $background-color;
} @else if $direction == down-left {
border-right: $width solid $background-color;
}
}
@else if ($direction == inset-up) {
border-width: $height $width;
border-style: solid;
border-color: $background-color $background-color $foreground-color;
}
@else if ($direction == inset-down) {
border-width: $height $width;
border-style: solid;
border-color: $foreground-color $background-color $background-color;
}
@else if ($direction == inset-right) {
border-width: $width $height;
border-style: solid;
border-color: $background-color $background-color $background-color $foreground-color;
}
@else if ($direction == inset-left) {
border-width: $width $height;
border-style: solid;
border-color: $background-color $foreground-color $background-color $background-color;
}
}

View File

@@ -1,8 +0,0 @@
@mixin word-wrap($wrap: break-word) {
word-wrap: $wrap;
@if $wrap == break-word {
overflow-wrap: break-word;
word-break: break-all;
}
}

View File

@@ -1,52 +0,0 @@
// http://www.w3.org/TR/css3-animations/#the-animation-name-property-
// Each of these mixins support comma separated lists of values, which allows different transitions for individual properties to be described in a single style rule. Each value in the list corresponds to the value at that same position in the other properties.
// Official animation shorthand property.
@mixin animation ($animations...) {
@include prefixer(animation, $animations, webkit moz spec);
}
// Individual Animation Properties
@mixin animation-name ($names...) {
@include prefixer(animation-name, $names, webkit moz spec);
}
@mixin animation-duration ($times...) {
@include prefixer(animation-duration, $times, webkit moz spec);
}
@mixin animation-timing-function ($motions...) {
// ease | linear | ease-in | ease-out | ease-in-out
@include prefixer(animation-timing-function, $motions, webkit moz spec);
}
@mixin animation-iteration-count ($values...) {
// infinite | <number>
@include prefixer(animation-iteration-count, $values, webkit moz spec);
}
@mixin animation-direction ($directions...) {
// normal | alternate
@include prefixer(animation-direction, $directions, webkit moz spec);
}
@mixin animation-play-state ($states...) {
// running | paused
@include prefixer(animation-play-state, $states, webkit moz spec);
}
@mixin animation-delay ($times...) {
@include prefixer(animation-delay, $times, webkit moz spec);
}
@mixin animation-fill-mode ($modes...) {
// none | forwards | backwards | both
@include prefixer(animation-fill-mode, $modes, webkit moz spec);
}

View File

@@ -1,3 +0,0 @@
@mixin appearance ($value) {
@include prefixer(appearance, $value, webkit moz ms o spec);
}

View File

@@ -1,6 +0,0 @@
//************************************************************************//
// Backface-visibility mixin
//************************************************************************//
@mixin backface-visibility($visibility) {
@include prefixer(backface-visibility, $visibility, webkit spec);
}

View File

@@ -1,42 +0,0 @@
//************************************************************************//
// Background-image property for adding multiple background images with
// gradients, or for stringing multiple gradients together.
//************************************************************************//
@mixin background-image($images...) {
$webkit-images: ();
$spec-images: ();
@each $image in $images {
$webkit-image: ();
$spec-image: ();
@if (type-of($image) == string) {
$url-str: str-slice($image, 0, 3);
$gradient-type: str-slice($image, 0, 6);
@if $url-str == "url" {
$webkit-image: $image;
$spec-image: $image;
}
@else if $gradient-type == "linear" {
$gradients: _linear-gradient-parser($image);
$webkit-image: map-get($gradients, webkit-image);
$spec-image: map-get($gradients, spec-image);
}
@else if $gradient-type == "radial" {
$gradients: _radial-gradient-parser($image);
$webkit-image: map-get($gradients, webkit-image);
$spec-image: map-get($gradients, spec-image);
}
}
$webkit-images: append($webkit-images, $webkit-image, comma);
$spec-images: append($spec-images, $spec-image, comma);
}
background-image: $webkit-images;
background-image: $spec-images;
}

View File

@@ -1,55 +0,0 @@
//************************************************************************//
// Background property for adding multiple backgrounds using shorthand
// notation.
//************************************************************************//
@mixin background($backgrounds...) {
$webkit-backgrounds: ();
$spec-backgrounds: ();
@each $background in $backgrounds {
$webkit-background: ();
$spec-background: ();
$background-type: type-of($background);
@if $background-type == string or list {
$background-str: if($background-type == list, nth($background, 1), $background);
$url-str: str-slice($background-str, 0, 3);
$gradient-type: str-slice($background-str, 0, 6);
@if $url-str == "url" {
$webkit-background: $background;
$spec-background: $background;
}
@else if $gradient-type == "linear" {
$gradients: _linear-gradient-parser("#{$background}");
$webkit-background: map-get($gradients, webkit-image);
$spec-background: map-get($gradients, spec-image);
}
@else if $gradient-type == "radial" {
$gradients: _radial-gradient-parser("#{$background}");
$webkit-background: map-get($gradients, webkit-image);
$spec-background: map-get($gradients, spec-image);
}
@else {
$webkit-background: $background;
$spec-background: $background;
}
}
@else {
$webkit-background: $background;
$spec-background: $background;
}
$webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma);
$spec-backgrounds: append($spec-backgrounds, $spec-background, comma);
}
background: $webkit-backgrounds;
background: $spec-backgrounds;
}

View File

@@ -1,59 +0,0 @@
@mixin border-image($borders...) {
$webkit-borders: ();
$spec-borders: ();
@each $border in $borders {
$webkit-border: ();
$spec-border: ();
$border-type: type-of($border);
@if $border-type == string or list {
$border-str: if($border-type == list, nth($border, 1), $border);
$url-str: str-slice($border-str, 0, 3);
$gradient-type: str-slice($border-str, 0, 6);
@if $url-str == "url" {
$webkit-border: $border;
$spec-border: $border;
}
@else if $gradient-type == "linear" {
$gradients: _linear-gradient-parser("#{$border}");
$webkit-border: map-get($gradients, webkit-image);
$spec-border: map-get($gradients, spec-image);
}
@else if $gradient-type == "radial" {
$gradients: _radial-gradient-parser("#{$border}");
$webkit-border: map-get($gradients, webkit-image);
$spec-border: map-get($gradients, spec-image);
}
@else {
$webkit-border: $border;
$spec-border: $border;
}
}
@else {
$webkit-border: $border;
$spec-border: $border;
}
$webkit-borders: append($webkit-borders, $webkit-border, comma);
$spec-borders: append($spec-borders, $spec-border, comma);
}
-webkit-border-image: $webkit-borders;
border-image: $spec-borders;
border-style: solid;
}
//Examples:
// @include border-image(url("image.png"));
// @include border-image(url("image.png") 20 stretch);
// @include border-image(linear-gradient(45deg, orange, yellow));
// @include border-image(linear-gradient(45deg, orange, yellow) stretch);
// @include border-image(linear-gradient(45deg, orange, yellow) 20 30 40 50 stretch round);
// @include border-image(radial-gradient(top, cover, orange, yellow, orange));

View File

@@ -1,22 +0,0 @@
//************************************************************************//
// Shorthand Border-radius mixins
//************************************************************************//
@mixin border-top-radius($radii) {
@include prefixer(border-top-left-radius, $radii, spec);
@include prefixer(border-top-right-radius, $radii, spec);
}
@mixin border-bottom-radius($radii) {
@include prefixer(border-bottom-left-radius, $radii, spec);
@include prefixer(border-bottom-right-radius, $radii, spec);
}
@mixin border-left-radius($radii) {
@include prefixer(border-top-left-radius, $radii, spec);
@include prefixer(border-bottom-left-radius, $radii, spec);
}
@mixin border-right-radius($radii) {
@include prefixer(border-top-right-radius, $radii, spec);
@include prefixer(border-bottom-right-radius, $radii, spec);
}

View File

@@ -1,4 +0,0 @@
@mixin box-sizing ($box) {
// content-box | border-box | inherit
@include prefixer(box-sizing, $box, webkit moz spec);
}

View File

@@ -1,4 +0,0 @@
@mixin calc($property, $value) {
#{$property}: -webkit-calc(#{$value});
#{$property}: calc(#{$value});
}

View File

@@ -1,47 +0,0 @@
@mixin columns($arg: auto) {
// <column-count> || <column-width>
@include prefixer(columns, $arg, webkit moz spec);
}
@mixin column-count($int: auto) {
// auto || integer
@include prefixer(column-count, $int, webkit moz spec);
}
@mixin column-gap($length: normal) {
// normal || length
@include prefixer(column-gap, $length, webkit moz spec);
}
@mixin column-fill($arg: auto) {
// auto || length
@include prefixer(column-fill, $arg, webkit moz spec);
}
@mixin column-rule($arg) {
// <border-width> || <border-style> || <color>
@include prefixer(column-rule, $arg, webkit moz spec);
}
@mixin column-rule-color($color) {
@include prefixer(column-rule-color, $color, webkit moz spec);
}
@mixin column-rule-style($style: none) {
// none | hidden | dashed | dotted | double | groove | inset | inset | outset | ridge | solid
@include prefixer(column-rule-style, $style, webkit moz spec);
}
@mixin column-rule-width ($width: none) {
@include prefixer(column-rule-width, $width, webkit moz spec);
}
@mixin column-span($arg: none) {
// none || all
@include prefixer(column-span, $arg, webkit moz spec);
}
@mixin column-width($length: auto) {
// auto || length
@include prefixer(column-width, $length, webkit moz spec);
}

View File

@@ -1,5 +0,0 @@
@mixin filter($function: none) {
// <filter-function> [<filter-function]* | none
@include prefixer(filter, $function, webkit spec);
}

View File

@@ -1,321 +0,0 @@
// CSS3 Flexible Box Model and property defaults
// Custom shorthand notation for flexbox
@mixin box($orient: inline-axis, $pack: start, $align: stretch) {
@include display-box;
@include box-orient($orient);
@include box-pack($pack);
@include box-align($align);
}
@mixin display-box {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox; // IE 10
display: box;
}
@mixin box-orient($orient: inline-axis) {
// horizontal|vertical|inline-axis|block-axis|inherit
@include prefixer(box-orient, $orient, webkit moz spec);
}
@mixin box-pack($pack: start) {
// start|end|center|justify
@include prefixer(box-pack, $pack, webkit moz spec);
-ms-flex-pack: $pack; // IE 10
}
@mixin box-align($align: stretch) {
// start|end|center|baseline|stretch
@include prefixer(box-align, $align, webkit moz spec);
-ms-flex-align: $align; // IE 10
}
@mixin box-direction($direction: normal) {
// normal|reverse|inherit
@include prefixer(box-direction, $direction, webkit moz spec);
-ms-flex-direction: $direction; // IE 10
}
@mixin box-lines($lines: single) {
// single|multiple
@include prefixer(box-lines, $lines, webkit moz spec);
}
@mixin box-ordinal-group($int: 1) {
@include prefixer(box-ordinal-group, $int, webkit moz spec);
-ms-flex-order: $int; // IE 10
}
@mixin box-flex($value: 0.0) {
@include prefixer(box-flex, $value, webkit moz spec);
-ms-flex: $value; // IE 10
}
@mixin box-flex-group($int: 1) {
@include prefixer(box-flex-group, $int, webkit moz spec);
}
// CSS3 Flexible Box Model and property defaults
// Unified attributes for 2009, 2011, and 2012 flavours.
// 2009 - display (box | inline-box)
// 2011 - display (flexbox | inline-flexbox)
// 2012 - display (flex | inline-flex)
@mixin display($value) {
// flex | inline-flex
@if $value == "flex" {
// 2009
display: -webkit-box;
display: -moz-box;
display: box;
// 2012
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox; // 2011 (IE 10)
display: flex;
}
@elseif $value == "inline-flex" {
display: -webkit-inline-box;
display: -moz-inline-box;
display: inline-box;
display: -webkit-inline-flex;
display: -moz-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
}
@else {
display: $value;
}
}
// 2009 - box-flex (integer)
// 2011 - flex (decimal | width decimal)
// 2012 - flex (integer integer width)
@mixin flex($value) {
// Grab flex-grow for older browsers.
$flex-grow: nth($value, 1);
// 2009
@include prefixer(box-flex, $flex-grow, webkit moz spec);
// 2011 (IE 10), 2012
@include prefixer(flex, $value, webkit moz ms spec);
}
// 2009 - box-orient ( horizontal | vertical | inline-axis | block-axis)
// - box-direction (normal | reverse)
// 2011 - flex-direction (row | row-reverse | column | column-reverse)
// 2012 - flex-direction (row | row-reverse | column | column-reverse)
@mixin flex-direction($value: row) {
// Alt values.
$value-2009: $value;
$value-2011: $value;
$direction: "normal";
@if $value == row {
$value-2009: horizontal;
}
@elseif $value == "row-reverse" {
$value-2009: horizontal;
$direction: reverse;
}
@elseif $value == column {
$value-2009: vertical;
}
@elseif $value == "column-reverse" {
$value-2009: vertical;
$direction: reverse;
}
// 2009
@include prefixer(box-orient, $value-2009, webkit moz spec);
@if $direction == "reverse" {
@include prefixer(box-direction, $direction, webkit moz spec);
}
// 2012
@include prefixer(flex-direction, $value, webkit moz spec);
// 2011 (IE 10)
-ms-flex-direction: $value;
}
// 2009 - box-lines (single | multiple)
// 2011 - flex-wrap (nowrap | wrap | wrap-reverse)
// 2012 - flex-wrap (nowrap | wrap | wrap-reverse)
@mixin flex-wrap($value: nowrap) {
// Alt values.
$alt-value: $value;
@if $value == nowrap {
$alt-value: single;
}
@elseif $value == wrap {
$alt-value: multiple;
}
@elseif $value == "wrap-reverse" {
$alt-value: multiple;
}
@include prefixer(box-lines, $alt-value, webkit moz spec);
@include prefixer(flex-wrap, $value, webkit moz ms spec);
}
// 2009 - TODO: parse values into flex-direction/flex-wrap
// 2011 - TODO: parse values into flex-direction/flex-wrap
// 2012 - flex-flow (flex-direction || flex-wrap)
@mixin flex-flow($value) {
@include prefixer(flex-flow, $value, webkit moz spec);
}
// 2009 - box-ordinal-group (integer)
// 2011 - flex-order (integer)
// 2012 - order (integer)
@mixin order($int: 0) {
// 2009
@include prefixer(box-ordinal-group, $int, webkit moz spec);
// 2012
@include prefixer(order, $int, webkit moz spec);
// 2011 (IE 10)
-ms-flex-order: $int;
}
// 2012 - flex-grow (number)
@mixin flex-grow($number: 0) {
@include prefixer(flex-grow, $number, webkit moz spec);
-ms-flex-positive: $number;
}
// 2012 - flex-shrink (number)
@mixin flex-shrink($number: 1) {
@include prefixer(flex-shrink, $number, webkit moz spec);
-ms-flex-negative: $number;
}
// 2012 - flex-basis (number)
@mixin flex-basis($width: auto) {
@include prefixer(flex-basis, $width, webkit moz spec);
-ms-flex-preferred-size: $width;
}
// 2009 - box-pack (start | end | center | justify)
// 2011 - flex-pack (start | end | center | justify)
// 2012 - justify-content (flex-start | flex-end | center | space-between | space-around)
@mixin justify-content ($value: flex-start) {
// Alt values.
$alt-value: $value;
@if $value == "flex-start" {
$alt-value: start;
}
@elseif $value == "flex-end" {
$alt-value: end;
}
@elseif $value == "space-between" {
$alt-value: justify;
}
@elseif $value == "space-around" {
$alt-value: center;
}
// 2009
@include prefixer(box-pack, $alt-value, webkit moz spec);
// 2012
@include prefixer(justify-content, $value, webkit moz ms o spec);
// 2011 (IE 10)
-ms-flex-pack: $alt-value;
}
// 2009 - box-align (start | end | center | baseline | stretch)
// 2011 - flex-align (start | end | center | baseline | stretch)
// 2012 - align-items (flex-start | flex-end | center | baseline | stretch)
@mixin align-items($value: stretch) {
$alt-value: $value;
@if $value == "flex-start" {
$alt-value: start;
}
@elseif $value == "flex-end" {
$alt-value: end;
}
// 2009
@include prefixer(box-align, $alt-value, webkit moz spec);
// 2012
@include prefixer(align-items, $value, webkit moz ms o spec);
// 2011 (IE 10)
-ms-flex-align: $alt-value;
}
// 2011 - flex-item-align (auto | start | end | center | baseline | stretch)
// 2012 - align-self (auto | flex-start | flex-end | center | baseline | stretch)
@mixin align-self($value: auto) {
$value-2011: $value;
@if $value == "flex-start" {
$value-2011: start;
}
@elseif $value == "flex-end" {
$value-2011: end;
}
// 2012
@include prefixer(align-self, $value, webkit moz spec);
// 2011 (IE 10)
-ms-flex-item-align: $value-2011;
}
// 2011 - flex-line-pack (start | end | center | justify | distribute | stretch)
// 2012 - align-content (flex-start | flex-end | center | space-between | space-around | stretch)
@mixin align-content($value: stretch) {
$value-2011: $value;
@if $value == "flex-start" {
$value-2011: start;
}
@elseif $value == "flex-end" {
$value-2011: end;
}
@elseif $value == "space-between" {
$value-2011: justify;
}
@elseif $value == "space-around" {
$value-2011: distribute;
}
// 2012
@include prefixer(align-content, $value, webkit moz spec);
// 2011 (IE 10)
-ms-flex-line-pack: $value-2011;
}

View File

@@ -1,23 +0,0 @@
// Order of the includes matters, and it is: normal, bold, italic, bold+italic.
@mixin font-face($font-family, $file-path, $weight: normal, $style: normal, $asset-pipeline: $asset-pipeline) {
@font-face {
font-family: $font-family;
font-weight: $weight;
font-style: $style;
@if $asset-pipeline == true {
src: font-url('#{$file-path}.eot');
src: font-url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
font-url('#{$file-path}.woff') format('woff'),
font-url('#{$file-path}.ttf') format('truetype'),
font-url('#{$file-path}.svg##{$font-family}') format('svg');
} @else {
src: url('#{$file-path}.eot');
src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
url('#{$file-path}.woff') format('woff'),
url('#{$file-path}.ttf') format('truetype'),
url('#{$file-path}.svg##{$font-family}') format('svg');
}
}
}

View File

@@ -1,10 +0,0 @@
// Font feature settings mixin and property default.
// Examples: @include font-feature-settings("liga");
// @include font-feature-settings("lnum" false);
// @include font-feature-settings("pnum" 1, "kern" 0);
// @include font-feature-settings("ss01", "ss02");
@mixin font-feature-settings($settings...) {
@if length($settings) == 0 { $settings: none; }
@include prefixer(font-feature-settings, $settings, webkit moz ms spec);
}

View File

@@ -1,10 +0,0 @@
// HiDPI mixin. Default value set to 1.3 to target Google Nexus 7 (http://bjango.com/articles/min-device-pixel-ratio/)
@mixin hidpi($ratio: 1.3) {
@media only screen and (-webkit-min-device-pixel-ratio: $ratio),
only screen and (min--moz-device-pixel-ratio: $ratio),
only screen and (-o-min-device-pixel-ratio: #{$ratio}/1),
only screen and (min-resolution: #{round($ratio*96)}dpi),
only screen and (min-resolution: #{$ratio}dppx) {
@content;
}
}

View File

@@ -1,4 +0,0 @@
@mixin hyphens($hyphenation: none) {
// none | manual | auto
@include prefixer(hyphens, $hyphenation, webkit moz ms spec);
}

View File

@@ -1,14 +0,0 @@
@mixin image-rendering ($mode:auto) {
@if ($mode == crisp-edges) {
-ms-interpolation-mode: nearest-neighbor; // IE8+
image-rendering: -moz-crisp-edges;
image-rendering: -o-crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
@else {
image-rendering: $mode;
}
}

View File

@@ -1,35 +0,0 @@
// Adds keyframes blocks for supported prefixes, removing redundant prefixes in the block's content
@mixin keyframes($name) {
$original-prefix-for-webkit: $prefix-for-webkit;
$original-prefix-for-mozilla: $prefix-for-mozilla;
$original-prefix-for-microsoft: $prefix-for-microsoft;
$original-prefix-for-opera: $prefix-for-opera;
$original-prefix-for-spec: $prefix-for-spec;
@if $original-prefix-for-webkit {
@include disable-prefix-for-all();
$prefix-for-webkit: true !global;
@-webkit-keyframes #{$name} {
@content;
}
}
@if $original-prefix-for-mozilla {
@include disable-prefix-for-all();
$prefix-for-mozilla: true !global;
@-moz-keyframes #{$name} {
@content;
}
}
$prefix-for-webkit: $original-prefix-for-webkit !global;
$prefix-for-mozilla: $original-prefix-for-mozilla !global;
$prefix-for-microsoft: $original-prefix-for-microsoft !global;
$prefix-for-opera: $original-prefix-for-opera !global;
$prefix-for-spec: $original-prefix-for-spec !global;
@if $original-prefix-for-spec {
@keyframes #{$name} {
@content;
}
}
}

View File

@@ -1,38 +0,0 @@
@mixin linear-gradient($pos, $G1, $G2: null,
$G3: null, $G4: null,
$G5: null, $G6: null,
$G7: null, $G8: null,
$G9: null, $G10: null,
$fallback: null) {
// Detect what type of value exists in $pos
$pos-type: type-of(nth($pos, 1));
$pos-spec: null;
$pos-degree: null;
// If $pos is missing from mixin, reassign vars and add default position
@if ($pos-type == color) or (nth($pos, 1) == "transparent") {
$G10: $G9; $G9: $G8; $G8: $G7; $G7: $G6; $G6: $G5;
$G5: $G4; $G4: $G3; $G3: $G2; $G2: $G1; $G1: $pos;
$pos: null;
}
@if $pos {
$positions: _linear-positions-parser($pos);
$pos-degree: nth($positions, 1);
$pos-spec: nth($positions, 2);
}
$full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
// Set $G1 as the default fallback color
$fallback-color: nth($G1, 1);
// If $fallback is a color use that color as the fallback color
@if (type-of($fallback) == color) or ($fallback == "transparent") {
$fallback-color: $fallback;
}
background-color: $fallback-color;
background-image: -webkit-linear-gradient($pos-degree $full); // Safari 5.1+, Chrome
background-image: unquote("linear-gradient(#{$pos-spec}#{$full})");
}

View File

@@ -1,8 +0,0 @@
@mixin perspective($depth: none) {
// none | <length>
@include prefixer(perspective, $depth, webkit moz spec);
}
@mixin perspective-origin($value: 50% 50%) {
@include prefixer(perspective-origin, $value, webkit moz spec);
}

View File

@@ -1,8 +0,0 @@
@mixin placeholder {
$placeholders: ":-webkit-input" ":-moz" "-moz" "-ms-input";
@each $placeholder in $placeholders {
&:#{$placeholder}-placeholder {
@content;
}
}
}

View File

@@ -1,39 +0,0 @@
// Requires Sass 3.1+
@mixin radial-gradient($G1, $G2,
$G3: null, $G4: null,
$G5: null, $G6: null,
$G7: null, $G8: null,
$G9: null, $G10: null,
$pos: null,
$shape-size: null,
$fallback: null) {
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
$G1: nth($data, 1);
$G2: nth($data, 2);
$pos: nth($data, 3);
$shape-size: nth($data, 4);
$full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
// Strip deprecated cover/contain for spec
$shape-size-spec: _shape-size-stripper($shape-size);
// Set $G1 as the default fallback color
$first-color: nth($full, 1);
$fallback-color: nth($first-color, 1);
@if (type-of($fallback) == color) or ($fallback == "transparent") {
$fallback-color: $fallback;
}
// Add Commas and spaces
$shape-size: if($shape-size, '#{$shape-size}, ', null);
$pos: if($pos, '#{$pos}, ', null);
$pos-spec: if($pos, 'at #{$pos}', null);
$shape-size-spec: if(($shape-size-spec != ' ') and ($pos == null), '#{$shape-size-spec}, ', '#{$shape-size-spec} ');
background-color: $fallback-color;
background-image: -webkit-radial-gradient(unquote(#{$pos}#{$shape-size}#{$full}));
background-image: unquote("radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full})");
}

View File

@@ -1,15 +0,0 @@
@mixin transform($property: none) {
// none | <transform-function>
@include prefixer(transform, $property, webkit moz ms o spec);
}
@mixin transform-origin($axes: 50%) {
// x-axis - left | center | right | length | %
// y-axis - top | center | bottom | length | %
// z-axis - length
@include prefixer(transform-origin, $axes, webkit moz ms o spec);
}
@mixin transform-style ($style: flat) {
@include prefixer(transform-style, $style, webkit moz ms o spec);
}

View File

@@ -1,77 +0,0 @@
// Shorthand mixin. Supports multiple parentheses-deliminated values for each variable.
// Example: @include transition (all 2s ease-in-out);
// @include transition (opacity 1s ease-in 2s, width 2s ease-out);
// @include transition-property (transform, opacity);
@mixin transition ($properties...) {
// Fix for vendor-prefix transform property
$needs-prefixes: false;
$webkit: ();
$moz: ();
$spec: ();
// Create lists for vendor-prefixed transform
@each $list in $properties {
@if nth($list, 1) == "transform" {
$needs-prefixes: true;
$list1: -webkit-transform;
$list2: -moz-transform;
$list3: ();
@each $var in $list {
$list3: join($list3, $var);
@if $var != "transform" {
$list1: join($list1, $var);
$list2: join($list2, $var);
}
}
$webkit: append($webkit, $list1);
$moz: append($moz, $list2);
$spec: append($spec, $list3);
}
// Create lists for non-prefixed transition properties
@else {
$webkit: append($webkit, $list, comma);
$moz: append($moz, $list, comma);
$spec: append($spec, $list, comma);
}
}
@if $needs-prefixes {
-webkit-transition: $webkit;
-moz-transition: $moz;
transition: $spec;
}
@else {
@if length($properties) >= 1 {
@include prefixer(transition, $properties, webkit moz spec);
}
@else {
$properties: all 0.15s ease-out 0s;
@include prefixer(transition, $properties, webkit moz spec);
}
}
}
@mixin transition-property ($properties...) {
-webkit-transition-property: transition-property-names($properties, 'webkit');
-moz-transition-property: transition-property-names($properties, 'moz');
transition-property: transition-property-names($properties, false);
}
@mixin transition-duration ($times...) {
@include prefixer(transition-duration, $times, webkit moz spec);
}
@mixin transition-timing-function ($motions...) {
// ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier()
@include prefixer(transition-timing-function, $motions, webkit moz spec);
}
@mixin transition-delay ($times...) {
@include prefixer(transition-delay, $times, webkit moz spec);
}

View File

@@ -1,3 +0,0 @@
@mixin user-select($arg: none) {
@include prefixer(user-select, $arg, webkit moz ms spec);
}

View File

@@ -1,11 +0,0 @@
@function assign-inputs($inputs, $pseudo: null) {
$list : ();
@each $input in $inputs {
$input: unquote($input);
$input: if($pseudo, $input + ":" + $pseudo, $input);
$list: append($list, $input, comma);
}
@return $list;
}

View File

@@ -1,13 +0,0 @@
// Programatically determines whether a color is light or dark
// Returns a boolean
// More details here http://robots.thoughtbot.com/closer-look-color-lightness
@function is-light($hex-color) {
$-local-red: red(rgba($hex-color, 1.0));
$-local-green: green(rgba($hex-color, 1.0));
$-local-blue: blue(rgba($hex-color, 1.0));
$-local-lightness: ($-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722) / 255;
@return $-local-lightness > .6;
}

View File

@@ -1,39 +0,0 @@
// Flexible grid
@function flex-grid($columns, $container-columns: $fg-max-columns) {
$width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($width / $container-width);
}
// Flexible gutter
@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($gutter / $container-width);
}
// The $fg-column, $fg-gutter and $fg-max-columns variables must be defined in your base stylesheet to properly use the flex-grid function.
// This function takes the fluid grid equation (target / context = result) and uses columns to help define each.
//
// The calculation presumes that your column structure will be missing the last gutter:
//
// -- column -- gutter -- column -- gutter -- column
//
// $fg-column: 60px; // Column Width
// $fg-gutter: 25px; // Gutter Width
// $fg-max-columns: 12; // Total Columns For Main Container
//
// div {
// width: flex-grid(4); // returns (315px / 995px) = 31.65829%;
// margin-left: flex-gutter(); // returns (25px / 995px) = 2.51256%;
//
// p {
// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%;
// float: left;
// margin: flex-gutter(4); // returns (25px / 315px) = 7.936508%;
// }
//
// blockquote {
// float: left;
// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%;
// }
// }

View File

@@ -1,3 +0,0 @@
@function golden-ratio($value, $increment) {
@return modular-scale($value, $increment, $golden)
}

View File

@@ -1,13 +0,0 @@
@function grid-width($n) {
@return $n * $gw-column + ($n - 1) * $gw-gutter;
}
// The $gw-column and $gw-gutter variables must be defined in your base stylesheet to properly use the grid-width function.
//
// $gw-column: 100px; // Column Width
// $gw-gutter: 40px; // Gutter Width
//
// div {
// width: grid-width(4); // returns 520px;
// margin-left: $gw-gutter; // returns 40px;
// }

View File

@@ -1,66 +0,0 @@
// Scaling Variables
$golden: 1.618;
$minor-second: 1.067;
$major-second: 1.125;
$minor-third: 1.2;
$major-third: 1.25;
$perfect-fourth: 1.333;
$augmented-fourth: 1.414;
$perfect-fifth: 1.5;
$minor-sixth: 1.6;
$major-sixth: 1.667;
$minor-seventh: 1.778;
$major-seventh: 1.875;
$octave: 2;
$major-tenth: 2.5;
$major-eleventh: 2.667;
$major-twelfth: 3;
$double-octave: 4;
@function modular-scale($value, $increment, $ratio) {
$v1: nth($value, 1);
$v2: nth($value, length($value));
$value: $v1;
// scale $v2 to just above $v1
@while $v2 > $v1 {
$v2: ($v2 / $ratio); // will be off-by-1
}
@while $v2 < $v1 {
$v2: ($v2 * $ratio); // will fix off-by-1
}
// check AFTER scaling $v2 to prevent double-counting corner-case
$double-stranded: $v2 > $v1;
@if $increment > 0 {
@for $i from 1 through $increment {
@if $double-stranded and ($v1 * $ratio) > $v2 {
$value: $v2;
$v2: ($v2 * $ratio);
} @else {
$v1: ($v1 * $ratio);
$value: $v1;
}
}
}
@if $increment < 0 {
// adjust $v2 to just below $v1
@if $double-stranded {
$v2: ($v2 / $ratio);
}
@for $i from $increment through -1 {
@if $double-stranded and ($v1 / $ratio) < $v2 {
$value: $v2;
$v2: ($v2 / $ratio);
} @else {
$v1: ($v1 / $ratio);
$value: $v1;
}
}
}
@return $value;
}

View File

@@ -1,13 +0,0 @@
// Convert pixels to ems
// eg. for a relational value of 12px write em(12) when the parent is 16px
// if the parent is another value say 24px write em(12, 24)
@function em($pxval, $base: $em-base) {
@if not unitless($pxval) {
$pxval: strip-units($pxval);
}
@if not unitless($base) {
$base: strip-units($base);
}
@return ($pxval / $base) * 1em;
}

View File

@@ -1,15 +0,0 @@
// Convert pixels to rems
// eg. for a relational value of 12px write rem(12)
// Assumes $em-base is the font-size of <html>
@function rem($pxval) {
@if not unitless($pxval) {
$pxval: strip-units($pxval);
}
$base: $em-base;
@if not unitless($base) {
$base: strip-units($base);
}
@return ($pxval / $base) * 1rem;
}

View File

@@ -1,5 +0,0 @@
// Srtips the units from a value. e.g. 12px -> 12
@function strip-units($val) {
@return ($val / ($val * 0 + 1));
}

View File

@@ -1,9 +0,0 @@
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
}
// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
}

View File

@@ -1,22 +0,0 @@
// Return vendor-prefixed property names if appropriate
// Example: transition-property-names((transform, color, background), moz) -> -moz-transform, color, background
//************************************************************************//
@function transition-property-names($props, $vendor: false) {
$new-props: ();
@each $prop in $props {
$new-props: append($new-props, transition-property-name($prop, $vendor), comma);
}
@return $new-props;
}
@function transition-property-name($prop, $vendor: false) {
// put other properties that need to be prefixed here aswell
@if $vendor and $prop == transform {
@return unquote('-'+$vendor+'-'+$prop);
}
@else {
@return $prop;
}
}

View File

@@ -1,17 +0,0 @@
// Convert shorthand to the 4-value syntax
@function unpack($shorthand) {
@if length($shorthand) == 1 {
@return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1);
}
@else if length($shorthand) == 2 {
@return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2);
}
@else if length($shorthand) == 3 {
@return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2);
}
@else {
@return $shorthand;
}
}

View File

@@ -1,15 +0,0 @@
//************************************************************************//
// Helper function for str-to-num fn.
// Source: http://sassmeister.com/gist/9647408
//************************************************************************//
@function _convert-units($number, $unit) {
$strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax', 'deg', 'rad', 'grad', 'turn';
$units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax, 1deg, 1rad, 1grad, 1turn;
$index: index($strings, $unit);
@if not $index {
@warn "Unknown unit `#{$unit}`.";
@return false;
}
@return $number * nth($units, $index);
}

View File

@@ -1,13 +0,0 @@
@function _gradient-positions-parser($gradient-type, $gradient-positions) {
@if $gradient-positions
and ($gradient-type == linear)
and (type-of($gradient-positions) != color) {
$gradient-positions: _linear-positions-parser($gradient-positions);
}
@else if $gradient-positions
and ($gradient-type == radial)
and (type-of($gradient-positions) != color) {
$gradient-positions: _radial-positions-parser($gradient-positions);
}
@return $gradient-positions;
}

View File

@@ -1,8 +0,0 @@
//************************************************************************//
// Helper for linear-gradient-parser
//************************************************************************//
@function _is-num($char) {
$values: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 0 1 2 3 4 5 6 7 8 9;
$index: index($values, $char);
@return if($index, true, false);
}

View File

@@ -1,25 +0,0 @@
// Private function for linear-gradient-parser
@function _linear-angle-parser($image, $first-val, $prefix, $suffix) {
$offset: null;
$unit-short: str-slice($first-val, str-length($first-val) - 2, str-length($first-val));
$unit-long: str-slice($first-val, str-length($first-val) - 3, str-length($first-val));
@if ($unit-long == "grad") or
($unit-long == "turn") {
$offset: if($unit-long == "grad", -100grad * 3, -0.75turn);
}
@else if ($unit-short == "deg") or
($unit-short == "rad") {
$offset: if($unit-short == "deg", -90 * 3, 1.6rad);
}
@if $offset {
$num: _str-to-num($first-val);
@return (
webkit-image: -webkit- + $prefix + ($offset - $num) + $suffix,
spec-image: $image
);
}
}

View File

@@ -1,41 +0,0 @@
@function _linear-gradient-parser($image) {
$image: unquote($image);
$gradients: ();
$start: str-index($image, "(");
$end: str-index($image, ",");
$first-val: str-slice($image, $start + 1, $end - 1);
$prefix: str-slice($image, 0, $start);
$suffix: str-slice($image, $end, str-length($image));
$has-multiple-vals: str-index($first-val, " ");
$has-single-position: unquote(_position-flipper($first-val) + "");
$has-angle: _is-num(str-slice($first-val, 0, 0));
@if $has-multiple-vals {
$gradients: _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals);
}
@else if $has-single-position != "" {
$pos: unquote($has-single-position + "");
$gradients: (
webkit-image: -webkit- + $image,
spec-image: $prefix + "to " + $pos + $suffix
);
}
@else if $has-angle {
// Rotate degree for webkit
$gradients: _linear-angle-parser($image, $first-val, $prefix, $suffix);
}
@else {
$gradients: (
webkit-image: -webkit- + $image,
spec-image: $image
);
}
@return $gradients;
}

View File

@@ -1,61 +0,0 @@
@function _linear-positions-parser($pos) {
$type: type-of(nth($pos, 1));
$spec: null;
$degree: null;
$side: null;
$corner: null;
$length: length($pos);
// Parse Side and corner positions
@if ($length > 1) {
@if nth($pos, 1) == "to" { // Newer syntax
$side: nth($pos, 2);
@if $length == 2 { // eg. to top
// Swap for backwards compatability
$degree: _position-flipper(nth($pos, 2));
}
@else if $length == 3 { // eg. to top left
$corner: nth($pos, 3);
}
}
@else if $length == 2 { // Older syntax ("top left")
$side: _position-flipper(nth($pos, 1));
$corner: _position-flipper(nth($pos, 2));
}
@if ("#{$side} #{$corner}" == "left top") or ("#{$side} #{$corner}" == "top left") {
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
}
@else if ("#{$side} #{$corner}" == "right top") or ("#{$side} #{$corner}" == "top right") {
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
}
@else if ("#{$side} #{$corner}" == "right bottom") or ("#{$side} #{$corner}" == "bottom right") {
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
}
@else if ("#{$side} #{$corner}" == "left bottom") or ("#{$side} #{$corner}" == "bottom left") {
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
}
$spec: to $side $corner;
}
@else if $length == 1 {
// Swap for backwards compatability
@if $type == string {
$degree: $pos;
$spec: to _position-flipper($pos);
}
@else {
$degree: -270 - $pos; //rotate the gradient opposite from spec
$spec: $pos;
}
}
$degree: unquote($degree + ",");
$spec: unquote($spec + ",");
@return $degree $spec;
}
@function _position-flipper($pos) {
@return if($pos == left, right, null)
if($pos == right, left, null)
if($pos == top, bottom, null)
if($pos == bottom, top, null);
}

View File

@@ -1,31 +0,0 @@
// Private function for linear-gradient-parser
@function _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals) {
$val-1: str-slice($first-val, 0, $has-multiple-vals - 1 );
$val-2: str-slice($first-val, $has-multiple-vals + 1, str-length($first-val));
$val-3: null;
$has-val-3: str-index($val-2, " ");
@if $has-val-3 {
$val-3: str-slice($val-2, $has-val-3 + 1, str-length($val-2));
$val-2: str-slice($val-2, 0, $has-val-3 - 1);
}
$pos: _position-flipper($val-1) _position-flipper($val-2) _position-flipper($val-3);
$pos: unquote($pos + "");
// Use old spec for webkit
@if $val-1 == "to" {
@return (
webkit-image: -webkit- + $prefix + $pos + $suffix,
spec-image: $image
);
}
// Bring the code up to spec
@else {
@return (
webkit-image: -webkit- + $image,
spec-image: $prefix + "to " + $pos + $suffix
);
}
}

View File

@@ -1,69 +0,0 @@
@function _radial-arg-parser($G1, $G2, $pos, $shape-size) {
@each $value in $G1, $G2 {
$first-val: nth($value, 1);
$pos-type: type-of($first-val);
$spec-at-index: null;
// Determine if spec was passed to mixin
@if type-of($value) == list {
$spec-at-index: if(index($value, at), index($value, at), false);
}
@if $spec-at-index {
@if $spec-at-index > 1 {
@for $i from 1 through ($spec-at-index - 1) {
$shape-size: $shape-size nth($value, $i);
}
@for $i from ($spec-at-index + 1) through length($value) {
$pos: $pos nth($value, $i);
}
}
@else if $spec-at-index == 1 {
@for $i from ($spec-at-index + 1) through length($value) {
$pos: $pos nth($value, $i);
}
}
$G1: null;
}
// If not spec calculate correct values
@else {
@if ($pos-type != color) or ($first-val != "transparent") {
@if ($pos-type == number)
or ($first-val == "center")
or ($first-val == "top")
or ($first-val == "right")
or ($first-val == "bottom")
or ($first-val == "left") {
$pos: $value;
@if $pos == $G1 {
$G1: null;
}
}
@else if
($first-val == "ellipse")
or ($first-val == "circle")
or ($first-val == "closest-side")
or ($first-val == "closest-corner")
or ($first-val == "farthest-side")
or ($first-val == "farthest-corner")
or ($first-val == "contain")
or ($first-val == "cover") {
$shape-size: $value;
@if $value == $G1 {
$G1: null;
}
@else if $value == $G2 {
$G2: null;
}
}
}
}
}
@return $G1, $G2, $pos, $shape-size;
}

View File

@@ -1,50 +0,0 @@
@function _radial-gradient-parser($image) {
$image: unquote($image);
$gradients: ();
$start: str-index($image, "(");
$end: str-index($image, ",");
$first-val: str-slice($image, $start + 1, $end - 1);
$prefix: str-slice($image, 0, $start);
$suffix: str-slice($image, $end, str-length($image));
$is-spec-syntax: str-index($first-val, "at");
@if $is-spec-syntax and $is-spec-syntax > 1 {
$keyword: str-slice($first-val, 1, $is-spec-syntax - 2);
$pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val));
$pos: append($pos, $keyword, comma);
$gradients: (
webkit-image: -webkit- + $prefix + $pos + $suffix,
spec-image: $image
)
}
@else if $is-spec-syntax == 1 {
$pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val));
$gradients: (
webkit-image: -webkit- + $prefix + $pos + $suffix,
spec-image: $image
)
}
@else if str-index($image, "cover") or str-index($image, "contain") {
@warn "Radial-gradient needs to be updated to conform to latest spec.";
$gradients: (
webkit-image: null,
spec-image: $image
)
}
@else {
$gradients: (
webkit-image: -webkit- + $image,
spec-image: $image
)
}
@return $gradients;
}

View File

@@ -1,18 +0,0 @@
@function _radial-positions-parser($gradient-pos) {
$shape-size: nth($gradient-pos, 1);
$pos: nth($gradient-pos, 2);
$shape-size-spec: _shape-size-stripper($shape-size);
$pre-spec: unquote(if($pos, "#{$pos}, ", null))
unquote(if($shape-size, "#{$shape-size},", null));
$pos-spec: if($pos, "at #{$pos}", null);
$spec: "#{$shape-size-spec} #{$pos-spec}";
// Add comma
@if ($spec != ' ') {
$spec: "#{$spec},"
}
@return $pre-spec $spec;
}

View File

@@ -1,26 +0,0 @@
// User for linear and radial gradients within background-image or border-image properties
@function _render-gradients($gradient-positions, $gradients, $gradient-type, $vendor: false) {
$pre-spec: null;
$spec: null;
$vendor-gradients: null;
@if $gradient-type == linear {
@if $gradient-positions {
$pre-spec: nth($gradient-positions, 1);
$spec: nth($gradient-positions, 2);
}
}
@else if $gradient-type == radial {
$pre-spec: nth($gradient-positions, 1);
$spec: nth($gradient-positions, 2);
}
@if $vendor {
$vendor-gradients: -#{$vendor}-#{$gradient-type}-gradient(#{$pre-spec} $gradients);
}
@else if $vendor == false {
$vendor-gradients: "#{$gradient-type}-gradient(#{$spec} #{$gradients})";
$vendor-gradients: unquote($vendor-gradients);
}
@return $vendor-gradients;
}

View File

@@ -1,10 +0,0 @@
@function _shape-size-stripper($shape-size) {
$shape-size-spec: null;
@each $value in $shape-size {
@if ($value == "cover") or ($value == "contain") {
$value: null;
}
$shape-size-spec: "#{$shape-size-spec} #{$value}";
}
@return $shape-size-spec;
}

View File

@@ -1,50 +0,0 @@
//************************************************************************//
// Helper function for linear/radial-gradient-parsers.
// Source: http://sassmeister.com/gist/9647408
//************************************************************************//
@function _str-to-num($string) {
// Matrices
$strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
$numbers: 0 1 2 3 4 5 6 7 8 9;
// Result
$result: 0;
$divider: 0;
$minus: false;
// Looping through all characters
@for $i from 1 through str-length($string) {
$character: str-slice($string, $i, $i);
$index: index($strings, $character);
@if $character == '-' {
$minus: true;
}
@else if $character == '.' {
$divider: 1;
}
@else {
@if not $index {
$result: if($minus, $result * -1, $result);
@return _convert-units($result, str-slice($string, $i));
}
$number: nth($numbers, $index);
@if $divider == 0 {
$result: $result * 10;
}
@else {
// Move the decimal dot to the left
$divider: $divider * 10;
$number: $number / $divider;
}
$result: $result + $number;
}
}
@return if($minus, $result * -1, $result);
}

View File

@@ -1 +0,0 @@
$asset-pipeline: false !default;

View File

@@ -1,6 +0,0 @@
// Variable settings for /addons/prefixer.scss
$prefix-for-webkit: true !default;
$prefix-for-mozilla: true !default;
$prefix-for-microsoft: true !default;
$prefix-for-opera: true !default;
$prefix-for-spec: true !default; // required for keyframe mixin

View File

@@ -1 +0,0 @@
$em-base: 16px !default;

View File

@@ -1,552 +0,0 @@
---
- - '839'
- Aaron Franks
- Aaron Gelter
- Adam Krebs
- Adam Mark
- Adam Solove
- Adam Timberlake
- Adam Zapletal
- Ahmad Wali Sidiqi
- Alan Souza
- Alan deLevie
- Alastair Hole
- Alex
- Alex Boyd
- Alex Lopatin
- Alex Mykyta
- Alex Pien
- Alex Smith
- Alex Zelenskiy
- Alexander Shtuchkin
- Alexander Solovyov
- Alexander Tseung
- Alexandre Gaudencio
- Alexey Raspopov
- Alexey Shamrin
- Andre Z Sanchez
- Andreas Savvides
- Andreas Svensson
- Andres Kalle
- Andres Suarez
- Andrew Cobby
- Andrew Davey
- Andrew Rasmussen
- Andrew Sokolov
- Andrew Zich
- Andrey Popp
- Anthony van der Hoorn
- Antonio Ruberto
- Antti Ahti
- Anuj Tomar
- AoDev
- Areeb Malik
- Aria Buckles
- Aria Stewart
- Arian Faurtosh
- Artem Nezvigin
- Austin Wright
- Ayman Osman
- Baraa Hamodi
- Bartosz Kaszubowski
- Basarat Ali Syed
- Battaile Fauber
- Beau Smith
- Ben Alpert
- Ben Anderson
- Ben Foxall
- Ben Jaffe
- Ben Moss
- Ben Newman
- Ben Ripkens
- Benjamin Keen
- Benjamin Leiken
- Benjamin Woodruff
- Bill Fisher
- Blaine Hatab
- Blaine Kasten
- Bob Eagan
- Bob Ralian
- Bob Renwick
- Bojan Mihelac
- Bradley Spaulding
- Brandon Bloom
- Brandon Tilley
- Brian Cooke
- Brian Holt
- Brian Hsu
- Brian Kim
- Brian Kung
- Brian Reavis
- Brian Rue
- Bruno Škvorc
- Cam Song
- Cam Spiers
- Carter Chung
- Cassus Adam Banko
- Cat Chen
- Cedric Sohrauer
- Charles Marsh
- Chase Adams
- Cheng Lou
- Chitharanjan Das
- Chris Grovers
- Chris Ha
- Chris Rebert
- Chris Sciolla
- Christian Alfoni
- Christian Oliff
- Christian Roman
- Christoph Pojer
- Christopher Monsanto
- Clay Allsopp
- Connor McSheffrey
- Cory House
- Cotton Hou
- Cristovao Verstraeten
- Damien Pellier
- Dan Abramov
- Dan Fox
- Dan Schafer
- Daniel Carlsson
- Daniel Cousens
- Daniel Friesen
- Daniel Gasienica
- Daniel Hejl
- Daniel Lo Nigro
- Daniel Mané
- Daniel Miladinov
- Daniel Rodgers-Pryor
- Daniel Schonfeld
- Danny Ben-David
- Darcy
- Daryl Lau
- Darío Javier Cravero
- David Baker
- David Goldberg
- David Greenspan
- David Hellsing
- David Hu
- David Mininger
- David Neubauer
- David Percy
- Denis Sokolov
- Dennis Johnson
- Devon Blandin
- Devon Harvey
- Dmitrii Abramov
- Dmitry Blues
- Dmitry Mazuro
- Domenico Matteo
- Don Abrams
- Dustan Kasten
- Dustin Getz
- Dylan Harrington
- Eduardo Garcia
- Edvin Erikson
- Elaine Fang
- Enguerran
- Eric Clemmons
- Eric Eastwood
- Eric Florenzano
- Eric O'Connell
- Eric Schoffstall
- Erik Harper
- Espen Hovlandsdal
- Evan Coonrod
- Fabio M. Costa
- Federico Rampazzo
- Felipe Oliveira Carvalho
- Felix Gnass
- Felix Kling
- Fernando Correia
- Frankie Bagnardi
- François-Xavier Bois
- Fred Zhao
- G Scott Olson
- G. Kay Lee
- Gabe Levi
- Gareth Nicholson
- Garren Smith
- Geert Pasteels
- Geert-Jan Brits
- George A Sisco III
- Georgii Dolzhykov
- Gilbert
- Glen Mailer
- Grant Timmerman
- Greg Hurrell
- Greg Perkins
- Greg Roodt
- Gregory
- Guangqiang Dong
- Guido Bouman
- Harry Hull
- Harry Marr
- - Harry Moreno
- Harshad Sabne
- Hekar Khani
- Hendrik Swanepoel
- Henrik Nyh
- Henry Zhu
- Hou Chia
- Hugo Jobling
- Héliton Nordt
- Ian Obermiller
- Ignacio Carbajo
- Igor Scekic
- Ilya Shuklin
- Ilyá Belsky
- Ingvar Stepanyan
- Irae Carvalho
- Isaac Salier-Hellendag
- Ivan Kozik
- Ivan Krechetov
- Ivan Vergiliev
- J. Andrew Brassington
- J. Renée Beach
- JD Isaacks
- JW
- Jack Zhang
- Jacob Gable
- Jacob Greenleaf
- Jae Hun Ro
- Jaime Mingo
- Jakub Malinowski
- James
- James Brantly
- James Burnett
- James Ide
- James Long
- James Pearce
- James Seppi
- James South
- Jamie Wong
- Jamis Charles
- Jamison Dance
- Jan Hancic
- Jan Kassens
- Jan Raasch
- Jared Forsyth
- Jason
- Jason Bonta
- Jason Ly
- Jason Miller
- Jason Quense
- Jason Trill
- Jason Webster
- Jay Jaeho Lee
- Jean Lauliac
- Jed Watson
- Jeff Barczewski
- Jeff Carpenter
- Jeff Chan
- Jeff Hicken
- Jeff Kolesky
- Jeff Morrison
- Jeff Welch
- Jeffrey Lin
- Jesse Skinner
- Jignesh Kakadiya
- Jim OBrien
- Jim Sproch
- Jimmy Jea
- Jing Chen
- Jinwoo Oh
- Jiyeon Seo
- Joe Stein
- Joel Auterson
- Johannes Baiter
- Johannes Emerich
- Johannes Lumpe
- John Heroy
- John Watson
- Jon Beebe
- Jon Chester
- Jon Hester
- Jon Madison
- Jon Scott Clark
- Jon Tewksbury
- Jonas Enlund
- Jonas Gebhardt
- Jonathan Hsu
- Jordan Harband
- Jordan Walke
- Jorrit Schippers
- Joseph Nudell
- Joseph Savona
- Josh Bassett
- Josh Duck
- Josh Yudaken
- Joshua Go
- Joshua Goldberg
- Joshua Ma
- João Valente
- Juan Serrano
- Julen Ruiz Aizpuru
- Julian Viereck
- Julien Bordellier
- Jun Wu
- Juraj Dudak
- Justin Jaffray
- Justin Robison
- Justin Woo
- Kamron Batman
- Karl Mikkelsen
- Karpich Dmitry
- Keito Uchiyama
- Kevin Coughlin
- Kevin Huang
- Kevin Old
- KimCoding
- Kirk Steven Hansen
- Kit Randel
- Kohei TAKATA
- Koo Youngmin
- Kunal Mehta
- Kurt Ruppel
- Kyle Kelley
- Kyle Mathews
- Laurence Rowe
- Laurent Etiemble
- Lee Byron
- Lee Jaeyoung
- Lei
- Leon Fedotov
- Leon Yip
- Leonardo YongUk Kim
- Levi Buzolic
- Levi McCallum
- Lily
- Logan Allen
- Luigy Leon
- Luke Horvat
- MIKAMI Yoshiyuki
- Marcin K.
- Marcin Kwiatkowski
- Marcin Szczepanski
- Mariano Desanze
- Marjan
- Mark Anderson
- Mark Funk
- Mark Hintz
- Mark IJbema
- Mark Richardson
- Marlon Landaverde
- Marshall Roch
- Martin Andert
- Martin Jul
- Martin Konicek
- Martin Mihaylov
- Masaki KOBAYASHI
- Mathieu M-Gosselin
- Matias Singers
- Matsunoki
- Matt Brookes
- Matt Dunn-Rankin
- Matt Harrison
- Matt Huggins
- Matt Zabriskie
- Matthew Dapena-Tretter
- Matthew Johnston
- Matthew King
- Matthew Miner
- Matthias Le Brun
- Matti Nelimarkka
- Max F. Albrecht
- Max Heiber
- Maxi Ferreira
- Maxim Abramchuk
- Merrick Christensen
- Mert Kahyaoğlu
- Michael Chan
- Michael Randers-Pehrson
- Michael Ridgway
- Michael Warner
- Michal Srb
- Michelle Todd
- Mihai Parparita
- Mike D Pilsbury
- - Mike Groseclose
- Mikolaj Dadela
- Minwe LUO
- Miorel Palii
- Morhaus
- Mouad Debbar
- Murad
- Murray M. Moss
- Nadeesha Cabral
- Naman Goel
- Nate Hunzaker
- Nathan White
- Neri Marschik
- Nicholas Bergson-Shilcock
- Nick Fitzgerald
- Nick Gavalas
- Nick Merwin
- Nick Raienko
- Nick Thompson
- Nick Williams
- Niklas Boström
- Ning Xia
- Niole Nelson
- Oiva Eskola
- Oleg
- Oleksii Markhovskyi
- Oliver Zeigermann
- Olivier Tassinari
- Owen Coutts
- Pablo Lacerda de Miranda
- Paolo Moretti
- Pascal Hartig
- Patrick Laughlin
- Patrick Stapleton
- Paul Harper
- Paul OShannessy
- Paul Seiffert
- Paul Shen
- Pedro Nauck
- Pete Hunt
- Peter Blazejewicz
- Peter Cottle
- Peter Jaros
- Petri Lehtinen
- Petri Lievonen
- Pieter Vanderwerff
- Pouja Nikray
- Prathamesh Sonpatki
- Preston Parry
- Rafael
- Rafal Dittwald
- Rajiv Tirumalareddy
- Randall Randall
- Ray
- Raymond Ha
- Reed Loden
- Richard D. Worth
- Richard Feldman
- Richard Kho
- Richard Littauer
- Richard Livesey
- Richard Wood
- Rick Beerendonk
- Riley Tomasek
- Rob Arnold
- Robert Knight
- Robert Sedovsek
- Robin Berjon
- Roman Vanesyan
- Russ
- Ryan Seddon
- Sahat Yalkabov
- Saif Hakim
- Sam Saccone
- Sam Selikoff
- Samy Al Zahrani
- Sander Spies
- Scott Burch
- Scott Feeney
- Sean Kinsey
- Sebastian Markbåge
- Seoh Char
- Serg
- Sergey Generalov
- Sergey Rubanov
- Seyi Adebajo
- Shane O'Sullivan
- Shaun Trennery
- ShihChi Huang
- Shim Won
- Shota Kubota
- Shripad K
- Sibi
- Simon Højberg
- Simon Welsh
- Sophia Westwood
- Spencer Handley
- Stefan Dombrowski
- Stephen Murphy
- Sterling Cobb
- Steve Baker
- Steven Luscher
- Stoyan Stefanov
- Sundeep Malladi
- Sunny Juneja
- Sven Helmberger
- Sverre Johansen
- Sébastien Lorber
- Sławomir Laskowski
- Taeho Kim
- Tay Yang Shun
- Ted Kim
- Teodor Szente
- Thomas Aylott
- Thomas Boyt
- Thomas Reggi
- Thomas Röggla
- Thomas Shaddox
- Thomas Shafer
- ThomasCrvsr
- Tienchai Wirojsaksaree
- Tim Routowicz
- Tim Schaub
- Timothy Yung
- Tobias Reiss
- Tom Haggie
- Tom Hauburger
- Tom MacWright
- Tom Occhino
- Tomasz Kołodziejski
- Tony Spiro
- Toru Kobayashi
- Trinh Hoang Nhu
- Tsung Hung
- Tyler Brock
- Ustin Zarubin
- Vadim Chernysh
- Varun Rau
- Vasiliy Loginevskiy
- Victor Alvarez
- Victor Koenders
- Ville Immonen
- Vincent Riemer
- Vincent Siao
- Vipul A M
- Vitaly Kramskikh
- Vjeux
- Volkan Unsal
- Wayne Larsen
- WickyNilliams
- Wincent Colaiuta
- Wout Mertens
- Xavier Morel
- XuefengWu
- Yakov Dalinchuk
- Yasar icli
- YouBao Nong
- Yuichi Hagio
- Yuriy Dybskiy
- Yuval Dekel
- Zach Bruggeman
- Zacharias
- arush
- brafdlog
- chen
- clariroid
- claudiopro
- cutbko
- davidxi
- dongmeng.ldm
- iamchenxin
- iamdoron
- imagentleman
- laiso
- li.li
- sugarshin
- wali-s
- yiminghe
- youmoo
- zhangjg
- Árni Hermann Reynisson
- 凌恒
- 张敏

View File

@@ -1,66 +0,0 @@
# Map of short name to more information. `name` will be used but if you don't
# want to use your real name, just use whatever. If url is included, your name
# will be a link to the provided url.
benigeri:
name: Paul Benigeri
url: https://github.com/benigeri
chenglou:
name: Cheng Lou
url: https://twitter.com/_chenglou
Daniel15:
name: Daniel Lo Nigro
url: http://dan.cx/
fisherwebdev:
name: Bill Fisher
url: https://twitter.com/fisherwebdev
gaearon:
name: Dan Abramov
url: https://twitter.com/dan_abramov
jaredly:
name: Jared Forsyth
url: https://twitter.com/jaredforsyth
jgebhardt:
name: Jonas Gebhardt
url: https://twitter.com/jonasgebhardt
jimfb:
name: Jim Sproch
url: http://www.jimsproch.com
jingc:
name: Jing Chen
url: https://twitter.com/jingc
josephsavona:
name: Joseph Savona
url: https://twitter.com/en_JS
kmeht:
name: Kunal Mehta
url: https://github.com/kmeht
LoukaN:
name: Lou Husson
url: https://twitter.com/loukan42
matthewjohnston4:
name: Matthew Johnston
url: https://github.com/matthewathome
petehunt:
name: Pete Hunt
url: https://twitter.com/floydophone
schrockn:
name: Nick Schrock
url: https://twitter.com/schrockn
sebmarkbage:
name: Sebastian Markbåge
url: https://twitter.com/sebmarkbage
spicyj:
name: Ben Alpert
url: http://benalpert.com
steveluscher:
name: Steven Luscher
url: https://twitter.com/steveluscher
vjeux:
name: Vjeux
url: https://twitter.com/vjeux
wincent:
name: Greg Hurrell
url: https://twitter.com/wincent
zpao:
name: Paul OShannessy
url: https://twitter.com/zpao

Some files were not shown because too many files have changed in this diff Show More