Commit Graph

2045 Commits

Author SHA1 Message Date
Cheng Lou 7cbbff01e7 Merge pull request #1334 from spicyj/non-numeric-top-level
Don't break on top-level non-numeric object keys
2014-03-30 14:03:18 -07:00
Ben Alpert a89ed9b8dc Don't break on top-level non-numeric object keys
Previously, this threw (in `__DEV__` only) in `ReactCurrentOwner.current.constructor.displayName` because `ReactCurrentOwner.current` is null:

```
React.renderComponent(<div>{{1: <div />, 2: <div />}}</div>, document.body);
```
2014-03-30 13:55:45 -07:00
Christopher Chedeau f99123b882 Merge pull request #1332 from chenglou/linter
[Jshint] Allow Jasmine globals in *-test.js
2014-03-30 13:13:49 -07:00
Cheng Lou 09ca4a9c80 [Jshint] Allow Jasmine globals in *-test.js
Editors that inline lint use`.jshintrc and directly lint the open
*-test.js files. This makes those linters actually useful.
2014-03-30 12:52:49 -07:00
Christopher Chedeau 70a8c55023 Merge pull request #1288 from vjeux/server_docs
Add client/server mention in componentDid/WillMount documentation
2014-03-28 23:24:20 -07:00
Christopher Chedeau 98ef7abb1a Merge pull request #1322 from spicyj/transformer-harmony
Add optional harmony support to browser transform
2014-03-28 23:22:17 -07:00
Ben Alpert e6c93f9246 Add optional harmony support to browser transform
This mirrors the react-tools API; it doesn't include support (yet) for transforming `<script type="text/jsx">` blocks with the ES6 transforms, mostly because I don't have a good API in mind there.

Test Plan:
Ran

    JSXTransformer.transform("var two = () => 2;", {harmony: true}).code

in Chrome's dev console and got back some ES5 code.
2014-03-28 18:26:20 -10:00
Cheng Lou 999b4cf1a8 Merge pull request #1318 from spicyj/existence
Fix spelling of 'existence'
2014-03-28 20:27:38 -07:00
Ben Alpert 4cb83566e0 Merge pull request #1320 from gasi/patch-2
Fix minor typo in `update` `$push` directive
2014-03-28 13:35:04 -10:00
Daniel Gasienica 5fc2ecbe92 Fix minor typo in update $push directive 2014-03-28 16:33:03 -07:00
Josh Duck e5c8831f90 Formatting
An extra "`" snuck in there.
2014-03-28 14:26:05 -07:00
Ben Alpert c0de6b51ff Fix spelling of 'existence' 2014-03-28 10:44:03 -10:00
Paul O’Shannessy a778bf2c51 [blog] The Road to 1.0 2014-03-28 13:38:28 -07:00
Paul O’Shannessy 7982ba0571 Merge pull request #1310 from plievone/patch-1
Fix hasOwnProperty check typo in mixStaticSpecIntoComponent
2014-03-28 13:09:14 -07:00
Isaac Salier-Hellendag 807e3dc423 BeforeInputEventPlugin: Support Opera <= 12
Add support for Opera <= 12 (Presto) in `BeforeInputEventPlugin`.

It turns out that Opera 12 has a `TextEvent` in `window`, but doesn't actually fire any input events. Even `input` apparently doesn't fire. Fall back to keypress handling in this case.
2014-03-28 12:33:10 -07:00
Sebastian Markbage c40e06f728 First phase to true descriptors
This moves all convenience constructors to use frozen ReactDescriptors.
2014-03-28 12:32:53 -07:00
Tom Occhino a91c9f38f8 Update CONTRIBUTING.md
Updating doc to point to the brand new CLA form at https://code.facebook.com/cla
2014-03-27 23:57:32 -07:00
Paul O'Shannessy fe9cecd507 Clean up assertions on descriptors
By making this fail, we catch a lot of tests that are expecting rendered
instances but are actually operating on descriptors.
2014-03-27 13:41:18 -07:00
Pete Hunt 976826aec0 Remove extraneous assert 2014-03-27 13:41:10 -07:00
plievone 65d16883a5 Fix hasOwnProperty check typo in mixStaticSpecIntoComponent 2014-03-27 21:21:12 +02:00
Cheng Lou 858fd2e4e2 Merge pull request #1309 from spicyj/dom-arg-order
Fix docstring arg order in createDOMComponentClass
2014-03-27 11:42:52 -07:00
Ben Alpert 3cdef1a86a Fix docstring arg order in createDOMComponentClass 2014-03-27 08:27:19 -10:00
Isaac Salier-Hellendag 5476f9168b Repair spacebar textInput
Browsers that natively support the `textInput` event appear to have a bug: when preventing default behavior for a `textInput` event occurring for a spacebar keypress, the character is prevented from being inserted **but the browser scrolls down**.

