Commit Graph

1335 Commits

Author SHA1 Message Date
Paul O’Shannessy 9ef2b4e5d9 Merge pull request #2252 from syranide/htmlmanifest
Add manifest to HTMLDOMPropertyConfig
2014-10-07 15:29:57 -07:00
Paul O’Shannessy 33d2b5e8ff Merge pull request #2238 from syranide/noclassid
Remove superfluous classID from DOMAttributeNames
2014-10-07 15:26:19 -07:00
Paul O’Shannessy 8883d0f818 Merge pull request #2276 from spicyj/asap
Rename ReactUpdates.setImmediate to 'asap'
2014-10-07 14:27:00 -07:00
Sebastian Markbage 8f1657bba6 Renamed Descriptor -> Element
We've decided on a new naming convention for ReactDescriptor. It's now
called ReactElement, which is a subset of the ReactNode union type.
2014-10-07 13:41:51 -07:00
Sebastian Markbage 7f9b1d18d1 Start warning when React.DOM.x is passed into JSX
React.DOM is becoming helper factories to generate ReactElements. They're not
classes. It will be ok to call them directly as functions, but not to use them
where a class is expected.
2014-10-07 10:49:18 -07:00
Sebastian Markbage 15a0c8920e Don't use React.DOM
I grepped for uses of React.DOM. This is going to be a set of helper functions
to generate ReactElements without JSX.

They're not classes so they cannot be used where a React class is expected.

Since we always use JSX, we should have no internal use for these helpers.
We can use strings instead.
2014-10-07 10:49:18 -07:00
Sebastian Markbage b2dbccf9a2 Rename lower case variables in JSX to upper case
We're trying to move to a convention where lower-case variables on JSX are always HTML/SVG tags rather than variables in scope. See:

http://fb.me/react-jsx-lower-case

Therefore, this diff renames existing uses to upper case variables.

This throws an error on all these files, so I manually go rename all the variables. I then run lint to ensure that the rename doesn't leave any undeclared variables.
2014-10-07 10:48:57 -07:00
Sebastian Markbage 3aaccd2dc9 Use strings as the type for DOM elements
This makes ReactDOM a simple helper for creating ReactElements with the string tag as the type. The actual class is internal and created by instantiateReactComponent. Configurable using injection.

There's not a separate class for each tag. There's just a generic ReactDOMComponent which could take any tag name.

Invididual tags can be wrapped. When wrapping happens you can return the same tag again. If the wrapper returns the same string, then we fall back to the generic component. This avoids recursion in a single level wrapper.
2014-10-02 23:05:11 -07:00
Ben Alpert a8fff93971 Rename ReactUpdates.setImmediate to 'asap'
Per https://github.com/facebook/react/pull/1554#issuecomment-57243842.

