Commit Graph

743 Commits

Author SHA1 Message Date
Paul O’Shannessy 848a8e1180 Remove animation "example"
It was never a real example and shouldn't have been checked in.
2013-09-25 11:08:24 -07:00
Paul O’Shannessy fc0b68af28 Fix 404s to non-existent API docs 2013-09-24 16:00:52 -07:00
Paul O’Shannessy c6f831e85f Redirect docs/reference.html 2013-09-24 15:47:17 -07:00
Vjeux 58173edb16 Community round-up #8 2013-09-24 14:18:11 -07:00
Pete Hunt fc73bf0a0a ReactLink: two-way binding for React
This introduces `ReactLink` which is a super lightweight way to do two-way binding for React.

If you want to use a controlled form input today, it's a lot of lines of code:

http://jsfiddle.net/T3z3v/

Look how many times `name` is repeated in there. And you have to remember to wire up event handles and pass the right state and
right event handler for *each* form field. It's really annoying.

With ReactLink, you can "link" a form value to a state field. It's just some simple sugar around the value prop/onChange
convention:

https://gist.github.com/petehunt/6689857

Ah, much nicer! And requires very little core changes or extra bytes. `ReactLink` just wraps the current value and "request
change" handler into a little object and provides some sugar to create some from composite component state.
2013-09-24 12:14:25 -07:00
Marshall Roch 458836abd3 Fix use of 'window' in CompositionEventPlugin
access to `window` needs to be guarded by `ExecutionEnvironment.canUseDOM`.
2013-09-23 23:01:14 -07:00
Josh Duck 5d7633d74c Move composition event to plugin with polyfill
Move compositionstart/compositionend to a new event plugin.

Add a polyfill that listens to key and mouse events and uses selection to
determine which text has changed.
2013-09-23 16:27:01 -07:00
Josh Duck 8f15eea910 Add ReactDOMSelection module
Add a DOM based selection module. This can both be used on its own and
in ReactInputSelection where our current implementation is lacking.

