Comparing version 15.0.2-alpha.3 to 15.0.2-alpha.4
@@ -14,2 +14,3 @@ /** | ||
var KeyEscapeUtils = require('./KeyEscapeUtils'); | ||
var traverseAllChildren = require('./traverseAllChildren'); | ||
@@ -28,3 +29,3 @@ var warning = require('fbjs/lib/warning'); | ||
if (process.env.NODE_ENV !== 'production') { | ||
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : void 0; | ||
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0; | ||
} | ||
@@ -31,0 +32,0 @@ if (keyUnique && child != null) { |
@@ -25,3 +25,3 @@ /** | ||
* @param {?object} children Child collection structure. | ||
* @return {ReactComponent} The first and only `ReactComponent` contained in the | ||
* @return {ReactElement} The first and only `ReactElement` contained in the | ||
* structure. | ||
@@ -28,0 +28,0 @@ */ |
@@ -17,2 +17,3 @@ /** | ||
var instantiateReactComponent = require('./instantiateReactComponent'); | ||
var KeyEscapeUtils = require('./KeyEscapeUtils'); | ||
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent'); | ||
@@ -26,3 +27,3 @@ var traverseAllChildren = require('./traverseAllChildren'); | ||
if (process.env.NODE_ENV !== 'production') { | ||
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : void 0; | ||
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0; | ||
} | ||
@@ -29,0 +30,0 @@ if (child != null && keyUnique) { |
@@ -133,3 +133,3 @@ /** | ||
* | ||
* The provided mapFunction(child, key, index) will be called for each | ||
* The provided mapFunction(child, index) will be called for each | ||
* leaf child. | ||
@@ -136,0 +136,0 @@ * |
@@ -59,2 +59,6 @@ /** | ||
function shouldConstruct(Component) { | ||
return Component.prototype && Component.prototype.isReactComponent; | ||
} | ||
/** | ||
@@ -128,2 +132,5 @@ * ------------------ The Life-Cycle of a Composite Component ------------------ | ||
this._pendingCallbacks = null; | ||
// ComponentWillUnmount shall only be called once | ||
this._calledComponentWillUnmount = false; | ||
}, | ||
@@ -154,33 +161,11 @@ | ||
// Initialize the public class | ||
var inst; | ||
var inst = this._constructComponent(publicProps, publicContext); | ||
var renderedElement; | ||
if (Component.prototype && Component.prototype.isReactComponent) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
ReactCurrentOwner.current = this; | ||
try { | ||
inst = new Component(publicProps, publicContext, ReactUpdateQueue); | ||
} finally { | ||
ReactCurrentOwner.current = null; | ||
} | ||
} else { | ||
inst = new Component(publicProps, publicContext, ReactUpdateQueue); | ||
} | ||
} else { | ||
if (process.env.NODE_ENV !== 'production') { | ||
ReactCurrentOwner.current = this; | ||
try { | ||
inst = Component(publicProps, publicContext, ReactUpdateQueue); | ||
} finally { | ||
ReactCurrentOwner.current = null; | ||
} | ||
} else { | ||
inst = Component(publicProps, publicContext, ReactUpdateQueue); | ||
} | ||
if (inst == null || inst.render == null) { | ||
renderedElement = inst; | ||
warnIfInvalidElement(Component, renderedElement); | ||
!(inst === null || inst === false || ReactElement.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : invariant(false) : void 0; | ||
inst = new StatelessComponent(Component); | ||
} | ||
// Support functional components | ||
if (!shouldConstruct(Component) && (inst == null || inst.render == null)) { | ||
renderedElement = inst; | ||
warnIfInvalidElement(Component, renderedElement); | ||
!(inst === null || inst === false || ReactElement.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : invariant(false) : void 0; | ||
inst = new StatelessComponent(Component); | ||
} | ||
@@ -250,2 +235,24 @@ | ||
_constructComponent: function (publicProps, publicContext) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
ReactCurrentOwner.current = this; | ||
try { | ||
return this._constructComponentWithoutOwner(publicProps, publicContext); | ||
} finally { | ||
ReactCurrentOwner.current = null; | ||
} | ||
} else { | ||
return this._constructComponentWithoutOwner(publicProps, publicContext); | ||
} | ||
}, | ||
_constructComponentWithoutOwner: function (publicProps, publicContext) { | ||
var Component = this._currentElement.type; | ||
if (shouldConstruct(Component)) { | ||
return new Component(publicProps, publicContext, ReactUpdateQueue); | ||
} else { | ||
return Component(publicProps, publicContext, ReactUpdateQueue); | ||
} | ||
}, | ||
performInitialMountWithErrorHandling: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) { | ||
@@ -315,3 +322,4 @@ var markup; | ||
if (inst.componentWillUnmount) { | ||
if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { | ||
inst._calledComponentWillUnmount = true; | ||
if (safely) { | ||
@@ -318,0 +326,0 @@ var name = this.getName() + '.componentWillUnmount()'; |
@@ -172,2 +172,3 @@ /** | ||
var writes = measurement.writes; | ||
var hierarchy = measurement.hierarchy; | ||
var dirtyComposites = {}; | ||
@@ -177,4 +178,4 @@ Object.keys(writes).forEach(function (id) { | ||
// Root mounting (innerHTML set) is recorded with an ID of '' | ||
if (id !== '') { | ||
measurement.hierarchy[id].forEach(function (c) { | ||
if (id !== '' && hierarchy.hasOwnProperty(id)) { | ||
hierarchy[id].forEach(function (c) { | ||
return dirtyComposites[c] = true; | ||
@@ -181,0 +182,0 @@ }); |
@@ -14,16 +14,4 @@ /** | ||
var mouseListenerNames = { | ||
onClick: true, | ||
onDoubleClick: true, | ||
onMouseDown: true, | ||
onMouseMove: true, | ||
onMouseUp: true, | ||
var DisabledInputUtils = require('./DisabledInputUtils'); | ||
onClickCapture: true, | ||
onDoubleClickCapture: true, | ||
onMouseDownCapture: true, | ||
onMouseMoveCapture: true, | ||
onMouseUpCapture: true | ||
}; | ||
/** | ||
@@ -34,19 +22,5 @@ * Implements a <button> native component that does not receive mouse events | ||
var ReactDOMButton = { | ||
getNativeProps: function (inst, props) { | ||
if (!props.disabled) { | ||
return props; | ||
} | ||
// Copy the props, except the mouse listeners | ||
var nativeProps = {}; | ||
for (var key in props) { | ||
if (props.hasOwnProperty(key) && !mouseListenerNames[key]) { | ||
nativeProps[key] = props[key]; | ||
} | ||
} | ||
return nativeProps; | ||
} | ||
getNativeProps: DisabledInputUtils.getNativeProps | ||
}; | ||
module.exports = ReactDOMButton; |
@@ -64,2 +64,5 @@ /** | ||
// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE). | ||
var DOC_FRAGMENT_TYPE = 11; | ||
function getDeclarationErrorAddendum(internalInstance) { | ||
@@ -161,3 +164,4 @@ if (internalInstance) { | ||
var containerInfo = inst._nativeContainerInfo; | ||
var doc = containerInfo._ownerDocument; | ||
var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; | ||
var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; | ||
if (!doc) { | ||
@@ -164,0 +168,0 @@ // Server rendering. |
@@ -23,2 +23,3 @@ /** | ||
_ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null, | ||
_node: node, | ||
_tag: node ? node.nodeName.toLowerCase() : null, | ||
@@ -25,0 +26,0 @@ _namespaceURI: node ? node.namespaceURI : null |
@@ -16,2 +16,3 @@ /** | ||
var DisabledInputUtils = require('./DisabledInputUtils'); | ||
var DOMPropertyOperations = require('./DOMPropertyOperations'); | ||
@@ -73,3 +74,3 @@ var LinkedValueUtils = require('./LinkedValueUtils'); | ||
type: undefined | ||
}, props, { | ||
}, DisabledInputUtils.getNativeProps(inst, props), { | ||
defaultChecked: undefined, | ||
@@ -76,0 +77,0 @@ defaultValue: undefined, |
@@ -34,4 +34,12 @@ /** | ||
var selectValue = null; | ||
if (nativeParent != null && nativeParent._tag === 'select') { | ||
selectValue = ReactDOMSelect.getSelectValueContext(nativeParent); | ||
if (nativeParent != null) { | ||
var selectParent = nativeParent; | ||
if (selectParent._tag === 'optgroup') { | ||
selectParent = selectParent._nativeParent; | ||
} | ||
if (selectParent != null && selectParent._tag === 'select') { | ||
selectValue = ReactDOMSelect.getSelectValueContext(selectParent); | ||
} | ||
} | ||
@@ -38,0 +46,0 @@ |
@@ -16,2 +16,3 @@ /** | ||
var DisabledInputUtils = require('./DisabledInputUtils'); | ||
var LinkedValueUtils = require('./LinkedValueUtils'); | ||
@@ -140,3 +141,3 @@ var ReactDOMComponentTree = require('./ReactDOMComponentTree'); | ||
getNativeProps: function (inst, props) { | ||
return _assign({}, props, { | ||
return _assign({}, DisabledInputUtils.getNativeProps(inst, props), { | ||
onChange: inst._wrapperState.onChange, | ||
@@ -143,0 +144,0 @@ value: undefined |
@@ -16,2 +16,3 @@ /** | ||
var DisabledInputUtils = require('./DisabledInputUtils'); | ||
var DOMPropertyOperations = require('./DOMPropertyOperations'); | ||
@@ -65,3 +66,3 @@ var LinkedValueUtils = require('./LinkedValueUtils'); | ||
// get reset if `textContent` is mutated. | ||
var nativeProps = _assign({}, props, { | ||
var nativeProps = _assign({}, DisabledInputUtils.getNativeProps(inst, props), { | ||
defaultValue: undefined, | ||
@@ -68,0 +69,0 @@ value: undefined, |
@@ -155,5 +155,2 @@ /** | ||
scryRenderedDOMComponentsWithClass: function (root, classNames) { | ||
if (!Array.isArray(classNames)) { | ||
classNames = classNames.split(/\s+/); | ||
} | ||
return ReactTestUtils.findAllInRenderedTree(root, function (inst) { | ||
@@ -167,2 +164,7 @@ if (ReactTestUtils.isDOMComponent(inst)) { | ||
var classList = className.split(/\s+/); | ||
if (!Array.isArray(classNames)) { | ||
!(classNames !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a ' + 'className as a second argument.') : invariant(false) : void 0; | ||
classNames = classNames.split(/\s+/); | ||
} | ||
return classNames.every(function (name) { | ||
@@ -339,2 +341,3 @@ return classList.indexOf(name) !== -1; | ||
_assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, { | ||
_constructComponent: ReactCompositeComponent.Mixin._constructComponentWithoutOwner, | ||
_instantiateReactComponent: function (element) { | ||
@@ -341,0 +344,0 @@ return new NoopInternalComponent(element); |
@@ -14,2 +14,2 @@ /** | ||
module.exports = '15.0.2-alpha.3'; | ||
module.exports = '15.0.2-alpha.4'; |
@@ -293,3 +293,3 @@ /** | ||
Object.keys(ATTRS).map(function (key) { | ||
Object.keys(ATTRS).forEach(function (key) { | ||
SVGDOMPropertyConfig.Properties[key] = 0; | ||
@@ -296,0 +296,0 @@ if (ATTRS[key]) { |
@@ -19,2 +19,3 @@ /** | ||
var invariant = require('fbjs/lib/invariant'); | ||
var KeyEscapeUtils = require('./KeyEscapeUtils'); | ||
var warning = require('fbjs/lib/warning'); | ||
@@ -30,15 +31,4 @@ | ||
var userProvidedKeyEscaperLookup = { | ||
'=': '=0', | ||
':': '=2' | ||
}; | ||
var userProvidedKeyEscapeRegex = /[=:]/g; | ||
var didWarnAboutMaps = false; | ||
function userProvidedKeyEscaper(match) { | ||
return userProvidedKeyEscaperLookup[match]; | ||
} | ||
/** | ||
@@ -56,3 +46,3 @@ * Generate a key string that identifies a component within a set. | ||
// Explicit key | ||
return wrapUserProvidedKey(component.key); | ||
return KeyEscapeUtils.escape(component.key); | ||
} | ||
@@ -64,23 +54,2 @@ // Implicit key determined by the index in the set | ||
/** | ||
* Escape a component key so that it is safe to use in a reactid. | ||
* | ||
* @param {*} text Component key to be escaped. | ||
* @return {string} An escaped string. | ||
*/ | ||
function escapeUserProvidedKey(text) { | ||
return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper); | ||
} | ||
/** | ||
* Wrap a `key` value explicitly provided by the user to distinguish it from | ||
* implicitly-generated keys generated by a component's index in its parent. | ||
* | ||
* @param {string} key Value of a user-provided `key` attribute | ||
* @return {string} | ||
*/ | ||
function wrapUserProvidedKey(key) { | ||
return '$' + escapeUserProvidedKey(key); | ||
} | ||
/** | ||
* @param {?*} children Children tree container. | ||
@@ -142,3 +111,3 @@ * @param {!string} nameSoFar Name of the key path so far. | ||
child = entry[1]; | ||
nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
@@ -145,0 +114,0 @@ } |
@@ -176,2 +176,3 @@ /** | ||
case 'body': | ||
case 'caption': | ||
@@ -178,0 +179,0 @@ case 'col': |
{ | ||
"name": "react", | ||
"description": "React is a JavaScript library for building user interfaces.", | ||
"version": "15.0.2-alpha.3", | ||
"version": "15.0.2-alpha.4", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "react" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 5 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 5 instances in 1 package
370
2515061
57854