Test Plan: jest
2014-09-29 17:37:13 -07:00
Paul O’Shannessy 3888b97433 Merge pull request #2219 from pablolmiranda/master
Creates a getMeasurementsSummaryMap in ReactDefaultPerf
2014-09-26 17:56:07 -07:00
Paul O’Shannessy a37dcbb8e0 Merge pull request #2208 from wincent/typo-fix-03
Fix a comment typo
2014-09-26 17:55:10 -07:00
Paul O’Shannessy 0383534094 Merge pull request #2202 from syranide/noscroll
Remove non-attribute scrollLeft and scrollTop from HTMLDOMPropertyConfig
2014-09-26 17:54:49 -07:00
Paul O’Shannessy 778ca2f862 Merge pull request #1598 from syranide/nogettext
Un-mixin ReactBrowserComponentMixin from ReactTextComponent
2014-09-26 17:54:32 -07:00
Paul O’Shannessy c14b3a1b13 Merge pull request #1520 from syranide/ediblechildren
Warn against contentEditable with children props
2014-09-26 17:54:24 -07:00
Andreas Svensson 3de80ec4ba Add manifest to HTMLDOMPropertyConfig 2014-09-26 16:45:33 +02:00
Andreas Svensson cac45631c3 Remove superfluous classID from DOMAttributeNames 2014-09-25 10:46:29 +02:00
Pablo Lacerda de Miranda 792b84c94b fixes ReactDefaultPerf.getMeasurementsSummaryMap format style 2014-09-23 18:50:18 -07:00
Isaac Salier-Hellendag e7299f6039 Prefer window.getSelection for IE
IE9+ supports `window.getSelection()` but `SelectEventPlugin` gives precedence to `document.selection` instead. `document.selection` is still available in later versions of IE, but the modern Selection object is preferable. Swap the two.
2014-09-22 16:56:22 -07:00
Andreas Svensson 14ba6ee788 Un-mixin ReactBrowserComponentMixin from ReactTextComponent 2014-09-22 23:28:26 +02:00
Pablo Lacerda de Miranda 486c69b6de extracts getMeasurementsSummaryMap from ReactDefaultPerf.printWasted 2014-09-19 16:03:41 -07:00
Greg Hurrell 94eac0b8fa Fix a comment typo 2014-09-18 09:47:23 -07:00
Andreas Svensson 802ad0bc00 Remove non-attribute scrollLeft and scrollTop from HTMLDOMPropertyConfig 2014-09-17 14:40:37 +02:00
Paul O’Shannessy 21f601964f Merge pull request #1301 from markijbema/patch-1
Only stop if the transition on this element ended
2014-09-12 17:00:05 -07:00
Paul O’Shannessy def41dfd8f Move onscroll warning test
This moves it to the appropriate place to accomodate the move of the check.
2014-09-11 15:15:19 -07:00
Andrew Rasmussen 7ae8909504 Move IE8 onscroll check
Rather than checking if document.onscroll exists in EventPluginHub
(which is agnostic of the DOM) do it in ReactDOMComponent
2014-09-10 13:33:23 -07:00
Paul O’Shannessy 99191046f9 Merge pull request #2113 from BinaryMuse/fix_numeric_properties
Fix DOMProperty bitmask checking
2014-09-09 15:26:38 -07:00
Paul O’Shannessy 5d88ebbecb Merge pull request #2144 from zertosh/master
Comment typo
2014-09-08 19:37:00 -07:00
Paul O’Shannessy 79ca0c7fd2 Merge pull request #1848 from fgnass/master
add picture element and related attributes
2014-09-08 16:23:39 -07:00
Paul O’Shannessy f3c64704ad Merge pull request #1988 from syranide/tacfix
Don't wrap values with ReactTextComponent in traverseAllChildren (cloneWithProps)
2014-09-08 15:36:26 -07:00
Isaac Salier-Hellendag 8c9a24983e Remove calls to `Range.detach`
This method is a no-op, as demonstrated by console warnings in Chrome and https://developer.mozilla.org/en-US/docs/Web/API/range.detach.

Remove callsites.

Fixes #2142
2014-09-08 14:30:53 -07:00
Andreas Svensson 45f8837e35 Don't wrap values with ReactTextComponent in traverseAllChildren 2014-09-08 22:35:25 +02:00
Andres Suarez 4c2f124aa8 Comment typo 2014-09-04 12:00:43 -04:00
Paul O’Shannessy 00fe66ddec Merge pull request #2106 from subtleGradient/subtleGradient/improve-ReactPerf-debugging
Improve debugging for methods using ReactPerf
2014-09-03 17:46:49 -07:00
Paul O’Shannessy 1854e8a912 Merge pull request #2033 from pekim/master
Add support for <dialog> tag.
2014-09-03 14:47:41 -07:00
Paul O’Shannessy f678591ad6 Merge pull request #2101 from jeffchan/patch-1
Fix typo in ReactDefaultPerfAnalysis comment
2014-09-02 11:57:45 -07:00
Brandon Tilley 0e28f5e6d7 Fix DOMProperty bitmask checking 2014-09-02 06:53:58 -07:00
Mike D Pilsbury ffa0447177 Add support for <dialog> tag's open attribute. 2014-08-31 12:43:32 +01:00
Sebastian Markbage 4af98990db Bumping version to help filtering. 2014-08-29 14:35:22 -07:00
Sebastian Markbage 63046277e4 Bumping version to help filtering. 2014-08-29 14:35:12 -07:00
Sebastian Markbage bad1b7c41a Start warning for JSX on plain functions
Let's also bump the version number for the log so that we can start filtering
out the other logs.
2014-08-29 14:35:07 -07:00
Sebastian Markbage 3c6c437d07 Don't transfer props to mocked empty component
We currently automatically render empty components in place of mocks. However,
we were accidentally transferring the props from the mocked descriptor to the
empty component placeholder. Even children.

