Commit Graph

1103 Commits

Author SHA1 Message Date
Paul O’Shannessy eb3ea3f2df Move batchedUpdated to React.addons
This is a followup to #1060, where I did not read closely enough before
merging.
2014-08-13 15:40:40 -07:00
Paul O’Shannessy 938bcbecd5 Merge pull request #1060 from spicyj/gh-906
Add React.batchedUpdates to public API
2014-08-13 15:37:43 -07:00
Karpich Dmitry a185f09943 Add classid property for <object/> tag
This properties needed to work with ActiveX objects in IE, created by
<object/> tag.

Closes #1526
2014-08-13 13:28:19 -07:00
Ben Alpert e2ac2f326c Improve Danger error message to not blame React 2014-08-11 15:18:07 -07:00
Paul O’Shannessy 986f5a1a07 Merge pull request #1662 from gaearon/warn-when-using-hyphenated-style-names
Warn when using hyphenated style property names

Closes #1662

Conflicts:
	src/browser/ui/dom/CSSPropertyOperations.js
2014-08-11 10:18:08 -07:00
Josh Duck f71455fb31 Fire onBeforeUpdate for space on Android
We deliberately skip the event, but Android Chrome
doesn't fire the keypress, so this is wrong.
2014-08-06 16:41:56 -07:00
Sebastian Markbage 036d751397 Add createElement alias for createDescriptor 2014-08-06 16:41:47 -07:00
Cheng Lou aaa8a5ff50 Merge pull request #1990 from syranide/rmctest
Simplified and improved test-cases for ReactMultiChildText-test
2014-08-06 11:20:59 -07:00
Andreas Svensson 41d5cee44e Simplified and improved test-cases for ReactMultiChildText-test 2014-08-05 23:40:11 +02:00
Ben Alpert 3045291417 Slightly more considerate devtools warning
See #953.
2014-08-04 11:16:51 -07:00
Paul O’Shannessy 5d288deba5 Merge pull request #1956 from syranide/ffenter
Improve normalization of charCode, fix FF not reporting Enter
2014-07-31 15:11:09 -07:00
Andreas Svensson b83076468d Improve normalization of charCode, fix FF not reporting Enter 2014-07-31 22:00:23 +02:00
Paul O’Shannessy ab2406ffec Merge pull request #1885 from syranide/testinnerhtml
Use faster cached regexps for tests in setInnerHTML
2014-07-31 11:44:21 -07:00
Paul O’Shannessy 590e5057bc Merge pull request #1759 from spicyj/gh-1698
Use setImmediate to defer value restoration
2014-07-29 20:15:59 -07:00
Paul O’Shannessy 0a1c5dad67 Merge pull request #1758 from spicyj/setimmediate
Add ReactUpdates.setImmediate for async callbacks
2014-07-29 20:15:31 -07:00
Paul O’Shannessy 45c719942e Merge pull request #1854 from syranide/floatfix
cssFloat is only accessible as styleFloat on IE8
2014-07-29 13:00:20 -07:00
Andreas Svensson ffafae5cfe cssFloat is only accessible as styleFloat on IE8 2014-07-29 10:15:01 +02:00
Sebastian Markbage c6b2687bbd Partially revert React.createDescriptor
We still have some issues to work out when the type argument is a mock.
2014-07-25 16:48:10 -07:00
Paul O’Shannessy d526456951 Delete ImmutableObject-test.js
Our syncing doesn't update these tests so just remove them.
2014-07-25 16:47:48 -07:00
andres suarez 1961fecf2d ReactTransitionChildMapping comment typo 2014-07-25 09:03:51 -04:00
Cheng Lou af21aeb59f Merge pull request #1924 from spicyj/autobind-bind
Use .bind when autobinding
2014-07-25 01:34:15 -07:00
Cheng Lou 7f584f3a49 Merge pull request #1511 from syranide/strsidefx
HAS_SIDE_EFFECTS should compare by type-casting
2014-07-24 13:38:01 -07:00
Paul O’Shannessy f76d4dd48f Merge pull request #1770 from eins78/master
Also list <form> in error message as possible culprit
2014-07-24 12:53:19 -07:00
Ben Alpert f1508c4937 Use .bind when autobinding
This eliminates all of the `boundMethod` frames from call stacks when debugging and as far as I know should behave the same otherwise.

Test Plan: jest
2014-07-24 12:11:19 -07:00
Andreas Svensson 3b94abcb3b HAS_SIDE_EFFECTS properties must compare as property type 2014-07-24 11:53:02 +02:00
Paul O’Shannessy efdc5da097 Merge pull request #1903 from syranide/ie8nmlb
Remove empty TextNode left behind by IE8 setInnerHTML workaround
2014-07-23 18:40:35 -07:00
Cheng Lou b0945b16cc Merge pull request #1560 from spicyj/simplify-lifecycle
Simplify composite lifecycle state
2014-07-23 18:02:39 -07:00
Andreas Svensson 8a135c0e75 Remove empty TextNode left behind by IE8 setInnerHTML workaround 2014-07-23 21:52:56 +02:00
Paul O’Shannessy 13e2c38a01 Merge pull request #1865 from syranide/modistatefalse
getModifierState should always return a boolean
2014-07-23 10:12:49 -07:00
Andreas Svensson 030071dd8b getModifierState should always return a boolean 2014-07-23 10:01:22 -07:00
Cheng Lou 79076fad9c Merge pull request #1774 from syranide/ie8focusthrow
Fix IE8 potentially throwing during restoreSelection
2014-07-22 16:29:07 -07:00
Paul O’Shannessy 6d02e04672 Merge pull request #1879 from syranide/modistatewrong
getModifierState incorrectly exposed as SyntheticMouseEvent.getEventModifierState
2014-07-22 15:50:15 -07:00
Ben Alpert 354fb44299 Use setImmediate to defer value restoration
Depends on #1758.