Minimal repro example: http://jsfiddle.net/salier/bX4fw/

This is ridiculous, since scrolling makes no sense when the user is focused in a textinput or contenteditable. Preventing default at the `textInput` stage should mean to prevent the character from being inserted, and should have no impact at all on scrolling behavior. I have filed this as a Chromium bug (https://code.google.com/p/chromium/issues/detail?id=355103) but I'm not going to hold out much hope that they'll fix it.

To resolve this, I'm special-casing the spacebar character at the plugin level, in `BeforeInputEventPlugin`. I looked for ways to do this at the component level, but it seems to me that this is simply a browser bug and it's cleaner to handle it there.

In browsers that can use the native `textInput` event, I'm checking the code of the pressed key. If it's the spacebar, we dispatch the synthetic event as if there were no native `textInput` event -- as if we were running Firefox. Then, if the synthetic event is not canceled and we make it through to the native `textInput` event, bail if the character data is a space character.
2014-03-25 13:05:44 -07:00
Cheng Lou 09333a3819 Remove last uses of {' '} in docs and tests
Whitespace fix is in, so no need for {' '} anymore.
2014-03-25 13:05:44 -07:00
Cheng Lou edc0fa4c3f assertValidProps for updating DOM components through renderComponent
`renderComponent(<div style={invalidType}/>, container)` throws correctly,
but not when it's called a second time (i.e. updating rather than mounting).
It goes through `ReactDOMComponent.updateComponent` but there wasn't a
props assertion there.
(Removed the assertion in `receiveComponent`)
2014-03-25 13:05:44 -07:00
Isaac Salier-Hellendag 116ee058eb TextInputEventPlugin, SyntheticTextInputEvent
This diff introduces `TextInputEventPlugin` and `SyntheticTextInputEvent`, which are based on Webkit's native `textInput` event.

In Chrome, Safari, and Opera, the `textInput` event fires prior to the insertion of character data into the document. For normal typing, for example, thevent sequence is: `keydown`, `keypress`, `textInput`, `input`, `keyup`. The `textInput` event contains a `data` field corresponding to the character data that will actually be inserted.

There is also a `beforeinput` event described by http://www.w3.org/TR/DOM-Level-3-Events/#event-type-beforeinput, and this is essentially that event, so it may make sense to rename the plugin.

This event is especially useful because it solves a number of issues we can't currently handle with only keypress and composition events:

  - **Windows Chrome: Trailing characters discarded in Korean IME.** For instance, `안녕하세요` becomes `안녕하세` with the final character discarded by the final `compositionend` event. The `textInput` event fires correctly with the final character.
  - **Windows Chrome: Special characters discarded in IME.** Certain ideographs are discarded in IME mode. In Japanese, typing the ideographic space character is not represented by keypress but //is// represented by the subsequent `textInput`. This issue also applies to punctuation characters in Chinese.
  - **OSX Chrome: Characters from palette discarded.** Inserting characters from the OSX character palette fails, since no keypress is fired.

The plugin is useful for Firefox and IE. For these, we record inserted characters via keypress and compositionend events and dispatch the synthetic event with these characters as the `data` field to match the native `textInput` event.

  - Firefox has no corresponding `textInput` event and has not yet implemented `beforeinput`.
  - IE has a native `textinput` event, but it fires after the DOM mutation has already occurred, so it isn't very useful as an analog to the Webkit version. I'm just not going to bother with it.
2014-03-25 13:05:44 -07:00
Christoph Pojer f10f32aaaf Remove objMapKeyVal 2014-03-25 13:05:44 -07:00
Christoph Pojer 6cbeee1e59 Rename objMap to mapObject
mapObject fits better with other module names ("flattenChildren", "traverseAllChildren" etc.) and highlights that it only works with objects - which is going to be more important once we'll have an ES6 Map polyfill.
2014-03-25 13:05:43 -07:00
Christopher Chedeau e55b9aa059 Add client/server mention in componentDid/WillMount documentation 2014-03-22 12:18:12 -07:00
Paul O’Shannessy f0eae5086b version bump for 0.11 development 2014-03-21 14:58:52 -07:00
Paul O’Shannessy aea3949062 0.10 release materials 2014-03-21 14:57:03 -07:00
Paul O’Shannessy 3b2d176f59 Update AUTHORS for 0.10 2014-03-21 13:21:20 -07:00
Pete Hunt 68da0eccbe Merge pull request #1282 from jeffbski/addCodewinds004Videos
add CodeWinds episode 4 w/Pete Hunt to videos
2014-03-21 12:54:48 +00:00
Jeff Barczewski 593889b87a add CodeWinds episode 4 w/Pete Hunt to videos
Added to videos.md
2014-03-21 07:41:06 -05:00
Paul O’Shannessy 732f4717a6 Merge pull request #1186 from chenglou/doc-toString-opt
[Docs] document optional param for renderComponentToString
2014-03-20 17:28:51 -07:00
Ben Newman 7807413256 Upgrade Commoner to v0.9.2 to silence deprecation warnings.
Closes #1278.
2014-03-20 14:43:47 -04:00
Ben Alpert ec893833ee Merge pull request #1273 from wincent/typo-fix-02
Fix a minor typo in the `update()` docs
2014-03-19 15:37:30 -07:00
Greg Hurrell 5aaf4dbae9 Fix a minor typo in the update() docs 2014-03-19 15:33:43 -07:00
Paul O’Shannessy ecea2918cf 0.10rc blog post 2014-03-18 22:15:16 -07:00
Paul O’Shannessy 7f24943e5a update version for 0.10rc v0.10.0-rc1 2014-03-18 22:09:32 -07:00
Paul O’Shannessy 0491d30e7c re-enable moved root warning 2014-03-18 22:03:25 -07:00
Paul O’Shannessy 55b0222596 Upgrade browserify 2014-03-18 21:33:39 -07:00
Paul O’Shannessy b95fbbe4a2 Silence tests unsupported in PhantomJS.
These tests can still be run in the browser using `grunt test --debug`.

This is a repeat of 42f8d155f8. For posterity, we
do this because Phantom has a problem with Object.freeze and the test runner
can't do __DEV__ right (because we get rid of that in the build step).
2014-03-18 17:48:16 -07:00
Kunal Mehta e505e47e01 Separate immutable project
This moves Immutable and Immutable object into the new `immutable` project.
2014-03-18 15:03:26 -07:00
Sebastian Markbage e0c487649d Logging use of objects as maps for children
Let's start logging objects as maps for children. We may want to deprecate this
and replace it with ImmutableMap and Map data structures instead.

This should ideally be logged in the recursive function but since that loses the
scope of where these children are passed it's easier to start tracking them
here to get an idea of how frequently and where it's used.
2014-03-18 15:01:51 -07:00
Andrew Zich 22057ef61c don't try to use Object.prototype methods as transfer strategies in ReactPropTransferer.mergeProps
While looking up a detail of how `transferPropsTo()` works I noticed that we never check `TransferStrategies.hasOwnProperty(thisKey)` when merging props, just `newProps.hasOwnProperty(thisKey)` and a truthy test for `TransferStrategies[thisKey]`. This means that if our `newProps` has keys like `toString`, `valueOf`, or `constructor` etc. set, we will pull these functions off `TransferStrategies` and invoke them when merging props. In most cases this will just result in a failure to merge and some code without side effects being run but in the case of `valueOf` it will actually generate an exception.
2014-03-18 15:01:46 -07:00
Josh Duck 0278f01d95 Replace function expression with for loop
isCustomAttribute used an anonymous function in place of a for loop.
Swap it out so we're not allocating unnecessarily.
2014-03-18 14:57:08 -07:00
Kunal Mehta 0cec4af8d7 Sync latest Immutable changes 2014-03-18 14:57:04 -07:00
Paul O’Shannessy 8d495f3b6e Revert "Merge pull request #1234 from RReverser/pure-cjs"
This reverts commit 7987e6a51d, reversing
changes made to d88d479685.
2014-03-18 11:25:21 -07:00
Ben Newman 7987e6a51d Merge pull request #1234 from RReverser/pure-cjs
Switched from browserify to pure-cjs bundler.
2014-03-18 12:04:58 -04:00