This change just cleans that up and should only affect unit tests.
2014-08-29 14:35:01 -07:00
Sebastian Markbage f5a0d667a5 Add version to legacy factory monitoring 2014-08-29 14:34:58 -07:00
Miorel Palii 335e91df71 Fix console warning in LegacyImmutableObject
It does check `hasOwnProperty`, but *after* accessing the field and therefore triggering enumerable getters in modified prototypes.
2014-08-29 14:32:50 -07:00
Thomas Aylott 755cc9671f Combine displayName using underscore 2014-08-28 14:58:59 -04:00
Thomas Aylott a6116b31e5 Improve debugging for methods using ReactPerf 2014-08-28 13:49:51 -04:00
Jeff Chan ef9c9c81d0 Fix typo 2014-08-27 21:17:10 -07:00
Cheng Lou 74ff6fb6b8 Merge pull request #2039 from crm416/return-false
Deprecate 'return false' in event handlers
2014-08-27 13:33:40 -07:00
Cheng Lou 95de877dce Merge pull request #2036 from crm416/static-functions
Throw an error when functions on `statics` clash due to duplicate keys
2014-08-27 11:36:53 -07:00
Charles Marsh eb36b57079 Use warning module 2014-08-23 09:46:32 +08:00
Charles Marsh 979a93a70a Removed monitorCodeUse call 2014-08-22 13:09:38 +08:00
Felix Gnass 942d358ace use attribute for media, srcSet and sizes 2014-08-22 00:37:32 +02:00
Charles Marsh f01246d6bb Indentation for eventHandlerName 2014-08-21 09:13:35 +08:00
Cheng Lou 72e690ecfb Merge pull request #2037 from crm416/duplicate-key
More informative error message for mergeObjectsWithNoDuplicateKeys
2014-08-20 17:27:07 -07:00
Cheng Lou b8ab95aaa7 Merge pull request #2054 from chenglou/accum
[RFC] Use `accumulateInto` to save even more allocation
2014-08-20 13:36:45 -07:00
Cheng Lou 48e901f8ae [RFC] Use `accumulateInto` to save even more allocation
Trying to make the event a bit more performant for events.

Feel free to reject this because the API inevitably isn't great. It's good for perf though, and since we're only using `accumulate` in very restrained places, I think we're fine.

`accumulateInto` is `accumulate` that mutates more and allocates less. I kept `accumulate` in case we want that in the future.
2014-08-20 13:10:50 -07:00
Paul O’Shannessy 417678310c Update Object.assign polyfill
The spec changed to allow null & undefined sources without throwing.
Now our code depends on this new behavior. The only browser that
implements Object.assign has also updated its native implementation to
this behavior (Firefox Nightly).
2014-08-20 11:44:24 -07:00
Sebastian Markbage aae31ae24c ReactMount calls a legacy factory use createDescriptor instead
This fixes some log spew since this pattern is deprecated. This doesn't use
the validator in the descriptor creation so there's no prop type checks here.
I guess that's fine because we still have the second prop type checks.

