@@ -109,10 +109,11 @@ var ContainerMixin = merge(ReactMultiChild.Mixin, {
109109 * Creates a child component.
110110 *
111111 * @param {ReactComponent } child Component to create.
112+ * @param {object } childNode ART node to insert.
112113 * @protected
113114 */
114- createChild : function ( child ) {
115- var childNode = child . _mountImage ;
115+ createChild : function ( child , childNode ) {
116+ child . _mountImage = childNode ;
116117 var mostRecentlyPlacedChild = this . _mostRecentlyPlacedChild ;
117118 if ( mostRecentlyPlacedChild == null ) {
118119 // I'm supposed to be first.
@@ -140,6 +141,7 @@ var ContainerMixin = merge(ReactMultiChild.Mixin, {
140141 */
141142 removeChild : function ( child ) {
142143 child . _mountImage . eject ( ) ;
144+ child . _mountImage = null ;
143145 } ,
144146
145147 /**
@@ -162,8 +164,15 @@ var ContainerMixin = merge(ReactMultiChild.Mixin, {
162164 children ,
163165 transaction
164166 ) ;
165- for ( var i = 0 ; i < mountedImages . length ; i ++ ) {
166- mountedImages [ i ] . inject ( this . node ) ;
167+ // Each mount image corresponds to one of the flattened children
168+ var i = 0 ;
169+ for ( var key in this . _renderedChildren ) {
170+ if ( this . _renderedChildren . hasOwnProperty ( key ) ) {
171+ var child = this . _renderedChildren [ key ] ;
172+ child . _mountImage = mountedImages [ i ] ;
173+ mountedImages [ i ] . inject ( this . node ) ;
174+ i ++ ;
175+ }
167176 }
168177 }
169178
0 commit comments