@@ -638,6 +638,9 @@ export type FragmentInstanceType = {
638
638
observeUsing : ( observer : IntersectionObserver ) = > void ,
639
639
unobserveUsing : ( observer : IntersectionObserver ) = > void ,
640
640
compareDocumentPosition : ( otherNode : PublicInstance ) = > number ,
641
+ getRootNode ( getRootNodeOptions ? : {
642
+ composed : boolean ,
643
+ } ) : Node | FragmentInstanceType ,
641
644
} ;
642
645
643
646
function FragmentInstance ( this : FragmentInstanceType , fragmentFiber : Fiber ) {
@@ -747,6 +750,21 @@ function collectChildren(child: Fiber, collection: Array<Fiber>): boolean {
747
750
return false ;
748
751
}
749
752
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
+
750
768
export function createFragmentInstance (
751
769
fragmentFiber : Fiber ,
752
770
) : FragmentInstanceType {
0 commit comments