We need to use ReactLegacyDescriptor because the constructor here will be a
legacy factory that we need to unwrap.

constructAndRenderComponent should be deprecated.
2014-08-20 00:15:43 -07:00
Sebastian Markbage 5c51f2fe46 Check if a function has a prototype first
Because somehow someone used a prototype less function with JSX.
2014-08-20 00:15:32 -07:00
Sebastian Markbage 68b7b82145 Start warning when calling a legacy factory
Let's start warning when a legacy factory is called as a plain function call.
2014-08-20 00:15:11 -07:00
Sebastian Markbage 989e6b618e Drop usage of plain functions to create descriptors
Replace plain function calls to legacy factories with createFactory or
createElement. For ReactDOMComponents the type should be replaced with
strings.

Because we don't have easy access to ReactLegacyDescriptor from within
React, we need to use the .type property to extract the real class.
This will go away later and is covered by unit tests.
2014-08-20 00:14:59 -07:00
Sebastian Markbage c901b1005e Make createDescriptor return a descriptor for components
This moves all logic around legacy descriptors to ReactLegacyDescriptor. This
is responsible for the layer that knows that createClass exports a legacy
factory. When passed one of these classes, it unwraps it to be a real class.

If it is passed a non legacy factory, it is assumed to be a non-react component
that needs to be invoked as a plain function.

The semantic change is that a descriptor is now always returned if passed a
legacy factory. Even if that factory is a mock. A mock would previously return
undefined.

For mocks, I treat the factory as the authoritative function. I call it to extract
the instance or fill it with an empty component placeholder.

Additionally, I make the classes take props as the first argument to the
constructor. This is what the new class system will do.

We currently need to set up some internals by calling the internal construct
method. Instead of doing that automatically in the constructor, I now move that
to a second pass so that mocks can get the plain props.

This means that we can assert that a mock has been called once it's mounted
with it's final props. Instead of the descriptor factory being called.
2014-08-20 00:14:32 -07:00
Paul O’Shannessy 182379305a Update vendored modules 2014-08-20 00:14:28 -07:00
Charles Marsh 0ecc7e5a7f Look on __reactBoundContext for displayName 2014-08-20 08:44:33 +08:00
Charles Marsh cf45a40bb8 More info in monitorCodeUse call 2014-08-18 22:57:02 -04:00
Josh Duck 5b4e2be867 Iterate over expectedFeatures correctly
This fails if Array.prototype is extended.
2014-08-18 18:18:05 -07:00
Cheng Lou a43d8c588b Fix bad merge from 04c9820694
Didn't sync out correctly.
2014-08-18 10:37:18 -07:00
Lee Byron 04c9820694 Merge pull request #1601 from gaearon/apply-component-and-mixin-spec-deterministically
Apply component and mixins specs deterministically
2014-08-15 18:08:03 -07:00
Charles Marsh 429650a750 Test for both true and false 2014-08-15 19:47:36 -04:00
Charles Marsh c5be746fda Fixed style and comment nits 2014-08-15 11:52:22 -04:00
Charles Marsh a195d3ea1f Re-add with warning and monitorCodeUse 2014-08-14 10:43:00 -04:00
Charles Marsh 45f8b52135 Deprecate 'return false' in event handlers 2014-08-13 22:37:41 -04:00
Charles Marsh a70db003db Throw if a reserved property is defined in 'statics' 2014-08-13 21:34:49 -04:00
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
Charles Marsh 87607045e4 Abbreviated error message 2014-08-13 18:25:53 -04:00
Charles Marsh dcdc35fab6 More informative error message for mergeObjectsWithNoDuplicateKeys 2014-08-13 16:59:40 -04:00
Charles Marsh 71e49adf35 Throw an error when functions on `statics` clash due to duplicate keys 2014-08-13 16:33:57 -04: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
Mike D Pilsbury f035949e73 Add support for <dialog> tag.
fixes #2017
2014-08-12 19:58:10 +01: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
Ben Alpert 54d91c293d Don't initialize reconcile transaction on server
...when calling setState from within a componentWillMount. Fixes #1866.

