Commit Graph

694 Commits

Author SHA1 Message Date
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 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
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
Timothy Yung aa765e8fa3 Merge pull request #287 from spicyj/noglobal
Remove all uses of ExecutionEnvironment.global
2013-09-09 16:23:20 -07:00
Ben Alpert 426cdbb3ae Remove all uses of ExecutionEnvironment.global
Closes #271.

All three of these files are DOM-specific so it should be fine to use window. (ReactEventTopLevelCallback isn't obviously DOM-specific but it calls getEventTarget which is so I think we're fine here.)

Test Plan:
grunt test, tried events in a real browser and they seemed to work still.
2013-09-09 15:51:06 -07:00
Ben Newman 888cc309e0 Stop using comments as boundary markers in dangerouslyRenderMarkup.
Jordan warned (and StackOverflow confirmed) that IE8 doesn't respect HTML
comment nodes when setting `.innerHTML`:
http://stackoverflow.com/questions/15006001/inserting-a-comment-in-innerhtml

The virtue of the comment strategy was that the parser did all the work of
maintaining the boundaries between markup chunks, using comments as the
boundary markers.  The new strategy (of tagging the first node with a
special attribute) has a similar virtue, since the parser should preserve
that attribute only for the nodes we care about, and any rendered nodes
that do not have the attribute can be ignored (and complained about by
`console.error`).
2013-09-09 14:59:55 -07:00
Paul O'Shannessy 4ed7b85ed8 Log unknown props only when we have a match
Logging every unknown property got very noisy when combined with use of `transferPropsTo`. I knew this would be a potential issue initially but decided it was worth it. Others disagreed and it's resulting in some confusion.

This changes the logging to ensure that we have a potential correction, so only DOMish properties should result in warnings.
2013-09-09 14:57:56 -07:00
Pete Hunt 647731e399 Supporting mounting into iframes
Sencha says that separating big components into their own iframes was important for performance:
http://www.sencha.com/blog/the-making-of-fastbook-an-html5-love-story.

