Skip to content

Commit 6d25b6a

Browse files
committedFeb 6, 2025·
[Fiber] getHoistableRoot() should account for Document containers (#32321)
While modern DOM implementations all support getRootNode if you are running React in a runtime which does not the fallback logic which uses `.ownerDocument` works everywhere except when the container is a Document itself. This change corrects this by returning the container intsance if it is a Document type. DiffTrain build for [b48e739](b48e739)
1 parent 02b8f6c commit 6d25b6a

34 files changed

+116
-96
lines changed
 

Diff for: ‎compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ff6283340a10bb72ad0fb16ca027606a9ea1e67c
1+
b48e739998432fc9672a42d0d04515980b8cae82

Diff for: ‎compiled/facebook-www/REVISION_TRANSFORMS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ff6283340a10bb72ad0fb16ca027606a9ea1e67c
1+
b48e739998432fc9672a42d0d04515980b8cae82

Diff for: ‎compiled/facebook-www/React-dev.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ __DEV__ &&
19721972
exports.useTransition = function () {
19731973
return resolveDispatcher().useTransition();
19741974
};
1975-
exports.version = "19.1.0-www-classic-ff628334-20250205";
1975+
exports.version = "19.1.0-www-classic-b48e7399-20250206";
19761976
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19771977
"function" ===
19781978
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/React-dev.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ __DEV__ &&
19721972
exports.useTransition = function () {
19731973
return resolveDispatcher().useTransition();
19741974
};
1975-
exports.version = "19.1.0-www-modern-ff628334-20250205";
1975+
exports.version = "19.1.0-www-modern-b48e7399-20250206";
19761976
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19771977
"function" ===
19781978
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/React-prod.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
639639
exports.useTransition = function () {
640640
return ReactSharedInternals.H.useTransition();
641641
};
642-
exports.version = "19.1.0-www-classic-ff628334-20250205";
642+
exports.version = "19.1.0-www-classic-b48e7399-20250206";

Diff for: ‎compiled/facebook-www/React-prod.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
639639
exports.useTransition = function () {
640640
return ReactSharedInternals.H.useTransition();
641641
};
642-
exports.version = "19.1.0-www-modern-ff628334-20250205";
642+
exports.version = "19.1.0-www-modern-b48e7399-20250206";

Diff for: ‎compiled/facebook-www/React-profiling.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ exports.useSyncExternalStore = function (
643643
exports.useTransition = function () {
644644
return ReactSharedInternals.H.useTransition();
645645
};
646-
exports.version = "19.1.0-www-classic-ff628334-20250205";
646+
exports.version = "19.1.0-www-classic-b48e7399-20250206";
647647
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
648648
"function" ===
649649
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/React-profiling.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ exports.useSyncExternalStore = function (
643643
exports.useTransition = function () {
644644
return ReactSharedInternals.H.useTransition();
645645
};
646-
exports.version = "19.1.0-www-modern-ff628334-20250205";
646+
exports.version = "19.1.0-www-modern-b48e7399-20250206";
647647
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
648648
"function" ===
649649
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/ReactART-dev.classic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -17417,10 +17417,10 @@ __DEV__ &&
1741717417
(function () {
1741817418
var internals = {
1741917419
bundleType: 1,
17420-
version: "19.1.0-www-classic-ff628334-20250205",
17420+
version: "19.1.0-www-classic-b48e7399-20250206",
1742117421
rendererPackageName: "react-art",
1742217422
currentDispatcherRef: ReactSharedInternals,
17423-
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
17423+
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
1742417424
};
1742517425
internals.overrideHookState = overrideHookState;
1742617426
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -17454,7 +17454,7 @@ __DEV__ &&
1745417454
exports.Shape = Shape;
1745517455
exports.Surface = Surface;
1745617456
exports.Text = Text;
17457-
exports.version = "19.1.0-www-classic-ff628334-20250205";
17457+
exports.version = "19.1.0-www-classic-b48e7399-20250206";
1745817458
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1745917459
"function" ===
1746017460
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/ReactART-dev.modern.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -17189,10 +17189,10 @@ __DEV__ &&
1718917189
(function () {
1719017190
var internals = {
1719117191
bundleType: 1,
17192-
version: "19.1.0-www-modern-ff628334-20250205",
17192+
version: "19.1.0-www-modern-b48e7399-20250206",
1719317193
rendererPackageName: "react-art",
1719417194
currentDispatcherRef: ReactSharedInternals,
17195-
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
17195+
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
1719617196
};
1719717197
internals.overrideHookState = overrideHookState;
1719817198
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -17226,7 +17226,7 @@ __DEV__ &&
1722617226
exports.Shape = Shape;
1722717227
exports.Surface = Surface;
1722817228
exports.Text = Text;
17229-
exports.version = "19.1.0-www-modern-ff628334-20250205";
17229+
exports.version = "19.1.0-www-modern-b48e7399-20250206";
1723017230
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1723117231
"function" ===
1723217232
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/ReactART-prod.classic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11275,10 +11275,10 @@ var slice = Array.prototype.slice,
1127511275
})(React.Component);
1127611276
var internals$jscomp$inline_1567 = {
1127711277
bundleType: 0,
11278-
version: "19.1.0-www-classic-ff628334-20250205",
11278+
version: "19.1.0-www-classic-b48e7399-20250206",
1127911279
rendererPackageName: "react-art",
1128011280
currentDispatcherRef: ReactSharedInternals,
11281-
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
11281+
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
1128211282
};
1128311283
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1128411284
var hook$jscomp$inline_1568 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -11304,4 +11304,4 @@ exports.RadialGradient = RadialGradient;
1130411304
exports.Shape = TYPES.SHAPE;
1130511305
exports.Surface = Surface;
1130611306
exports.Text = Text;
11307-
exports.version = "19.1.0-www-classic-ff628334-20250205";
11307+
exports.version = "19.1.0-www-classic-b48e7399-20250206";

Diff for: ‎compiled/facebook-www/ReactART-prod.modern.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10990,10 +10990,10 @@ var slice = Array.prototype.slice,
1099010990
})(React.Component);
1099110991
var internals$jscomp$inline_1540 = {
1099210992
bundleType: 0,
10993-
version: "19.1.0-www-modern-ff628334-20250205",
10993+
version: "19.1.0-www-modern-b48e7399-20250206",
1099410994
rendererPackageName: "react-art",
1099510995
currentDispatcherRef: ReactSharedInternals,
10996-
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
10996+
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
1099710997
};
1099810998
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1099910999
var hook$jscomp$inline_1541 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -11019,4 +11019,4 @@ exports.RadialGradient = RadialGradient;
1101911019
exports.Shape = TYPES.SHAPE;
1102011020
exports.Surface = Surface;
1102111021
exports.Text = Text;
11022-
exports.version = "19.1.0-www-modern-ff628334-20250205";
11022+
exports.version = "19.1.0-www-modern-b48e7399-20250206";

Diff for: ‎compiled/facebook-www/ReactDOM-dev.classic.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -23301,7 +23301,9 @@ __DEV__ &&
2330123301
function getHoistableRoot(container) {
2330223302
return "function" === typeof container.getRootNode
2330323303
? container.getRootNode()
23304-
: container.ownerDocument;
23304+
: container.nodeType === DOCUMENT_NODE
23305+
? container
23306+
: container.ownerDocument;
2330523307
}
2330623308
function preconnectAs(rel, href, crossOrigin) {
2330723309
var ownerDocument = globalDocument;
@@ -28615,11 +28617,11 @@ __DEV__ &&
2861528617
return_targetInst = null;
2861628618
(function () {
2861728619
var isomorphicReactPackageVersion = React.version;
28618-
if ("19.1.0-www-classic-ff628334-20250205" !== isomorphicReactPackageVersion)
28620+
if ("19.1.0-www-classic-b48e7399-20250206" !== isomorphicReactPackageVersion)
2861928621
throw Error(
2862028622
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2862128623
(isomorphicReactPackageVersion +
28622-
"\n - react-dom: 19.1.0-www-classic-ff628334-20250205\nLearn more: https://react.dev/warnings/version-mismatch")
28624+
"\n - react-dom: 19.1.0-www-classic-b48e7399-20250206\nLearn more: https://react.dev/warnings/version-mismatch")
2862328625
);
2862428626
})();
2862528627
("function" === typeof Map &&
@@ -28662,10 +28664,10 @@ __DEV__ &&
2866228664
!(function () {
2866328665
var internals = {
2866428666
bundleType: 1,
28665-
version: "19.1.0-www-classic-ff628334-20250205",
28667+
version: "19.1.0-www-classic-b48e7399-20250206",
2866628668
rendererPackageName: "react-dom",
2866728669
currentDispatcherRef: ReactSharedInternals,
28668-
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
28670+
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
2866928671
};
2867028672
internals.overrideHookState = overrideHookState;
2867128673
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29263,7 +29265,7 @@ __DEV__ &&
2926329265
exports.useFormStatus = function () {
2926429266
return resolveDispatcher().useHostTransitionStatus();
2926529267
};
29266-
exports.version = "19.1.0-www-classic-ff628334-20250205";
29268+
exports.version = "19.1.0-www-classic-b48e7399-20250206";
2926729269
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2926829270
"function" ===
2926929271
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/ReactDOM-dev.modern.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -23095,7 +23095,9 @@ __DEV__ &&
2309523095
function getHoistableRoot(container) {
2309623096
return "function" === typeof container.getRootNode
2309723097
? container.getRootNode()
23098-
: container.ownerDocument;
23098+
: container.nodeType === DOCUMENT_NODE
23099+
? container
23100+
: container.ownerDocument;
2309923101
}
2310023102
function preconnectAs(rel, href, crossOrigin) {
2310123103
var ownerDocument = globalDocument;
@@ -28401,11 +28403,11 @@ __DEV__ &&
2840128403
return_targetInst = null;
2840228404
(function () {
2840328405
var isomorphicReactPackageVersion = React.version;
28404-
if ("19.1.0-www-modern-ff628334-20250205" !== isomorphicReactPackageVersion)
28406+
if ("19.1.0-www-modern-b48e7399-20250206" !== isomorphicReactPackageVersion)
2840528407
throw Error(
2840628408
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2840728409
(isomorphicReactPackageVersion +
28408-
"\n - react-dom: 19.1.0-www-modern-ff628334-20250205\nLearn more: https://react.dev/warnings/version-mismatch")
28410+
"\n - react-dom: 19.1.0-www-modern-b48e7399-20250206\nLearn more: https://react.dev/warnings/version-mismatch")
2840928411
);
2841028412
})();
2841128413
("function" === typeof Map &&
@@ -28448,10 +28450,10 @@ __DEV__ &&
2844828450
!(function () {
2844928451
var internals = {
2845028452
bundleType: 1,
28451-
version: "19.1.0-www-modern-ff628334-20250205",
28453+
version: "19.1.0-www-modern-b48e7399-20250206",
2845228454
rendererPackageName: "react-dom",
2845328455
currentDispatcherRef: ReactSharedInternals,
28454-
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
28456+
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
2845528457
};
2845628458
internals.overrideHookState = overrideHookState;
2845728459
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29049,7 +29051,7 @@ __DEV__ &&
2904929051
exports.useFormStatus = function () {
2905029052
return resolveDispatcher().useHostTransitionStatus();
2905129053
};
29052-
exports.version = "19.1.0-www-modern-ff628334-20250205";
29054+
exports.version = "19.1.0-www-modern-b48e7399-20250206";
2905329055
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2905429056
"function" ===
2905529057
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

Diff for: ‎compiled/facebook-www/ReactDOM-prod.classic.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -16963,7 +16963,9 @@ var preloadPropsMap = new Map(),
1696316963
function getHoistableRoot(container) {
1696416964
return "function" === typeof container.getRootNode
1696516965
? container.getRootNode()
16966-
: container.ownerDocument;
16966+
: 9 === container.nodeType
16967+
? container
16968+
: container.ownerDocument;
1696716969
}
1696816970
var previousDispatcher = Internals.d;
1696916971
Internals.d = {
@@ -18440,14 +18442,14 @@ function getCrossOriginStringAs(as, input) {
1844018442
}
1844118443
var isomorphicReactPackageVersion$jscomp$inline_1871 = React.version;
1844218444
if (
18443-
"19.1.0-www-classic-ff628334-20250205" !==
18445+
"19.1.0-www-classic-b48e7399-20250206" !==
1844418446
isomorphicReactPackageVersion$jscomp$inline_1871
1844518447
)
1844618448
throw Error(
1844718449
formatProdErrorMessage(
1844818450
527,
1844918451
isomorphicReactPackageVersion$jscomp$inline_1871,
18450-
"19.1.0-www-classic-ff628334-20250205"
18452+
"19.1.0-www-classic-b48e7399-20250206"
1845118453
)
1845218454
);
1845318455
Internals.findDOMNode = function (componentOrElement) {
@@ -18465,10 +18467,10 @@ Internals.Events = [
1846518467
];
1846618468
var internals$jscomp$inline_2431 = {
1846718469
bundleType: 0,
18468-
version: "19.1.0-www-classic-ff628334-20250205",
18470+
version: "19.1.0-www-classic-b48e7399-20250206",
1846918471
rendererPackageName: "react-dom",
1847018472
currentDispatcherRef: ReactSharedInternals,
18471-
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
18473+
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
1847218474
};
1847318475
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1847418476
var hook$jscomp$inline_2432 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -18832,4 +18834,4 @@ exports.useFormState = function (action, initialState, permalink) {
1883218834
exports.useFormStatus = function () {
1883318835
return ReactSharedInternals.H.useHostTransitionStatus();
1883418836
};
18835-
exports.version = "19.1.0-www-classic-ff628334-20250205";
18837+
exports.version = "19.1.0-www-classic-b48e7399-20250206";

Diff for: ‎compiled/facebook-www/ReactDOM-prod.modern.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -16694,7 +16694,9 @@ var preloadPropsMap = new Map(),
1669416694
function getHoistableRoot(container) {
1669516695
return "function" === typeof container.getRootNode
1669616696
? container.getRootNode()
16697-
: container.ownerDocument;
16697+
: 9 === container.nodeType
16698+
? container
16699+
: container.ownerDocument;
1669816700
}
1669916701
var previousDispatcher = Internals.d;
1670016702
Internals.d = {
@@ -18171,14 +18173,14 @@ function getCrossOriginStringAs(as, input) {
1817118173
}
1817218174
var isomorphicReactPackageVersion$jscomp$inline_1861 = React.version;
1817318175
if (
18174-
"19.1.0-www-modern-ff628334-20250205" !==
18176+
"19.1.0-www-modern-b48e7399-20250206" !==
1817518177
isomorphicReactPackageVersion$jscomp$inline_1861
1817618178
)
1817718179
throw Error(
1817818180
formatProdErrorMessage(
1817918181
527,
1818018182
isomorphicReactPackageVersion$jscomp$inline_1861,
18181-
"19.1.0-www-modern-ff628334-20250205"
18183+
"19.1.0-www-modern-b48e7399-20250206"
1818218184
)
1818318185
);
1818418186
Internals.findDOMNode = function (componentOrElement) {
@@ -18196,10 +18198,10 @@ Internals.Events = [
1819618198
];
1819718199
var internals$jscomp$inline_2413 = {
1819818200
bundleType: 0,
18199-
version: "19.1.0-www-modern-ff628334-20250205",
18201+
version: "19.1.0-www-modern-b48e7399-20250206",
1820018202
rendererPackageName: "react-dom",
1820118203
currentDispatcherRef: ReactSharedInternals,
18202-
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
18204+
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
1820318205
};
1820418206
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1820518207
var hook$jscomp$inline_2414 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -18563,4 +18565,4 @@ exports.useFormState = function (action, initialState, permalink) {
1856318565
exports.useFormStatus = function () {
1856418566
return ReactSharedInternals.H.useHostTransitionStatus();
1856518567
};
18566-
exports.version = "19.1.0-www-modern-ff628334-20250205";
18568+
exports.version = "19.1.0-www-modern-b48e7399-20250206";

Diff for: ‎compiled/facebook-www/ReactDOM-profiling.classic.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -17654,7 +17654,9 @@ var preloadPropsMap = new Map(),
1765417654
function getHoistableRoot(container) {
1765517655
return "function" === typeof container.getRootNode
1765617656
? container.getRootNode()
17657-
: container.ownerDocument;
17657+
: 9 === container.nodeType
17658+
? container
17659+
: container.ownerDocument;
1765817660
}
1765917661
var previousDispatcher = Internals.d;
1766017662
Internals.d = {
@@ -19131,14 +19133,14 @@ function getCrossOriginStringAs(as, input) {
1913119133
}
1913219134
var isomorphicReactPackageVersion$jscomp$inline_1968 = React.version;
1913319135
if (
19134-
"19.1.0-www-classic-ff628334-20250205" !==
19136+
"19.1.0-www-classic-b48e7399-20250206" !==
1913519137
isomorphicReactPackageVersion$jscomp$inline_1968
1913619138
)
1913719139
throw Error(
1913819140
formatProdErrorMessage(
1913919141
527,
1914019142
isomorphicReactPackageVersion$jscomp$inline_1968,
19141-
"19.1.0-www-classic-ff628334-20250205"
19143+
"19.1.0-www-classic-b48e7399-20250206"
1914219144
)
1914319145
);
1914419146
Internals.findDOMNode = function (componentOrElement) {
@@ -19156,10 +19158,10 @@ Internals.Events = [
1915619158
];
1915719159
var internals$jscomp$inline_1970 = {
1915819160
bundleType: 0,
19159-
version: "19.1.0-www-classic-ff628334-20250205",
19161+
version: "19.1.0-www-classic-b48e7399-20250206",
1916019162
rendererPackageName: "react-dom",
1916119163
currentDispatcherRef: ReactSharedInternals,
19162-
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
19164+
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
1916319165
};
1916419166
enableSchedulingProfiler &&
1916519167
((internals$jscomp$inline_1970.getLaneLabelMap = getLaneLabelMap),
@@ -19526,7 +19528,7 @@ exports.useFormState = function (action, initialState, permalink) {
1952619528
exports.useFormStatus = function () {
1952719529
return ReactSharedInternals.H.useHostTransitionStatus();
1952819530
};
19529-
exports.version = "19.1.0-www-classic-ff628334-20250205";
19531+
exports.version = "19.1.0-www-classic-b48e7399-20250206";
1953019532
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1953119533
"function" ===
1953219534
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)