@@ -3322,46 +3322,45 @@ FragmentInstance.prototype.compareDocumentPosition = function (
33223322 ) ;
33233323 }
33243324
3325- const firstElement = getInstanceFromHostFiber < Instance > ( children [ 0 ] ) ;
3326- const lastElement = getInstanceFromHostFiber < Instance > (
3325+ const firstNode = getInstanceFromHostFiber < Instance > ( children [ 0 ] ) ;
3326+ const lastNode = getInstanceFromHostFiber < Instance > (
33273327 children [ children . length - 1 ] ,
33283328 ) ;
33293329
33303330 // If the fragment has been portaled into another host instance, we need to
33313331 // our best guess is to use the parent of the child instance, rather than
33323332 // the fiber tree host parent.
3333- const firstInstance = getInstanceFromHostFiber < Instance > ( children [ 0 ] ) ;
33343333 const parentHostInstanceFromDOM = fiberIsPortaledIntoHost ( this . _fragmentFiber )
3335- ? ( firstInstance . parentElement : ?Instance )
3334+ ? ( firstNode . parentElement : ?Instance )
33363335 : parentHostInstance ;
33373336
33383337 if ( parentHostInstanceFromDOM == null ) {
33393338 return Node . DOCUMENT_POSITION_DISCONNECTED ;
33403339 }
33413340
3342- // Check if first and last element are actually in the expected document position
3343- // before relying on them as source of truth for other contained elements
3344- const firstElementIsContained =
3345- parentHostInstanceFromDOM . compareDocumentPosition ( firstElement ) &
3341+ // Check if first and last node are actually in the expected document position
3342+ // before relying on them as source of truth for other contained nodes
3343+ const firstNodeIsContained =
3344+ parentHostInstanceFromDOM.compareDocumentPosition(firstNode ) &
33463345 Node . DOCUMENT_POSITION_CONTAINED_BY ;
3347- const lastElementIsContained =
3348- parentHostInstanceFromDOM . compareDocumentPosition ( lastElement ) &
3346+ const lastNodeIsContained =
3347+ parentHostInstanceFromDOM . compareDocumentPosition ( lastNode ) &
33493348 Node . DOCUMENT_POSITION_CONTAINED_BY ;
3350- const firstResult = firstElement . compareDocumentPosition ( otherNode ) ;
3351- const lastResult = lastElement . compareDocumentPosition ( otherNode ) ;
3349+ const firstResult = firstNode . compareDocumentPosition ( otherNode ) ;
3350+ const lastResult = lastNode . compareDocumentPosition ( otherNode ) ;
33523351
33533352 const otherNodeIsFirstOrLastChild =
3354- ( firstElementIsContained && firstElement === otherNode ) ||
3355- ( lastElementIsContained && lastElement === otherNode ) ;
3353+ ( firstNodeIsContained && firstNode === otherNode ) ||
3354+ ( lastNodeIsContained && lastNode === otherNode ) ;
33563355 const otherNodeIsFirstOrLastChildDisconnected =
3357- ( ! firstElementIsContained && firstElement === otherNode ) ||
3358- ( ! lastElementIsContained && lastElement === otherNode ) ;
3356+ ( ! firstNodeIsContained && firstNode === otherNode ) ||
3357+ ( ! lastNodeIsContained && lastNode === otherNode ) ;
33593358 const otherNodeIsWithinFirstOrLastChild =
33603359 firstResult & Node . DOCUMENT_POSITION_CONTAINED_BY ||
33613360 lastResult & Node . DOCUMENT_POSITION_CONTAINED_BY ;
33623361 const otherNodeIsBetweenFirstAndLastChildren =
3363- firstElementIsContained &&
3364- lastElementIsContained &&
3362+ firstNodeIsContained &&
3363+ lastNodeIsContained &&
33653364 firstResult & Node . DOCUMENT_POSITION_FOLLOWING &&
33663365 lastResult & Node . DOCUMENT_POSITION_PRECEDING ;
33673366
0 commit comments