Test Plan: jest
2014-07-18 11:03:34 -07:00
Andreas Svensson 495d866a66 getModifierState is case sensitive 2014-07-18 18:24:11 +02:00
Paul O’Shannessy 5bfee601ce Bump version for 0.12.0-alpha
[skip ci]
2014-07-17 14:22:50 -07:00
Felix Gnass 33bd509737 add picture element and related attributes 2014-07-16 13:19:55 +02:00
Ben Alpert 076047012a When proxying statics functions, copy properties
Test Plan: jest
2014-07-15 15:09:16 -07:00
Mouad Debbar 97dbada03d Up-to-date React.Children
Make sure we actually include `.count`
2014-07-14 15:01:44 -07:00
Andreas Svensson f8ccc2186f Fix IE8 potentially throwing during restoreSelection 2014-07-14 21:07:56 +02:00
Paul O’Shannessy 0f9cec2e78 0.11.0-rc1 2014-07-12 19:50:45 -07:00
Ben Alpert 92d2dcc25f Revert "Add helpful message about pooled classes"
This reverts commit e65f17b86c. This might have a perf impact so we're not going to go with it for now.
2014-07-11 16:00:58 -07:00
Paul O’Shannessy 2b0e51bdba Add String.prototype.trim to polyfill check
Also shortens the URL so it fits on 1 line
2014-07-11 10:36:38 -07:00
Paul O’Shannessy 897b423e0e Merge pull request #1797 from spicyj/transition-group-names
Add displayName to ReactTransitionGroup + friends
2014-07-08 14:40:34 -07:00
Ben Alpert 734a345257 Add displayName to ReactTransitionGroup + friends
Fixes facebook/react-devtools#42.

Test Plan: Crossed fingers.
2014-07-08 12:18:46 -07:00
Max F. Albrecht bcea3bee45 Also list <form> in error message as possible culprit 2014-07-08 14:08:17 +02:00
Cheng Lou e10d10e31e Merge pull request #1531 from spicyj/two-face
Give useful error when using two copies of React
2014-07-03 14:45:23 -07:00
Ben Alpert 70bf3e1306 Give useful error when using two copies of React
If we don't error here, we end up with a confusing error later on in this.getDOMNode() where ReactMount doesn't have the proper container registered in its object.
2014-07-03 14:20:31 -07:00
Andrew Zich 559eb89965 make invariant show formatted actual errors in all unminified environments
Because we can have !__DEV__ but unminified, we still want to see the
message in those cases.
2014-07-03 13:53:41 -07:00
Cheng Lou e8e08127c5 Merge pull request #1461 from spicyj/no-esc-slash
Don't escape slash; it's unnecessary
2014-07-03 11:05:16 -07:00
Ben Alpert c8d9957f68 Fix spelling/grammar in test comment 2014-07-02 14:09:38 -07:00
Yuval Dekel 40b522c498 Give context for owners of compenent instantiations with propType errors
See modification to the test-file: Basically we add a small hint at the end
of the error warning for propType errors to help identify which instantiation
of the component at hand is faulty.
2014-07-02 12:47:26 -07:00
Paul O'Shannessy a4e5327b76 Remove jest usage in ReactDescriptorTest
Until we're only using jest on github, we should stick with Jasmine spies. Soon, hopefully.
2014-06-30 20:55:19 -07:00
Paul O'Shannessy 022e44c95b Cleanup ReactChildren 2014-06-30 20:55:09 -07:00
Guangqiang Dong 1aa9cc6a8b add count() method to ReactChildren
added ReactChildren.count() to count the number of children, and a test case.
2014-06-30 20:54:57 -07:00
Paul O'Shannessy 5b17e75707 Support more properties for image maps
Supporting the `<area>` tag is pretty useless if we don't support the necessary properties.
2014-06-30 20:54:44 -07:00
Ben Alpert cb20dec85f Simplify composite lifecycle state
We now forbid calling setState or forceUpdate if any component's render function is higher in the stack, not just the component you're trying to update. (We do this already now for React.renderComponent and React.unmountComponentAtNode.)

