Wire up ReactDOMFiberComponent in ReactDOMFiber

We'll need to do the DOM injection now.
This commit is contained in:
Sebastian Markbage
2016-11-18 12:01:22 +00:00
parent 61a1a50955
commit 836331ba5f
6 changed files with 140 additions and 139 deletions
+3 -71
View File
@@ -38,9 +38,6 @@ src/renderers/art/__tests__/ReactART-test.js
* resolves refs before componentDidMount
* resolves refs before componentDidUpdate
src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
* should set style attribute when styles exist
src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js
* should store a listener correctly
* should retrieve a listener correctly
@@ -59,51 +56,19 @@ src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js
* should infer onTouchTap from a touchStart/End
* should infer onTouchTap from when dragging below threshold
* should not onTouchTap from when dragging beyond threshold
* should listen to events only once
* should work with event plugins without dependencies
* should work with event plugins with dependencies
* should bubble onTouchTap
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
* should handle className
* should gracefully handle various style value types
* should update styles when mutating style object
* should update styles if initially null
* should update styles if updated to null multiple times
* should allow named slot projection on both web components and regular DOM elements
* should remove attributes
* should remove properties
* should properly update custom attributes on custom elements
* should clear a single style prop when changing `style`
* should update arbitrary attributes for tags containing dashes
* should update styles when `style` changes from null to object
* should warn when mutating style
* should empty element when removing innerHTML
* should transition from innerHTML to children in nested el
* should not incur unnecessary DOM mutations for attributes
* should not incur unnecessary DOM mutations for string properties
* should not incur unnecessary DOM mutations for boolean properties
* should ignore attribute whitelist for elements with the "is: attribute
* should not update when switching between null/undefined
* should warn against children for void elements
* should warn against dangerouslySetInnerHTML for void elements
* should treat menuitem as a void element but still create the closing tag
* should validate against multiple children props
* should validate use of dangerouslySetInnerHTML
* should validate use of dangerouslySetInnerHTML
* should validate against invalid styles
* should track input values
* should track textarea values
* should warn for children on void elements
* should support custom elements which extend native elements
* should warn against children for void elements
* should warn against dangerouslySetInnerHTML for void elements
* should validate against multiple children props
* should validate against invalid styles
* should report component containing invalid styles
* should clean up input value tracking
* should clean up input textarea tracking
* should throw when an invalid tag name is used
* should throw when an attack vector is used
* gives source code refs for unknown prop warning
* gives source code refs for unknown prop warning for update render
* gives source code refs for unknown prop warning for exact elements
@@ -172,32 +137,18 @@ src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js
* should properly control a value even if no event listener exists
* should control a value in reentrant events
* should control values in reentrant events with different targets
* should display `defaultValue` of number 0
* should display "true" for `defaultValue` of `true`
* should display "false" for `defaultValue` of `false`
* should update `defaultValue` for uncontrolled input
* should update `defaultValue` for uncontrolled date/time input
* should take `defaultValue` when changing to uncontrolled input
* should render name attribute if it is supplied
* should display "foobar" for `defaultValue` of `objToString`
* should display `value` of number 0
* should allow setting `value` to `true`
* should allow setting `value` to `false`
* should allow setting `value` to `objToString`
* should not incur unnecessary DOM mutations
* should properly control a value of number `0`
* should have the correct target value
* should control radio buttons
* should control radio buttons if the tree updates during render
* should have a this value of undefined if bind is not used
* should update defaultValue to empty string
* sets type, step, min, max before value always
* sets value properly with type coming later in props
* does not raise a validation warning when it switches types
* resets value of date/time input to fix bugs in iOS Safari
src/renderers/dom/shared/wrappers/__tests__/ReactDOMOption-test.js
* should ignore and warn invalid children types
* should set attribute for empty value
* should allow ignoring `value` on option
src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
@@ -219,26 +170,15 @@ src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
* should select grandchild options nested inside an optgroup
src/renderers/dom/shared/wrappers/__tests__/ReactDOMTextarea-test.js
* should allow setting `defaultValue`
* should display `defaultValue` of number 0
* should display "false" for `defaultValue` of `false`
* should display "foobar" for `defaultValue` of `objToString`
* should set defaultValue
* should display `value` of number 0
* should update defaultValue to empty string
* should allow setting `value` to `giraffe`
* should allow setting `value` to `true`
* should allow setting `value` to `false`
* should allow setting `value` to `objToString`
* should take updates to `defaultValue` for uncontrolled textarea
* should take updates to children in lieu of `defaultValue` for uncontrolled textarea
* should not incur unnecessary DOM mutations
* should properly control a value of number `0`
* should treat children like `defaultValue`
* should keep value when switching to uncontrolled element if not changed
* should keep value when switching to uncontrolled element if changed
* should allow booleans as children
* should allow objects as children
* should throw with multiple or invalid children
src/renderers/dom/stack/client/__tests__/ReactDOM-test.js
* throws in render() if the mount callback is not a function
@@ -356,15 +296,9 @@ src/renderers/shared/hooks/__tests__/ReactHostOperationHistoryHook-test.js
* gets recorded for composite roots
* gets recorded when a native is mounted deeply instead of null
* gets recorded during mount
* gets recorded during an update
* gets ignored if the styles are shallowly equal
* gets recorded during mount
* gets recorded during an update
* gets recorded as a removal during an update
* gets recorded during mount
* gets recorded during an update
* gets recorded during mount
* gets recorded during an update
* gets recorded during an update from text content
* gets recorded during an update from html
* gets recorded during an update from children
@@ -379,7 +313,6 @@ src/renderers/shared/hooks/__tests__/ReactHostOperationHistoryHook-test.js
* gets reported when a child is removed
src/renderers/shared/shared/event/__tests__/EventPluginHub-test.js
* should prevent non-function listeners, at dispatch
* should not prevent null listeners, at dispatch
src/renderers/shared/stack/reconciler/__tests__/ReactComponent-test.js
@@ -412,7 +345,6 @@ src/renderers/shared/stack/reconciler/__tests__/ReactEmptyComponent-test.js
src/renderers/shared/stack/reconciler/__tests__/ReactMultiChildText-test.js
* should correctly handle all possible children for render and update
* should throw if rendering both HTML and children
src/renderers/shared/stack/reconciler/__tests__/ReactStatelessComponent-test.js
* should warn when stateless component returns array
+5 -22
View File
@@ -9,9 +9,13 @@ src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
* should check declared prop types after clone
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
* warns for keys for arrays of elements with owner info
* warns for keys with component stack info
* should give context for PropType errors in nested components.
src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js
* warns for keys for arrays of elements with owner info
src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
* should warn when using hyphenated style names
* should warn when updating hyphenated style names
@@ -20,20 +24,11 @@ src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
* should warn about style containing a NaN value
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
* should warn when mutating style
* should warn for unknown prop
* should group multiple unknown prop warnings together
* should warn for onDblClick prop
* should warn nicely about NaN in style
* should reject attribute key injection attack on markup
* should reject attribute key injection attack on update
* should work error event on <source> element
* should emit a warning once for a named custom component using shady DOM
* should emit a warning once for an unnamed custom component using shady DOM
* should validate against use of innerHTML
* should warn about contentEditable and children
* should warn about contentEditable and children
* should warn about the `onScroll` issue when unsupported (IE8)
* should not warn when server-side rendering `onScroll`
* warns on invalid nesting
* warns on invalid nesting at root
@@ -44,7 +39,6 @@ src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
* should warn about incorrect casing on properties
* should warn about incorrect casing on event handlers
* should warn about class
* should warn about props that are no longer supported
* should suggest property name if available
src/renderers/dom/shared/__tests__/ReactDOMInvalidARIAHook-test.js
@@ -53,36 +47,24 @@ src/renderers/dom/shared/__tests__/ReactDOMInvalidARIAHook-test.js
* should warn for an improperly cased aria-* prop
src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js
* should warn with value and no onChange handler and readOnly specified
* should warn with checked and no onChange handler with readOnly specified
* should warn if value is null
* should warn if checked and defaultChecked props are specified
* should warn if value and defaultValue props are specified
* should warn if controlled input switches to uncontrolled (value is undefined)
* should warn if controlled input switches to uncontrolled (value is null)
* should warn if controlled input switches to uncontrolled with defaultValue
* should warn if uncontrolled input (value is undefined) switches to controlled
* should warn if uncontrolled input (value is null) switches to controlled
* should warn if controlled checkbox switches to uncontrolled (checked is undefined)
* should warn if controlled checkbox switches to uncontrolled (checked is null)
* should warn if controlled checkbox switches to uncontrolled with defaultChecked
* should warn if uncontrolled checkbox (checked is undefined) switches to controlled
* should warn if uncontrolled checkbox (checked is null) switches to controlled
* should warn if controlled radio switches to uncontrolled (checked is undefined)
* should warn if controlled radio switches to uncontrolled (checked is null)
* should warn if controlled radio switches to uncontrolled with defaultChecked
* should warn if uncontrolled radio (checked is undefined) switches to controlled
* should warn if uncontrolled radio (checked is null) switches to controlled
* should warn if radio checked false changes to become uncontrolled
src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
* should warn if value is null
* should warn if value and defaultValue props are specified
src/renderers/dom/shared/wrappers/__tests__/ReactDOMTextarea-test.js
* should allow numbers as children
* should warn if value is null
* should warn if value and defaultValue are specified
src/renderers/dom/stack/client/__tests__/ReactMount-test.js
* should account for escaping on a checksum mismatch
@@ -115,6 +97,7 @@ src/renderers/shared/stack/reconciler/__tests__/ReactMultiChildText-test.js
src/renderers/shared/stack/reconciler/__tests__/ReactStatelessComponent-test.js
* should warn for childContextTypes on a functional component
* should warn when given a ref
* should use correct name in key warning
src/shared/utils/__tests__/traverseAllChildren-test.js
* should warn for using maps as children with owner info
+92 -5
View File
@@ -250,7 +250,6 @@ src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
* warns for keys for arrays of elements in rest args
* warns for keys for arrays of elements with owner info
* warns for keys for arrays with no owner or parent info
* warns for keys for arrays of elements with no owner info
* does not warn for keys when passing children down
@@ -450,7 +449,6 @@ src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js
src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js
* warns for keys for arrays of elements in children position
* warns for keys for arrays of elements with owner info
* warns for keys for iterables of elements in rest args
* does not warns for arrays of elements with keys
* does not warns for iterable elements with keys
@@ -495,6 +493,7 @@ src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
* should trim values
* should not append `px` to styles that might need a number
* should create vendor-prefixed markup correctly
* should set style attribute when styles exist
* should not set style attribute when no styles exist
src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js
@@ -523,25 +522,67 @@ src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js
* should support custom attributes
src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js
* should listen to events only once
* should work with event plugins without dependencies
* should work with event plugins with dependencies
* should not crash ensureScrollValueMonitoring when createEvent returns null
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
* should handle className
* should gracefully handle various style value types
* should not warn for "0" as a unitless style value
* should warn nicely about NaN in style
* should update styles if initially null
* should update styles if updated to null multiple times
* should allow named slot projection on both web components and regular DOM elements
* should skip reserved props on web components
* should skip dangerouslySetInnerHTML on web components
* should remove attributes
* should remove properties
* should properly update custom attributes on custom elements
* should clear a single style prop when changing `style`
* should reject attribute key injection attack on markup
* should reject attribute key injection attack on update
* should update arbitrary attributes for tags containing dashes
* should clear all the styles when removing `style`
* should update styles when `style` changes from null to object
* should transition from string content to innerHTML
* should transition from innerHTML to string content
* should transition from children to innerHTML in nested el
* should not incur unnecessary DOM mutations for attributes
* should not incur unnecessary DOM mutations for string properties
* should not incur unnecessary DOM mutations for boolean properties
* should ignore attribute whitelist for elements with the "is: attribute
* should not update when switching between null/undefined
* handles multiple child updates without interference
* should generate the correct markup with className
* should escape style names and values
* should handle dangerouslySetInnerHTML
* should not duplicate uppercased selfclosing tags
* should warn against children for void elements
* should warn against dangerouslySetInnerHTML for void elements
* should emit a warning once for an unnamed custom component using shady DOM
* should treat menuitem as a void element but still create the closing tag
* should validate against multiple children props
* should validate against use of innerHTML
* should validate use of dangerouslySetInnerHTML
* should validate use of dangerouslySetInnerHTML
* should allow {__html: null}
* should warn about contentEditable and children
* should respect suppressContentEditableWarning
* should validate against invalid styles
* should support custom elements which extend native elements
* should warn against children for void elements
* should warn against dangerouslySetInnerHTML for void elements
* should validate against multiple children props
* should warn about contentEditable and children
* should validate against invalid styles
* should properly escape text content and attributes values
* unmounts children before unsetting DOM node info
* should warn about the `onScroll` issue when unsupported (IE8)
* should throw when an invalid tag name is used
* should throw when an attack vector is used
* should warn about props that are no longer supported
src/renderers/dom/shared/__tests__/ReactDOMComponentTree-test.js
* finds nodes for instances
@@ -686,21 +727,44 @@ src/renderers/dom/shared/utils/__tests__/setInnerHTML-test.js
* sets innerHTML on it
src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js
* should display `defaultValue` of number 0
* only assigns defaultValue if it changes
* should display "true" for `defaultValue` of `true`
* should display "false" for `defaultValue` of `false`
* should take `defaultValue` when changing to uncontrolled input
* should render defaultValue for SSR
* should render value for SSR
* should render name attribute if it is supplied
* should render name attribute if it is supplied for SSR
* should not render name attribute if it is not supplied
* should not render name attribute if it is not supplied for SSR
* should display "foobar" for `defaultValue` of `objToString`
* should display `value` of number 0
* should allow setting `value` to `true`
* should allow setting `value` to `false`
* should allow setting `value` to `objToString`
* should not incur unnecessary DOM mutations
* should not set a value for submit buttons unnecessarily
* should update defaultValue to empty string
* should warn with value and no onChange handler and readOnly specified
* should warn with checked and no onChange handler with readOnly specified
* should warn if checked and defaultChecked props are specified
* should warn if value and defaultValue props are specified
* should warn if uncontrolled input (value is undefined) switches to controlled
* should warn if uncontrolled checkbox (checked is undefined) switches to controlled
* should warn if uncontrolled checkbox (checked is null) switches to controlled
* should warn if uncontrolled radio (checked is undefined) switches to controlled
* should warn if uncontrolled radio (checked is null) switches to controlled
* should not warn if radio value changes but never becomes controlled
* should not warn if radio value changes but never becomes uncontrolled
* sets value properly with type coming later in props
* does not raise a validation warning when it switches types
src/renderers/dom/shared/wrappers/__tests__/ReactDOMOption-test.js
* should flatten children to a string
* should ignore and warn invalid children types
* should ignore null/undefined/false children without warning
* should be able to use dangerouslySetInnerHTML on option
* should set attribute for empty value
src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
* should not throw with `defaultValue` and without children
@@ -708,13 +772,27 @@ src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
* should support server-side rendering
* should support server-side rendering with defaultValue
* should support server-side rendering with multiple
* should warn if value and defaultValue props are specified
src/renderers/dom/shared/wrappers/__tests__/ReactDOMTextarea-test.js
* should allow setting `defaultValue`
* should display `defaultValue` of number 0
* should display "false" for `defaultValue` of `false`
* should display "foobar" for `defaultValue` of `objToString`
* should not render value as an attribute
* should update defaultValue to empty string
* should display `value` of number 0
* should render defaultValue for SSR
* should render value for SSR
* should take updates to `defaultValue` for uncontrolled textarea
* should take updates to children in lieu of `defaultValue` for uncontrolled textarea
* should treat children like `defaultValue`
* should keep value when switching to uncontrolled element if not changed
* should allow numbers as children
* should allow booleans as children
* should allow objects as children
* should throw with multiple or invalid children
* should unmount
* should warn if value and defaultValue are specified
src/renderers/dom/stack/client/__tests__/ReactDOM-test.js
* allows a DOM element to be used with a string
@@ -964,6 +1042,12 @@ src/renderers/shared/hooks/__tests__/ReactComponentTreeHook-test.native.js
src/renderers/shared/hooks/__tests__/ReactHostOperationHistoryHook-test.js
* gets ignored for composite roots that return null
* gets recorded during an update
* gets ignored if the styles are shallowly equal
* gets recorded during an update
* gets recorded as a removal during an update
* gets recorded during an update
* gets recorded during an update
* gets ignored if new text is equal
* gets ignored if new text is equal
* gets ignored if the type has not changed
@@ -983,6 +1067,9 @@ src/renderers/shared/shared/__tests__/ReactTreeTraversal-test.js
* should leave to the window from the shallowest
* should determine the first common ancestor correctly
src/renderers/shared/shared/event/__tests__/EventPluginHub-test.js
* should prevent non-function listeners, at dispatch
src/renderers/shared/shared/event/__tests__/EventPluginRegistry-test.js
* should be able to inject ordering before plugins
* should be able to inject plugins before and after ordering
@@ -1175,6 +1262,7 @@ src/renderers/shared/stack/reconciler/__tests__/ReactMultiChildReconcile-test.js
* should insert non-empty children in middle where nulls were
src/renderers/shared/stack/reconciler/__tests__/ReactMultiChildText-test.js
* should throw if rendering both HTML and children
* should render between nested components and inline children
src/renderers/shared/stack/reconciler/__tests__/ReactStateSetters-test.js
@@ -1191,7 +1279,6 @@ src/renderers/shared/stack/reconciler/__tests__/ReactStatelessComponent-test.js
* should unmount stateless component
* should pass context thru stateless component
* should provide a null ref
* should use correct name in key warning
* should support default props and prop types
* should receive context
* should work with arrow functions
+16 -31
View File
@@ -17,9 +17,18 @@ import type { HostChildren } from 'ReactFiberReconciler';
var ReactFiberReconciler = require('ReactFiberReconciler');
var ReactDOMComponentTree = require('ReactDOMComponentTree');
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
var ReactDOMFiberComponent = require('ReactDOMFiberComponent');
var ReactDOMInjection = require('ReactDOMInjection');
ReactDOMInjection.inject();
var warning = require('warning');
var {
createElement,
setInitialProperties,
updateProperties,
} = ReactDOMFiberComponent;
var { precacheFiberNode } = ReactDOMComponentTree;
type DOMContainerElement = Element & { _reactRootContainer: ?Object };
@@ -60,24 +69,12 @@ var DOMRenderer = ReactFiberReconciler({
children : HostChildren<Instance | TextInstance>,
internalInstanceHandle : Object
) : Instance {
const domElement : Instance = document.createElement(type);
const root = document.body; // HACK
const domElement : Instance = createElement(type, props, root);
precacheFiberNode(internalInstanceHandle, domElement);
recursivelyAppendChildren(domElement, children);
if (typeof props.className !== 'undefined') {
domElement.className = props.className;
}
if (typeof props.children === 'string') {
domElement.textContent = props.children;
} else if (typeof props.children === 'number') {
domElement.textContent = props.children.toString();
} else if (typeof props.dangerouslySetInnerHTML === 'object' &&
props.dangerouslySetInnerHTML !== null &&
typeof props.dangerouslySetInnerHTML.__html === 'string') {
domElement.innerHTML = props.dangerouslySetInnerHTML.__html;
}
if (typeof props.id === 'string') {
domElement.id = props.id;
}
setInitialProperties(domElement, type, props, root);
return domElement;
},
@@ -90,21 +87,9 @@ var DOMRenderer = ReactFiberReconciler({
},
commitUpdate(domElement : Instance, oldProps : Props, newProps : Props) : void {
if (typeof newProps.className !== 'undefined') {
domElement.className = newProps.className;
}
if (typeof newProps.children === 'string') {
domElement.textContent = newProps.children;
} else if (typeof newProps.children === 'number') {
domElement.textContent = newProps.children.toString();
} else if (typeof newProps.dangerouslySetInnerHTML === 'object' &&
newProps.dangerouslySetInnerHTML !== null &&
typeof newProps.dangerouslySetInnerHTML.__html === 'string') {
domElement.innerHTML = newProps.dangerouslySetInnerHTML.__html;
}
if (typeof newProps.id === 'string') {
domElement.id = newProps.id;
}
var type = domElement.tagName.toLowerCase(); // HACK
var root = document.body; // HACK
updateProperties(domElement, type, oldProps, newProps, root);
},
createTextInstance(text : string, internalInstanceHandle : Object) : TextInstance {
@@ -33,7 +33,7 @@ var invariant = require('invariant');
var isEventSupported = require('isEventSupported');
var setInnerHTML = require('setInnerHTML');
var setTextContent = require('setTextContent');
var inputValueTracking = require('inputValueTracking');
// var inputValueTracking = require('inputValueTracking');
var warning = require('warning');
var didWarnShadyDOM = false;
@@ -434,10 +434,19 @@ function updateDOMProperties(
}
}
if (styleUpdates) {
var componentPlaceholder = null;
if (__DEV__) {
// HACK
var internalInstance = ReactDOMComponentTree.getInstanceFromNode(domElement);
componentPlaceholder = {
_currentElement: { type: internalInstance.type, props: internalInstance.memoizedProps },
_debugID: internalInstance._debugID,
};
}
CSSPropertyOperations.setValueForStyles(
domElement,
styleUpdates,
null // TODO: Change CSSPropertyOperations to use getCurrentOwnerName.
componentPlaceholder // TODO: Change CSSPropertyOperations to use getCurrentOwnerName.
);
}
}
@@ -453,11 +462,10 @@ var ReactDOMFiberComponent = {
createElement: function(
tag : string,
props : Object,
rootContainerElement : Element,
internalInstanceHandle : Object
rootContainerElement : Element
) : Element {
validateDangerousTag(tag);
// TODO:
// validateDangerousTag(tag);
// tag.toLowerCase(); Do we need to apply lower case only on non-custom elements?
// We create tags in the namespace of their parent container, except HTML
@@ -503,8 +511,6 @@ var ReactDOMFiberComponent = {
);
}
ReactDOMComponentTree.precacheFiberNode(internalInstanceHandle, domElement);
return domElement;
},
@@ -544,7 +550,7 @@ var ReactDOMFiberComponent = {
props = ReactDOMFiberInput.getHostProps(domElement, props);
// TODO: Make sure we check if this is still unmounted or do any clean
// up necessary since we never stop tracking anymore.
inputValueTracking.track(domElement);
//inputValueTracking.track(domElement); // TODO
trapBubbledEventsLocal(domElement, tag);
// For controlled components we always need to ensure we're listening
// to onChange. Even if there is no listener.
@@ -565,7 +571,7 @@ var ReactDOMFiberComponent = {
case 'textarea':
ReactDOMFiberTextarea.mountWrapper(domElement, props);
props = ReactDOMFiberTextarea.getHostProps(domElement, props);
inputValueTracking.track(domElement); // TODO
//inputValueTracking.track(domElement); // TODO
trapBubbledEventsLocal(domElement, tag);
// For controlled components we always need to ensure we're listening
// to onChange. Even if there is no listener.
+9 -1
View File
@@ -143,6 +143,10 @@ export type Fiber = {
};
if (__DEV__) {
var debugCounter = 0;
}
// This is a constructor of a POJO instead of a constructor function for a few
// reasons:
// 1) Nobody should add any instance methods on this. Instance methods can be
@@ -157,7 +161,7 @@ export type Fiber = {
// 5) It should be easy to port this to a C struct and keep a C implementation
// compatible.
var createFiber = function(tag : TypeOfWork, key : null | string) : Fiber {
return {
var fiber = {
// Instance
@@ -200,6 +204,10 @@ var createFiber = function(tag : TypeOfWork, key : null | string) : Fiber {
alternate: null,
};
if (__DEV__) {
(fiber : any)._debugID = debugCounter++;
}
return fiber;
};
function shouldConstruct(Component) {