Commit Graph

2554 Commits

Author SHA1 Message Date
Sebastian Markbage
2d069fc5e6 Fix typo
Resets currentTarget on the pooled event instead of adding an
expando.
2016-04-05 13:40:49 -07:00
Paul O’Shannessy
d10b355b42 Merge pull request #6228 from everdimension/fix_option_value
set value property explicitly for "option" element even if value is empty
2016-04-05 13:27:13 -07:00
Paul O’Shannessy
1573baaee8 Use Object.assign directly and inject object-assign at compile 2016-04-04 09:53:25 -07:00
Dan Abramov
ec1462834e Update ReactDOMProduction-test.js 2016-04-02 00:53:01 +01:00
Dan Abramov
575fb79162 Add ReactDebugInstanceMap
This PR is the first in a series of pull requests split from the new `ReactPerf` implementation in #6046.

Here, we introduce a new module called `ReactDebugInstanceMap`. It will be used in `__DEV__` and, when the `__PROFILE__` gate is added, in the `__PROFILE__` builds. It will *not* be used in the production builds.

This module acts as a mapping between “debug IDs” (a new concept) and the internal instances. Not to be confused with the existing `ReactInstanceMap` that maps internal instances to public instances.

What are the “debug IDs” and why do we need them? Both the new `ReactPerf` and other consumers of the devtool API, such as React DevTools, need access to some data from the internal instances, such as the instance type display name, current props and children, and so on. Right now we let such tools access internal instances directly but this hurts our ability to refactor their implementations and burdens React DevTools with undesired implementation details such as having to support React ART in a special way.[1]

The purpose of adding `ReactDebugInstanceMap` is to only expose “debug IDs” instead of the internal instances to any devtools. In a future RP, whenever there is an event such as mounting, updating, or unmounting a component, we will emit an event in `ReactDebugTool` with the debug ID of the instance. We will also add an introspection API that lets the consumer pass an ID and get the information about the current children, props, state, display name, and so on, without exposing the internal instances.

`ReactDebugInstanceMap` has a concept of “registering” an instance. We plan to add the hooks that register an instance as soon as it is created, and unregister it during unmounting. It will only be possible to read information about the instance while it is still registered. If we add support for reparenting, we should be able to move the (un)registration code to different places in the component lifecycle without changing this code. The currently registered instances are held in the `registeredInstancesByIDs` dictionary.

There is also a reverse lookup dictionary called `allInstancesToIDs` which maps instances back to their IDs. It is implemented as a `WeakMap` so the keys are stable and we’re not holding onto the unregistered instances. If we’re not happy with `WeakMap`, one possible alternative would be to add a new field called `_debugID` to all the internal instances, but we don’t want to do this in production. Using `WeakMap` seems like a simpler solution here (and stable IDs are a nice bonus). This, however, means that the `__DEV__` (and the future `__PROFILE__`) builds will only work in browsers that support our usage of `WeakMap`.

[1]: 577ec9b8d9/backend/getData.js
2016-03-31 17:58:55 +01:00
Jim
eb85b7b2c9 Merge pull request #6381 from cbrwizard/clipboard_event_unit_tests
SyntheticClipboardEvent unit tests
2016-03-31 07:37:31 -07:00
Dan Abramov
b6bc4bd996 Spy at warnings consistently inside test cases
We move any spies on `console.error()` from `beforeEach()` to the individual `it()` tests. This means that if a new test is introduced in these suites, it does not ignore warnings by default, but fails on any unexpected warning, which is Jest's default behavior.