This also has the advantage that we can now remove CompositeLifeCycle.RECEIVING_STATE, making _compositeLifeCycleState easier to reason about (not to mention that RECEIVING_STATE was a confusing name) and making it possible to remove a try/finally from the render path which might help with perf.
2014-06-28 01:04:04 -07:00
Mariano Desanze bb1a31930b Wrapped line to 80 chars in ReactPropTypes sample 2014-06-28 04:33:45 -03:00
Mariano Desanze 9854be2e46 Fix to sample code for href in ReactPropTypes
Error should be thrown in the previous condition is "not" meet. And the href propType is described as optional in the comment, but the null check was missing.
2014-06-27 11:50:03 -03:00
Sebastian Markbage ef67406272 Add simple React.createDescriptor hook
This is the minimal runtime change we need to switch the JSX syntax to resolve
to React.createDescriptor(...)
2014-06-26 15:42:18 -07:00
Sebastian Markbage d0719a5ea4 Preparing to move defaultProps resolution and type validation to the descriptor
This copies the propType and contextType validation to a wrapper around the
descriptor factory. By doing the validation early, we make it easier to track
down bugs. It also prepares for static type checking which should be done at the
usage site.

This validation is not yet active and is just logged using monitorCodeUse. This
will allow us to clean up callsites which would fail this new type of
validation.

I chose to copy the validation of abstracting it out since this is just an
intermediate step to avoid spamming consoles. This makes more a much cleaner
diff review/history. The original validation in the instance will be deleted as
soon as we can turn on the warnings.

Additionally, getDefaultProps are moved to become a static function which is
only executed once. It should be moved to statics but we don't have a
convenient way to merge mixins in statics right now. Deferring to ES6 classes.

This is still a breaking change since you can return an object or array from
getDefaultProps, which later gets mutated and now the shared instance is
mutated. Mutating an object that is passed into you from props is highly
discouraged and likely to lead to subtle bugs anyway. So I'm not too worried.

The defaultProps will later be resolved in the descriptor factory. This will
enable a perf optimizations where we don't create an unnecessary object
allocation when you use default props. It also means that ReactChildren.map
has access to resolved properties which gives them consistent behavior whether
or not the default prop is specified.
2014-06-26 15:40:12 -07:00
Paul O’Shannessy 0cf686fe1e Merge pull request #1738 from cassus/master
Add missing markerStart, markerMid, markerEnd SVG attributes
2014-06-26 15:24:30 -07:00
Paul O’Shannessy 3581a92fc3 Merge pull request #1642 from ryanseddon/trimCSSValues
Correctly trim strings for css properties
2014-06-25 22:02:54 -07:00
Paul O’Shannessy 295da0a795 Merge pull request #1741 from spicyj/mount-unused
Remove unused properties from ReactMount
2014-06-25 21:24:42 -07:00
Ben Alpert b8ad5a23c6 Remove unused properties from ReactMount
(useTouchEvents lives in EventPluginUtils.)

