@@ -645,6 +645,9 @@ export type FragmentInstanceType = {
645
645
observeUsing : ( observer : IntersectionObserver ) => void ,
646
646
unobserveUsing : ( observer : IntersectionObserver ) => void ,
647
647
compareDocumentPosition : ( otherNode : PublicInstance ) => number ,
648
+ getRootNode ( getRootNodeOptions ?: {
649
+ composed : boolean ,
650
+ } ) : Node | FragmentInstanceType ,
648
651
} ;
649
652
650
653
function FragmentInstance ( this : FragmentInstanceType , fragmentFiber : Fiber ) {
@@ -754,6 +757,21 @@ function collectChildren(child: Fiber, collection: Array<Fiber>): boolean {
754
757
return false ;
755
758
}
756
759
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
+
757
775
export function createFragmentInstance (
758
776
fragmentFiber : Fiber ,
759
777
) : FragmentInstanceType {
0 commit comments