@@ -638,6 +638,9 @@ export type FragmentInstanceType = {
638638 observeUsing : ( observer : IntersectionObserver ) = > void ,
639639 unobserveUsing : ( observer : IntersectionObserver ) = > void ,
640640 compareDocumentPosition : ( otherNode : PublicInstance ) = > number ,
641+ getRootNode ( getRootNodeOptions ? : {
642+ composed : boolean ,
643+ } ) : Node | FragmentInstanceType ,
641644} ;
642645
643646function FragmentInstance ( this : FragmentInstanceType , fragmentFiber : Fiber ) {
@@ -747,6 +750,21 @@ function collectChildren(child: Fiber, collection: Array<Fiber>): boolean {
747750 return false ;
748751}
749752
753+ // $FlowFixMe[prop-missing]
754+ FragmentInstance . prototype . getRootNode = function (
755+ this : FragmentInstanceType ,
756+ getRootNodeOptions ?: { composed : boolean } ,
757+ ) : Node | FragmentInstanceType {
758+ const parentHostFiber = getFragmentParentHostFiber ( this . _fragmentFiber ) ;
759+ if ( parentHostFiber === null ) {
760+ return this ;
761+ }
762+ const parentHostInstance = getPublicInstanceFromHostFiber ( parentHostFiber ) ;
763+ // $FlowFixMe[incompatible-use] Fabric PublicInstance is opaque
764+ const rootNode = ( parentHostInstance . getRootNode ( getRootNodeOptions ) : Node ) ;
765+ return rootNode ;
766+ } ;
767+
750768export function createFragmentInstance (
751769 fragmentFiber : Fiber ,
752770) : FragmentInstanceType {
0 commit comments