Test Plan: jest
2014-06-24 22:03:43 -07:00
Cheng Lou d52bebd07b Merge pull request #1716 from somethingkindawierd/master
Removes value attribute from rendered html of textarea
2014-06-24 19:14:19 -07:00
Cheng Lou a0486514a3 Merge pull request #1737 from spicyj/notime
Remove timing metrics from Transaction
2014-06-24 11:02:22 -07:00
Paul O’Shannessy b018870091 Merge pull request #1664 from spicyj/warn-pooling
Add helpful message about pooled classes
2014-06-24 11:01:21 -07:00
Jon Beebe e077dd40eb Adds empty onChange handler to textarea test 2014-06-24 07:26:07 -05:00
Cassus Adam Banko 30705f794c Add missing markerStart, markerMid, markerEnd SVG attributes 2014-06-24 11:17:34 +02:00
Dan Abramov e625b8b234 Warn when using hyphenated style property names 2014-06-24 13:05:52 +04:00
Ben Alpert 1c44b874fc Remove timing metrics from Transaction
No one uses these and they weren't meant to be left in.

Test Plan: jest
2014-06-23 20:32:12 -07:00
Ben Alpert e65f17b86c Add helpful message about pooled classes
Hopefully this will make fewer people confused at all of the null properties. The string won't wrap nicely so I tried to keep it pithy:

https://s3.amazonaws.com/uploads.hipchat.com/6574/26709/v8vzKAC784QMkX2/upload.png
2014-06-23 14:30:40 -07:00
Cheng Lou f81e213f41 Merge pull request #1495 from syranide/ie8noscript
Fix ReactEmptyComponent disappearing and throwing in IE8
2014-06-23 13:38:36 -07:00
Ryan Seddon 2bff5c5c7e Correctly trim strings for css properties
* If a unitless value is passed with a space it'll return `1 px`
2014-06-23 09:43:50 +10:00
petehunt c33cceb466 Expose React.addons.Perf 2014-06-20 17:55:48 -04:00
Paul O’Shannessy f0fc42af77 Merge pull request #1464 from spicyj/style-esc
Don't double-escape style names
2014-06-20 12:12:18 -07:00
Jonas Enlund 0377ec579e Added missing SVG attributes: fill-opacity, font-family, font-size, opacity, stroke-opacity.
Closes #1557
2014-06-20 12:45:31 -04:00
Josh Bassett 11486f1b31 Add 'patternContentUnits' to SVG attributes.
Closes #1702
2014-06-20 12:45:23 -04:00
Nate Hunzaker 3f29d5d6cb Add support for patternUnits attribute.
The patternUnits attribute defines how a pattern's coordinate system is
defined (x, y, width, height). This is particularly important when using
repeatable patterns in SVG. This commit adds this attribute to the lists
of known properties.