Today the only thing stopping us is that events don't bubble to our events system from an iframe. This diff
looks at the owning document of the container and adds top-level listeners to it. It should not change
existing behavior and should improve our support for this.
2013-09-09 14:57:33 -07:00
Ben Newman cd7d863f20 Avoid unnecessary array allocations in dangerouslyRenderMarkup. 2013-09-09 14:56:27 -07:00
Paul O'Shannessy 9d0f3623c3 Cache length of NodeList when updating radios 2013-09-09 11:53:13 -07:00
Pete Hunt e010a2d90b Fix bugs with CSS3 animation event in webkit
We were incorrectly sniffing the animationend event.
2013-09-09 11:52:59 -07:00
Paul O’Shannessy d704bc24f4 Initial build of ReactTransitionGroup
This builds `ReactTransitionGroup` with it's own copy of `React`, which
it total clownshoes. This should be technically usable, but definitely
should not be used in any production environment.
2013-09-07 16:18:14 -07:00
Paul O’Shannessy ff2fc586d5 Merge pull request #324 from chenglou/backbone-todo-ex
Fix backbone todo example bugs.
2013-09-07 14:53:01 -07:00
Cheng Lou 78d305eb16 Fix backbone todo example bugs.
Fixed:
- New todo not submitting correctly (page refreshes. `preventDefault`
wasn't there.
- Old checked todo being removed will leave the checkmark on the next
todo replacing its position.
- Cannot change todo (`value`'s now a controlled field).
- `autofocus` (should be `autoFocus`, how ironic given the current
situation) on new todo input isn't working. Switched to manual
`focus()` in `componentDidMount` for now.
- More consistent breathing space between lines.
- Gutter at 80.

Added:
- Use todomvc-common base.css. The old one had to change ids to
classes. No longer necessary.
- Give `cx` a better name and move it in `Utils`.
- Trim input upon finishing edit.
- Remove todo if the new edited value is empty.
- Submit edited todo value on input blur.
- README to explain the existence of this example. Being able to
maintain a non-compilant version allows nice deviations from the
todomvc specs, such as animations, in the future.
2013-09-07 17:44:05 -04:00
Paul O’Shannessy 6b5c1810c0 Merge pull request #323 from benjamn/simplify-bin/jsx
Simplify bin/jsx to perform just the JSX transform
2013-09-07 14:41:55 -07:00
Paul O’Shannessy e41912d6d4 Merge pull request #325 from spicyj/elseifdev
Move else if (__DEV__) into two statements
2013-09-07 14:08:03 -07:00
Ben Alpert 97e0926696 Move else if (__DEV__) into two statements
The minification stage doesn't like `else if (__DEV__)`.
2013-09-07 14:03:48 -07:00
Paul O’Shannessy 8df407deb8 Merge pull request #281 from spicyj/radio
Fix controlled radio button behavior
2013-09-07 13:54:57 -07:00
Paul O’Shannessy 2ba405d5f8 Merge pull request #267 from spicyj/warn-props
Warn about unknown property values
2013-09-07 13:06:41 -07:00
Ben Newman 658f41cb30 Simplify bin/jsx to perform just the JSX transform.
We will continue using `bin/jsx-internal`, well, internally.

Note that this version no longer respects `@providesModule`, and it
doesn't do anything special with constants like `__DEV__`, so we can no
longer get to claim that `bin/jsx` can be used to build the core.

I'm happy about this, personally, because it demonstrates the flexibility
of Commoner.
2013-09-06 16:20:25 -04:00
Ben Newman ebc0d09595 Merge pull request #322 from petehunt/build-animations
Add ReactTransitionGroup to the build
2013-09-06 10:49:30 -07:00
petehunt f7ea031dac Add ReactTransitionGroup to the build 2013-09-06 10:47:18 -07:00
Ben Alpert b56b5885d0 Fix controlled radio button behavior
Fixes #242.
2013-09-06 00:57:51 -07:00
Ben Alpert a4c23d328c Warn about unknown property values
Fixes #255.
2013-09-06 00:33:01 -07:00
Paul O'Shannessy 3cf14e8f9b Remove ReactChildren methods from React object
These are not terribly useful on this object and the naming of
`React.forEachChildren` sucked anyway.
2013-09-05 18:35:59 -07:00
Pete Hunt c8886a0424 Make mounting on the root of the page work correctly
This was apparently only partially supported. We had issues initially mounting if there was no HTML present and
also had issues if we had to update HTML that was already there. This diff fixes all of these cases and has
tests to prove it. NOTE: I removed a test that was actually erroneous. My bad.
2013-09-05 13:50:18 -07:00
Paul O’Shannessy 4f0dea3e7e Merge pull request #294 from clayallsopp/better_update_msg
More helpful message if you update an unrendered component
2013-09-05 11:54:07 -07:00
Clay Allsopp 9dd8ef4777 fix formatting and test for correct error 2013-09-04 18:13:33 -07:00
Paul O’Shannessy 65c4ef91c7 Sync CSSCore from upstream 2013-09-04 16:47:16 -07:00
Pete Hunt 32d3d7774a Use dumpCache() rather than manual reset
I forgot this module existed until @benjamn reminded we had a way to do it.
2013-09-04 15:54:27 -07:00
Pete Hunt 8664c8ac57 Test cases covering rendering onto document
There were some bug reports here, I couldn't reproduce but wrote tests anyway. We should definitely have these.
2013-09-04 15:54:11 -07:00
Ben Newman dea0cc01cf Improve error behavior of Danger.dangerouslyRenderMarkup.
HTML comment nodes are now interspersed in the original markup list so
that we can tell which chunks of markup rendered as more or less than one
node, and give a more helpful error message in that case.

Regardless of how many nodes were rendered, we only take the first one. If
zero nodes were rendered, then `resultList` will contain `null` at the
corresponding position.

If we decide to revisit the idea of using document fragments, it will be
very easy to handle the `!== 1` case by returning a document fragment.
2013-09-04 15:54:09 -07:00
Pete Hunt 80f1590265 Add ReactTransitionGroup
This introduces <ReactTransitionGroup>, a component that works a lot
like Angular's ng-animate.

The problem we're currently facing is twofold:
1. We don't really have a great convention surrounding CSS transitions
   in React
2. (harder) we can't animate nodes that are leaving the DOM, as their
   nodes are instantly destroyed.

To solve the first issue I've adopted Angular's convention. It's
implemented in ReactTransitionableChild.

The second part is what's tricky. To do this I've implemented three modules:
- ReactTransitionableChild, which can keep its old children around if they
  change to null
- ReactTransitionKeySet, which can look at a prev and next set of child
  keys and merge them in a reasonable way
- ReactTransitionGroup, which combines ReactTransitionableChild and
  ReactTransitionKeySet to keep nodes that are leaving the DOM in the
  DOM until their animations are complete
2013-09-04 15:54:06 -07:00
Paul O’Shannessy c25c5b543b Update wording 2013-09-04 15:26:31 -07:00
Cheng Lou 8852b86ad8 Add Stack Overflow link for doc support page. 2013-09-04 16:01:48 -04:00
Paul O'Shannessy a42fd30fc2 Remove React.autoBind for real
This has been deprecated for a long while now, we should actually remove it.
2013-09-03 14:27:00 -07:00
Pete Hunt 406dcbd8da Fix a few GC leaks in events system
Summary:
    - Weren't pooling the Transaction in the batching strategy
    - Creating a new closure for every event tick due to batchedUpdates()
    - EnterLeaveEventPlugin creates a new array on each event.

I wonder if there is more optimization opportunity in accumulate(). Squinting at the fps graph this seems to be faster and waste less memory but it's hard to conclusively tell. I did verify that these were all hotspots though.
2013-09-03 14:27:00 -07:00
Paul O’Shannessy de61f9fd81 Merge pull request #298 from vjeux/pagination
Add pagination to blog
2013-09-03 13:35:12 -07:00
Paul O’Shannessy 57fe412619 Merge pull request #305 from brianr/tutorial-explain-showdown
Tutorial: show how to add showdown.js
2013-09-03 13:33:05 -07:00
Pete Hunt b4ff29ac78 Merge pull request #312 from zpao/docs-redirect
Redirect /docs to the right page
2013-09-03 13:30:16 -07:00
Paul O’Shannessy ba460de7ed Redirect /docs to the right page
I've hit this a few times where I want to get to docs so I take whatever
my urlbar gives me and strip out the actual page so I can get to the
root, however that's a 404.

This introduces a super easy way to redirect, which could be handy in
the future as docs get rewritten.

I would much rather do this with a real htaccess file or even just
handle 404s gracefully, but that's not currently an option with GitHub
pages (since we generate our own and don't use a custom domain).
2013-09-03 13:25:23 -07:00
Pete Hunt c7768fde5d Merge pull request #307 from chenglou/todomvc-director
sync with tastejs todomvc
2013-09-02 10:22:58 -07:00
Clay Allsopp 15f84a391d move lifecycle check into replaceProps instead of updateComponent 2013-09-01 18:42:01 -07:00
Cheng Lou 2b9c34b5c7 sync with tastejs todomvc 2013-08-31 21:54:37 -04:00
Brian Rue 403b087e97 Tutorial: show how to add showdown.js 2013-08-30 16:29:01 -07:00
Sebastian Markbage 75aee1714b Expose the instance cache
We need access to the instance cache for debugging tools. Ideally we want to
expose a more stable and supported interface but this seems like a quick win,
for now.
2013-08-30 13:21:04 -07:00
Pete Hunt c41e86c990 Make ReactDefaultPerf work server-side
We were reading from window which was throwing when ReactDefaultPerf was injected.
2013-08-30 13:20:53 -07:00
Paul O'Shannessy 4d8f0449d9 React.isValidClass
Sometimes you may need to detect if a value is a valid React class constructor. This enables that and prevents future consumers from getting caught in the trap of depending on an internal implementation detail we might change.

Currently this works for classes created with `React.createClass` as well as `React.DOM.*`.
2013-08-30 13:20:51 -07:00
Pete Hunt 0db4077c3a Make React batching strategy injectable 2013-08-30 13:20:48 -07:00
Tim Yung f88aa35187 Change vendored module isDOMNode -> isNode 2013-08-30 13:20:45 -07:00