@@ -645,6 +645,9 @@ export type FragmentInstanceType = {
645645 observeUsing : ( observer : IntersectionObserver ) => void ,
646646 unobserveUsing : ( observer : IntersectionObserver ) => void ,
647647 compareDocumentPosition : ( otherNode : PublicInstance ) => number ,
648+ getRootNode ( getRootNodeOptions ?: {
649+ composed : boolean ,
650+ } ) : Node | FragmentInstanceType ,
648651} ;
649652
650653function FragmentInstance ( this : FragmentInstanceType , fragmentFiber : Fiber ) {
@@ -754,6 +757,21 @@ function collectChildren(child: Fiber, collection: Array<Fiber>): boolean {
754757 return false ;
755758}
756759
760+ // $FlowFixMe[prop-missing]
761+ FragmentInstance . prototype . getRootNode = function (
762+ this : FragmentInstanceType ,
763+ getRootNodeOptions ?: { composed : boolean } ,
764+ ) : Node | FragmentInstanceType {
765+ const parentHostFiber = getFragmentParentHostFiber ( this . _fragmentFiber ) ;
766+ if ( parentHostFiber === null ) {
767+ return this ;
768+ }
769+ const parentHostInstance = getPublicInstanceFromHostFiber ( parentHostFiber ) ;
770+ // $FlowFixMe[incompatible-use] Fabric PublicInstance is opaque
771+ const rootNode = ( parentHostInstance . getRootNode ( getRootNodeOptions ) : Node ) ;
772+ return rootNode ;
773+ } ;
774+
757775export function createFragmentInstance (
758776 fragmentFiber : Fiber ,
759777) : FragmentInstanceType {
0 commit comments