Fixes #1698.

Previously, controlled components would update too soon when using something like ReactLayeredComponentMixin (i.e., before the layer's updates could propagate from the parent), causing the cursor to jump even when always updating the new model value to match the DOM state. With this change, we defer the update until after all nested updates have had a chance to finish, which prevents the cursor from misbehaving.

Also cleaned up the logic around updating a bit -- the .value and .checked updates in ReactDOMInput weren't being relied on at all so I removed them and opted for a simple forceUpdate instead. I also got rid of _isChanging which hasn't been necessary since the introduction of update batching.

Test Plan: Tested the example in http://jsfiddle.net/Bobris/ZZtXn/2/ and verified that the cursor didn't jump. Changed the code to filter out numbers and verified that the field prevents typing numbers (attempting to do so still causes the cursor to jump to the end). Also verified that controlled and uncontrolled radio buttons, textareas, and select boxes work.
2014-07-21 22:42:18 -07:00
Ben Alpert 12b532c253 Add ReactUpdates.setImmediate for async callbacks
Callbacks passed to this setImmediate function are called at the end of the current update cycle, which is guaranteed to be asynchronous but in the same event loop (with the default batching strategy).

This is useful for new-style refs (#1373, #1554) and for fixing #1698.

Test Plan: jest
2014-07-21 22:41:00 -07:00
Ben Alpert 6259d88f03 Simpler way to prevent flushing updates on server
Test Plan: Only failing tests in jest are immutable tests that were already failing.
2014-07-21 17:25:52 -07:00
Paul O’Shannessy 04e341936c Include Object.assign polyfill
This isn't a good final solution but it makes React actually usable on
its own.

This also makes tests runnable, though only via jest
(./node_modules/.bin/jest)
2014-07-21 16:18:12 -07:00
robarnold 83e5e9bedf Fix small issue in ReactContext comment
Noticed this the other day and meant to fix it.
2014-07-19 19:09:35 -07:00
Andreas Svensson 6950a8418c Use faster cached regexps for tests in setInnerHTML 2014-07-19 21:00:35 +02:00
Andreas Svensson 6f0db65777 getModifierState incorrectly exposed as SyntheticMouseEvent.getEventModifierState 2014-07-19 10:44:11 +02:00
Sebastian Markbage c419cce5c9 Move defaultProps resolution to the descriptor factory
Moves the defaultProps resolution to the descriptor factory.
2014-07-18 22:01:36 -07:00
Sebastian Markbage 3a7dbe6b73 Deprecate transferPropsTo 2014-07-18 22:01:36 -07:00
Paul O'Shannessy de711efcc9 When proxying statics functions, copy properties
Port of 076047012a which went in
externally before ReactLegacyDescriptor happened, so it needed to be
ported.
2014-07-18 22:01:36 -07:00
Ben Newman 23c5332208 Fix ReactTestUtils.mockComponent so that mockTagName is not ignored.
The `mockTagName` parameter was always optional, and so probably was not
used very often. If you tried to use it, it would be shadowed by the
`var mockTagName` declaration in the `render` method, so only
`module.mockTagName` or `"div"` were ever possible values.
2014-07-18 22:01:36 -07:00
Ben Newman 2347abf75c Don't call window.getSelection when it isn't defined.
Sadly, jsdom does not support `window.getSelection` yet, but
`ExecutionEnvironment.canUseDOM` is `true` in a jsdom environment.
2014-07-18 22:01:36 -07:00
Sebastian Markbage 3818656f70 Use Object.assign in merge/mergeInto
Relax the argument type checks. Currently we throw for non-objects and terminals
but Object.assign does a coercion to Object instead. It also allows merging
Arrays as if they are objects.

This also relaxes the check for dependents such as ImmutableObject. This sucks
but it will allow us to use a fast code path to native Object.assign.

We always have the option of adding warnings to Object.assign or static type
checks.

I'm keeping the null check. Object.assign throws for null checks.

We'll also start returning the result of coercions just like Object.assign.
2014-07-18 22:01:36 -07:00
Sebastian Markbage 225d76f772 Drop transferPropsTo usage in React core
These were completely unnecessary uses of transferPropsTo.
2014-07-18 22:01:36 -07:00
Ben Newman 66cdba3dfb Avoid leading spaces when first argument to joinClasses is falsy.
This detail is going to become more important once the idiom
`className={joinClasses(this.props.className, newClass)}` becomes more
common, as it will when we move away from `this.transferPropsTo`.
2014-07-18 22:01:36 -07:00
Sebastian Markbage 5aab0bddaa Move key/ref off props and prepare for new descriptor factories
Breaking changes

- key/ref are no longer accessible on props but they are accessible on the
  descriptors. This means that parents/owners can access it but not the
  component itself.

- Descriptor factories are now plain functions and you can't rely on the
  prototype or constructors of descriptors to identify the component type.

Existing descriptor factories are now wrapped in a legacy factory. Currently it
does nothing but it will give us a hook to track callers to factories that are
not using JSX but just invoking the function directly. It also proxies static
methods/properties to the underlying class. The newer factories don't have this
feature.

ReactTextComponent has it's own little factory because it's props is not an
object. This is a detail and will go away once ReactTextComponent no longer
needs descriptors.
2014-07-18 22:01:36 -07:00
Paul O’Shannessy 9929f6de1e Merge pull request #1870 from spicyj/gh-1866
Don't initialize reconcile transaction on server
2014-07-18 16:40:03 -07:00
Paul O’Shannessy 8439deadd0 Merge pull request #1869 from syranide/modistatecase
getModifierState is case sensitive
2014-07-18 16:13:34 -07:00