We also change a few old instances of direct `console.error = jest.genMockFn()` assignment to use `spyOn()` for consistency with the rest of the tests.
2016-03-30 22:01:20 +01:00
cbrwizard
e6e38d0f9c SyntheticClipboardEvent unit tests
Adds unit tests for a SyntheticClipboardEvent.
2016-03-30 23:09:23 +03:00
cbrwizard
d743a8dd55 SyntheticKeyboardEvent unit tests
Adds unit tests for SyntheticKeyboardEvent.
2016-03-29 22:28:11 +03:00
Jim
dcd092560d Merge pull request #6305 from maherbeg/maher-error-find-dom-node
Test to verify findDOMNode does not throw in willMount
2016-03-24 18:59:55 -07:00
Maher Beg
70de7e4a38 Test to verify findDOMNode does not throw in willMount
Adds a test to prevent a regression of throwing an error when
calling `findDOMNode(this)` in a component's `componentWillMount`
function. This previously used to throw an invariant violation but
now does not any more.
2016-03-24 18:06:27 -07:00
Paul O’Shannessy
6a8ebfc418 Merge pull request #6331 from zpao/isonpmorphic
Make Browserify-specific modules to remove DOM dependencies from npm package
2016-03-24 16:01:51 -07:00
Paul O’Shannessy
d17091ddeb Make Browserify-specific modules to remove DOM dependencies from npm package 2016-03-24 15:28:52 -07:00
Jim
414f057bc2 Merge pull request #6296 from jontewks/add-warnings
Add warnings for onFocusIn and onFocusOut props
2016-03-24 08:37:45 -07:00
Dan Abramov
0f1240e877 Fix ReactPerf.printOperations() test to work with createElement = false 2016-03-23 22:24:32 +00:00
Paul O’Shannessy
bfb9444300 Merge pull request #6242 from edvinerikson/add-origin-to-css-warnings
added component name to css property warnings
2016-03-23 12:12:51 -07:00
Dan Abramov
1e8156143a Merge pull request #6310 from gaearon/setstate-warning
Add more specific error messages for bad callback in setState, replaceState, and ReactDOM.render
2016-03-23 14:50:36 +00:00
Jon Tewksbury
a7fae7e4c7 Add warnings for onFocusIn and onFocusOut props 2016-03-21 17:22:37 -07:00
Jim
c528732504 Merge pull request #6307 from cbrwizard/getEventCharCode_unit_tests
getEventCharCode unit tests
2016-03-21 16:17:06 -07:00
Dan Abramov
af4fe68b14 Change message format to be more consistent with other errors 2016-03-21 23:13:47 +00:00
Dan Abramov
d4657b8331 Add bad callback invariants to ReactDOM.render() calls 2016-03-21 22:33:15 +00:00
Dan Abramov
ebe5128489 Use specific method names in error messages 2016-03-21 21:40:17 +00:00
Dan Abramov
552f00b536 Make setState() callback error message more descriptive
Fixes #6306
2016-03-21 21:24:19 +00:00
Victor Homyakov
0393488f39 Free memory allocated by testElement after usage
IE11 reports `testElement` as detached DOM node consuming memory. It is captured in closure of `setInnerHTML` function and could be safely cleared after feature test.
2016-03-21 14:07:26 +03:00
cbrwizard
7bdf4dba75 getEventCharCode unit tests
Adds unit tests to getEventCharCode.
2016-03-21 12:56:45 +03:00
Dan Abramov
cfec10bd51 Remove unused export from DOMChildrenOperations 2016-03-19 21:05:05 +00:00
Dan Abramov
b6547734c6 Strip complex values from ReactPerf.printDOM() output
Fixes #6288
2016-03-17 21:23:43 +00:00
Dan Abramov
ea55d66760 Rename ReactPerf methods to match the upcoming ReactPerf revamp 2016-03-17 20:18:42 +00:00
Dan Abramov
b322d65320 Fix the ReactDefaultPerf test to match changes in #6286 2016-03-17 19:23:21 +00:00
Dan Abramov
67647fd82f Merge pull request #6286 from gaearon/opaque-perf-measurements
Make ReactPerf.getLastMeasurements() opaque
2016-03-17 19:12:07 +00:00
Dan Abramov
51d37c64c3 Make ReactPerf measurements opaque
We intend to change the measurement format significantly in #6046. In order to introduce the new ReactPerf during 15.x release cycle, we are making the measurement structure opaque-ish in 15.0.
2016-03-17 18:48:55 +00:00
Jim
663a78399c Merge pull request #6273 from cbrwizard/getEventKey_tests
getEventKey unit tests
2016-03-17 10:38:16 -07:00
Dan Abramov
e04a138634 Merge pull request #6276 from gaearon/fix-custom-components
Skip all special props when setting attributes on web components
2016-03-17 15:44:40 +00:00
Dan Abramov
97038d1ff7 v15.0.0-rc.2 2016-03-16 21:21:34 +00:00
Dan Abramov
c395c0977f Skip all special props when setting attributes on web components 2016-03-16 21:10:47 +00:00
Dan Abramov
9f418df8b3 Revert "Bug fix for issue 5202" 2016-03-16 20:42:28 +00:00
cbrwizard
07824258c6 getEventKey unit tests
Adds unit tests to getEventKey function.
2016-03-16 22:09:41 +03:00
Jim
745108f625 Merge pull request #6270 from rofrischmann/unitless-css-property
added several new unitless properties
2016-03-16 11:21:41 -07:00
Jim
93752bb175 Merge pull request #6226 from antoaravinth/PR-5202
Bug fix for issue 5202
2016-03-16 09:48:01 -07:00
rofrischmann
318e024338 added several new unitless properties 2016-03-16 10:04:09 +01:00
Dan Abramov
9268c1a710 Add vector-effect to SVG whitelist
Requested in https://github.com/facebook/react/issues/1657#issuecomment-148420568
2016-03-15 20:51:54 +00:00
Dan Abramov
6882c7ca40 Add focusable attribute to SVG whitelist
Fixes #6212
2016-03-15 20:18:57 +00:00
Paul O’Shannessy
20e1acb7dd Merge pull request #6210 from rofrischmann/unitless-border-image-outset
added borderImageOutset to unitless CSS properties
2016-03-11 11:34:30 -08:00
Paul O’Shannessy
ec25297def Merge pull request #6243 from zpao/fuck-svg-2
Revert SVG passthrough and expand whitelist
2016-03-11 11:33:45 -08:00
Paul O’Shannessy
5a17a1ef1d Update DOMLazyTree fragments comment to reflect reality 2016-03-11 11:30:03 -08:00
Paul O’Shannessy
a0a72004e5 Fix lint warnings due to backouts 2016-03-11 11:23:53 -08:00
Paul O’Shannessy
48a1cc52d7 Remove attributes already specified in the HTML config 2016-03-11 11:08:56 -08:00
Paul O’Shannessy
37fc21f1e8 Use 0 instead of null in property config
We're using this value to check bits and null is 0 in that sense anyway. This shaves off a few bytes (though as expected, gzip is virtually unchanged)
2016-03-11 11:08:56 -08:00
Paul O’Shannessy
79a62b09ea Consolidate SVG config to avoid some duplication 2016-03-11 11:08:56 -08:00
Paul O’Shannessy
afda226cb9 Scrape MDN for latest SVG 2016-03-11 11:08:56 -08:00