Closes #1548
2014-06-20 11:32:31 -04:00
Brandon Bloom aebb3261ee Add support for SVG ellipse elements.
Closes #1675
2014-06-20 11:29:19 -04:00
Andreas Svensson b36e05b0af Fix ReactEmptyComponent disappearing and throwing in IE8 2014-06-20 10:08:49 +02:00
Ben Newman 4cef56d73b Fix tests broken by undefined `window` references in ReactEventListener.
This test breakage blames to e1c2d02fdd.
2014-06-19 15:32:45 -04:00
Jon Beebe b9c132e58a Removes value from rendered attributes of textarea 2014-06-19 07:14:49 -05:00
Paul O’Shannessy 92e3384cd2 Merge pull request #1513 from danielschonfeld/shouldcomponentupdate-boolean
Warn if shouldComponentUpdate returns anything other than true/false
2014-06-18 11:29:31 -07:00
Paul O’Shannessy 8bbbe900a5 Sync out camelize module
For use in #1662
2014-06-17 09:27:59 -07:00
Ben Alpert 52127dd7cf Remove unnecessary topLevelTypes indirection
topLevelTypes is a key mirror, so dependency and topLevelType are always the same here.
2014-06-16 12:18:19 -07:00
Pete Hunt c93583c84f Remove bad perf metric
Remove a bad perf metric. Will investigate later.
2014-06-14 20:40:09 -07:00
Pete Hunt e1c2d02fdd Create ReactEventListener
Per our discussion friday, this creates ReactEventListener and renames variables to use the "handle"
nomenclature.
2014-06-14 20:38:45 -07:00
Marshall Roch a6cd945d9f Fix 'this' in static methods
binds static methods on the descriptor to the component's actual constructor, so that `foo.constructor.bar()` and `Foo.bar()` run with the same `this`.
2014-06-14 20:37:51 -07:00
Tim Yung 431155d2e2 Revert #1536
It's causing issues in product code. Reverting until it can be
investigated further.
2014-06-14 20:36:07 -07:00
Kunal Mehta 0f7423f31d Merge pull request #1661 from spicyj/test-ie10-select-multiple
Fix select switching to multiple in IE
2014-06-13 14:24:50 -07:00
Cheng Lou 3eb36415bd Merge pull request #1206 from brandonbloom/apply
$apply directive for update
2014-06-12 20:34:29 -07:00
Cheng Lou 4329d5ac38 Merge pull request #1611 from mathieumg/master
Added 'objectOf' PropType validator to iterate on objects and validate properties.
2014-06-12 20:19:33 -07:00
Brandon Bloom 86161c9c48 $apply command for update 2014-06-12 23:10:14 -04:00
Mathieu M-Gosselin 4852c30d62 Added 'objectOf' PropType validator to iterate on object literals and
validate properties.
2014-06-11 21:12:05 -04:00
Cheng Lou 303a719f92 Merge pull request #1658 from spicyj/test-ie10-submit-label
Fix submit-button value test in IE10
2014-06-11 13:44:27 -07:00
Cheng Lou 9eff32c80c Merge pull request #1659 from spicyj/test-ie10-iframe
Fix EnterLeaveEventPlugin-test in IE10
2014-06-11 13:44:16 -07:00
Cheng Lou 92c174fec8 Merge pull request #1671 from gasi/fix-unset-style
Prevent null reference access when unsetting styles
2014-06-11 11:27:37 -07:00
Cheng Lou 36f2999d47 Merge pull request #1660 from spicyj/test-ie10-proptypesname
Fix PropTypes test in IE10
2014-06-11 10:34:28 -07:00
Ben Alpert 8e2dcceee3 Merge pull request #1597 from spicyj/defaultprops-autobind
Auto-bind before getDefaultProps
2014-06-11 10:14:31 -07:00
Daniel Gasienica 7c2dec5bd3 Prevent null reference access when unsetting styles 2014-06-10 13:33:32 -07:00
Ben Alpert eaa68b8e6b Fix select switching to multiple in IE
This one was an actual behavioral bug rather than a bug with the tests; our intention was that the first element from the `defaultValue` array would remain selected but IE seemed to be choosing the last one instead. Now we set the value for uncontrolled components in componentDidUpdate when switching from multiple to non-multiple to ensure that a consistent option gets selected.

Test Plan: Ran the ReactDOMSelect tests in jest, phantomjs, IE10, Chrome, and Firefox. Also tested an uncontrolled select manually to make sure that nothing crazy happened when switching between options.
2014-06-07 19:16:34 -07:00
Ben Alpert 7cd5e9b399 Fix PropTypes test in IE10
Test Plan: Ran the test in jest, phantomjs, IE10, Chrome, and Firefox.
2014-06-07 18:56:28 -07:00
Ben Alpert 5790a75622 Fix submit-button value test in IE10
Test Plan: Ran test in jest, phantomjs, IE10, Chrome, and Firefox.
2014-06-07 18:50:29 -07:00
Ben Alpert e938116549 Fix EnterLeaveEventPlugin-test in IE10
Previously this was failing because iframeDocument.body wasn't properly initialized. Creating the document this way seems to work in all environments

Test Plan: Ran the test in jest, phantomjs, IE10, Chrome, and Firefox.
2014-06-07 18:45:32 -07:00
cpojer eebcf9f888 Fix ExecutionEnvironment.canUseDOM for IE8. 2014-06-05 12:44:24 -07:00