There is still some inconsistency with how IE and modern browsers
handle block nodes. Should be OK if we are just getting and setting
and not trying to set selection based on character offsets.
2013-09-23 16:23:35 -07:00
Paul O’Shannessy d27746ee0b Docs: Give headers ids for easy linking
This gives markdown headers an id so that we can link directly to
sections of our docs. This is better than the alternative of adding them
all ourselves.
2013-09-23 10:30:51 -07:00
Keito Uchiyama d13ce702a8 Fix typo in doc 2013-09-22 15:09:36 -07:00
Keito Uchiyama d262285827 Fix use of "it's" in docs 2013-09-22 13:24:25 -07:00
Jeff Morrison b5a11a431e Merge pull request #336 from spicyj/jsx-spacing
JSX: Respect original spacing and newlines better
2013-09-20 10:59:21 -07:00
Pete Hunt 832d9de037 Rename unmountAndReleaseReactRootNode() -> unmountComponentAtNode()
This is just a better name; we may revisit the name later.
2013-09-19 14:46:49 -07:00
Josh Duck 578863881f Add composition events to React.
Composition events make it possible to detect IME entry/exit.
https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
2013-09-19 14:30:21 -07:00
Paul O’Shannessy 8875e1dc3b Merge pull request #359 from SanderSpies/master
Give the user a warning when using unoptimized JSX code
2013-09-19 13:14:12 -07:00
SanderSpies cd79ed32cb - removed creation of the id within the tooling integration doc (expect this to be done by @zpao's pull request)
- removed the if statement and now always provide a warning message (as proposed by @spicyj)
- improved the warning message
2013-09-19 06:48:38 +02:00
SanderSpies 1924b7c945 Correcting the markdown anchor 2013-09-19 00:58:37 +02:00
SanderSpies d2bf50c63d Give the user a warning when using unoptimized JSX code and send the user to the correct location in the documentation to optimize. 2013-09-19 00:55:10 +02:00
Ben Newman b1dd4149a0 Merge pull request #343 from benjamn/fix-if-statement-pruning
Make constant propagation smarter about pruning if statements
2013-09-18 11:10:56 -07:00
Paul O’Shannessy 208ebd35b7 Don't update the docs version by default
This was leading to a lot of unnecessary churn in the config file since
different YAML versions were serializing differently.
2013-09-18 10:40:12 -07:00
Ben Newman adda400602 Make constant propagation smarter about pruning if statements. 2013-09-18 13:33:45 -04:00
Pete Hunt a9d53dae72 Merge pull request #351 from spicyj/api-docs
Flesh out reference documentation, more API info
2013-09-17 16:12:16 -07:00
Tim Yung ea0cde2cf4 Fix PropTypes Documentation 2013-09-17 16:09:23 -07:00
Sebastian Markbage e5ba82a44b Fix DOM node warning
bdf2a9bb12 broke the warning that children aren't suppose to be real DOM nodes.
2013-09-17 16:04:44 -07:00
Ben Alpert 364d6029b6 Flesh out reference documentation, more API info 2013-09-17 16:01:57 -07:00
Pete Hunt 735223fc9f Merge pull request #356 from yungsters/master
Add link to third-party `JavaScript (JSX).tmLanguage` in docs.
2013-09-17 13:35:59 -07:00
yungsters be9ac236fd Add link to third-party `JavaScript (JSX).tmLanguage` in docs. 2013-09-17 13:30:53 -07:00
Josh Duck ed7fa0ed22 Stop ReactInputSelection breaking in IE8
In the IE code path the method assumed that the input.value property
was non-null. A quick fix is to use either value or innerText; which means
the same code can be shared for textarea and contentEditable components.

The code is slightly buggy because the range.parentElement() !== input check
will fail for contentEditable components when the focus within a deep DOM tree.
2013-09-14 06:18:03 -07:00
Tim Yung 3e4302e6ae Fix lint errors in tests 2013-09-14 06:17:50 -07:00
Josh Duck 1a38cb9e07 Ensure selection range exists
The selection object doesn't always have ranges. In Chrome the
selection is not updated before 'focus' event handlers are fired. See
http://jsfiddle.net/t4DYA/ for example.

The selection will have rangeCount of 0 and calling getRangeAt(0) will
throw error "Uncaught IndexSizeError: Index or size was negative, or greater
than the allowed value."
2013-09-14 06:16:15 -07:00
Paul O’Shannessy 71ad5cb37a Update wording 2013-09-14 13:48:17 +02:00
Paul O’Shannessy 8a7c977942 Merge pull request #338 from spicyj/fullpage-tests
Fix ReactRenderDocument tests
2013-09-11 16:54:48 -07:00
Paul O’Shannessy 63bacfacfd Merge pull request #339 from spicyj/doc-rendering
Fix full-page rendering
2013-09-11 16:54:31 -07:00
Paul O’Shannessy c8ec4595bb Merge pull request #344 from benjamn/fix-silent-test-failure-due-to-requiring-React
Use a regular expression to parse out React.version
2013-09-11 16:03:59 -07:00
Ben Newman 133ea3df09 Use a regular expression to parse out React.version.
This fixes a silent failure of the test suite that appears to be due to
the call require('./build/modules/React').
2013-09-11 18:41:56 -04:00
Paul O’Shannessy f729a28f3c Delete version.js
This file is an artifact of a build process long abandoned.
2013-09-11 14:20:26 -07:00
Paul O’Shannessy 7ff11c3c88 Merge pull request #332 from spicyj/radio-test
Fix radio input test in Chrome
2013-09-11 13:45:47 -07:00
Paul O’Shannessy 5ab68d9a0d Hard code version instead of doing constant replacement
This isn't really ideal, but it makes it so that people managing to
build with @providesModule still get a consistent experience (since this
is what gets packed client-side with react-page-middleware anyway).
2013-09-11 09:51:43 -07:00
Ben Alpert 58fae896fe Fix full-page rendering
Closes #337.

Test Plan:
Opened react-page sample without any JS errors. Also ran grunt test after cherry-picking this changeset on top of #338.
2013-09-11 01:26:49 -07:00
Ben Alpert fea4fec0bc Fix ReactRenderDocument tests
I am unsure how this was ever supposed to work, as testDocument is guaranteed to be undefined at that point since beforeEach doesn't run synchronously. (I don't think there's any way to have beforeEach halt the tests.)
2013-09-10 22:42:05 -07:00
Paul O’Shannessy d853bbcf77 Merge pull request #205 from spicyj/version
Add React.version
2013-09-10 18:35:12 -07:00
Paul O’Shannessy f82f2a0fe2 Merge pull request #274 from chenglou/textarea-patch
fix textarea `value` of number 0
2013-09-10 18:01:33 -07:00
Ben Alpert f69112cb3f JSX: Respect original spacing and newlines better
Fixes #335.

Now this JSX:

```
/** @jsx React.DOM */
var HelloMessage = React.createClass({
  render: function() {
    return <div>
      Look!
      <a href=
        "http://www.facebook.com/">Facebook
      </a>
    </div>;
  }
});
```

produces

```
/** @jsx React.DOM */
var HelloMessage = React.createClass({displayName: 'HelloMessage',
  render: function() {
    return React.DOM.div(null,
      " Look! ",
      React.DOM.a( {href:
        "http://www.facebook.com/"}, "Facebook "
      )
    );
  }
});
```

rather than the less-desirable

```
/** @jsx React.DOM */
var HelloMessage = React.createClass({displayName: 'HelloMessage',
  render: function() {
    return React.DOM.div(null,
" Look! ",      React.DOM.a( {href:"http://www.facebook.com/"}, "Facebook "      ),
    );
  }
});
```
2013-09-10 17:14:36 -07:00
Paul O’Shannessy 6d77ad4be3 Merge pull request #330 from spicyj/warn-class-for
Warn for 'class' and 'for' property names
2013-09-10 16:21:33 -07:00
Jeff Morrison 7a6a508066 Merge pull request #328 from zpao/no-transform-class
Stop transforming class -> className
2013-09-10 08:23:08 -07:00
Cheng Lou cd019871e3 Fix input/textarea `value` of number 0 and `false`
Previously, setting textarea `value` to number 0 is treated as if `value` wasn't set at all (thus the textarea is cleared from 0 to '' upon `onChange`). `false` also renders as `"false"` instead of `""` for both `defaultValue` and `value`, on textarea _and_ input.
2013-09-10 10:40:53 -04:00
Paul O’Shannessy 63b58cf6b5 AUTHORS
Created a .mailmap file with all of the associations, then used
git + perl to create the AUTHORS file. In theory these should all get
picked up by npm.

I used ABC order so it would remain unbiased and automatable. I wish we
could go back and fill out the history or at least fix the commits we
have from CommitSyncScript, but oh well.

This also includes the script I used to automate this process in the
future.
2013-09-09 23:42:54 -07:00
Ben Alpert 3bbd966a82 Fix radio input test in Chrome
It seems like the `form="pluto"` was throwing it off and making the input live outside the form it should have been contained in, causing it to uncheck A. I added it intending to test the form attribute but ended up not needing it so removing it should be fine. (The tests were passing in phantomjs since it doesn't support the `form` attribute and simply ignored it.)

Test Plan:
grunt test; grunt test --debug
2013-09-09 23:38:05 -07:00
Isaac Salier-Hellendag 5388d70bb1 Add cut, copy, paste
Add clipboard events to React.

For forms, these shouldn't really be necessary -- the onChange event should handle deletions and insertions. For contenteditables, however, we need to be able to access clipboard data.
2013-09-09 23:33:05 -07:00
Ben Alpert 5fd4467bf7 Add React.version
getConfig needs to be a function because grunt.config.data.pkg.version isn't available at the time that grunt/config/jsx/jsx.js is required.

Test Plan:
grunt build, grunt lint, grunt test all work. After building, both react.js and react.min.js contain the version number.
2013-09-09 17:01:06 -07:00