Skip to content

Commit 0d8b339

Browse files
committed
Add compareDocumentPosition to fragment instances (#32722)
This adds `compareDocumentPosition(otherNode)` to fragment instances. The semantics implemented are meant to match typical element positioning, with some fragment specifics. See the unit tests for all expectations. - An element preceding a fragment is `Node.DOCUMENT_POSITION_PRECEDING` - An element after a fragment is `Node.DOCUMENT_POSITION_FOLLOWING` - An element containing the fragment is `Node.DOCUMENT_POSITION_PRECEDING` and `Node.DOCUMENT_POSITION_CONTAINING` - An element within the fragment is `Node.DOCUMENT_POSITION_CONTAINED_BY` - An element compared against an empty fragment will result in `Node.DOCUMENT_POSITION_DISCONNECTED` and `Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` Since we assume a fragment instances target children are DOM siblings and we want to compare the full fragment as a pseudo container, we can compare against the first target child outside of handling the special cases (empty fragments and contained elements). DiffTrain build for [e5a8de8](e5a8de8)
1 parent 4b7bb3f commit 0d8b339

34 files changed

+3676
-1662
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
845d93742fb090e7a35abea409a55e2a14613255
1+
e5a8de81e57181692d33ce916dfd6aa23638ec92
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
845d93742fb090e7a35abea409a55e2a14613255
1+
e5a8de81e57181692d33ce916dfd6aa23638ec92

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ __DEV__ &&
15381538
exports.useTransition = function () {
15391539
return resolveDispatcher().useTransition();
15401540
};
1541-
exports.version = "19.2.0-www-classic-845d9374-20250506";
1541+
exports.version = "19.2.0-www-classic-e5a8de81-20250506";
15421542
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15431543
"function" ===
15441544
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ __DEV__ &&
15381538
exports.useTransition = function () {
15391539
return resolveDispatcher().useTransition();
15401540
};
1541-
exports.version = "19.2.0-www-modern-845d9374-20250506";
1541+
exports.version = "19.2.0-www-modern-e5a8de81-20250506";
15421542
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15431543
"function" ===
15441544
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,4 +636,4 @@ exports.useSyncExternalStore = function (
636636
exports.useTransition = function () {
637637
return ReactSharedInternals.H.useTransition();
638638
};
639-
exports.version = "19.2.0-www-classic-845d9374-20250506";
639+
exports.version = "19.2.0-www-classic-e5a8de81-20250506";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,4 +636,4 @@ exports.useSyncExternalStore = function (
636636
exports.useTransition = function () {
637637
return ReactSharedInternals.H.useTransition();
638638
};
639-
exports.version = "19.2.0-www-modern-845d9374-20250506";
639+
exports.version = "19.2.0-www-modern-e5a8de81-20250506";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ exports.useSyncExternalStore = function (
640640
exports.useTransition = function () {
641641
return ReactSharedInternals.H.useTransition();
642642
};
643-
exports.version = "19.2.0-www-classic-845d9374-20250506";
643+
exports.version = "19.2.0-www-classic-e5a8de81-20250506";
644644
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
645645
"function" ===
646646
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ exports.useSyncExternalStore = function (
640640
exports.useTransition = function () {
641641
return ReactSharedInternals.H.useTransition();
642642
};
643-
exports.version = "19.2.0-www-modern-845d9374-20250506";
643+
exports.version = "19.2.0-www-modern-e5a8de81-20250506";
644644
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
645645
"function" ===
646646
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19032,10 +19032,10 @@ __DEV__ &&
1903219032
(function () {
1903319033
var internals = {
1903419034
bundleType: 1,
19035-
version: "19.2.0-www-classic-845d9374-20250506",
19035+
version: "19.2.0-www-classic-e5a8de81-20250506",
1903619036
rendererPackageName: "react-art",
1903719037
currentDispatcherRef: ReactSharedInternals,
19038-
reconcilerVersion: "19.2.0-www-classic-845d9374-20250506"
19038+
reconcilerVersion: "19.2.0-www-classic-e5a8de81-20250506"
1903919039
};
1904019040
internals.overrideHookState = overrideHookState;
1904119041
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19069,7 +19069,7 @@ __DEV__ &&
1906919069
exports.Shape = Shape;
1907019070
exports.Surface = Surface;
1907119071
exports.Text = Text;
19072-
exports.version = "19.2.0-www-classic-845d9374-20250506";
19072+
exports.version = "19.2.0-www-classic-e5a8de81-20250506";
1907319073
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1907419074
"function" ===
1907519075
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18804,10 +18804,10 @@ __DEV__ &&
1880418804
(function () {
1880518805
var internals = {
1880618806
bundleType: 1,
18807-
version: "19.2.0-www-modern-845d9374-20250506",
18807+
version: "19.2.0-www-modern-e5a8de81-20250506",
1880818808
rendererPackageName: "react-art",
1880918809
currentDispatcherRef: ReactSharedInternals,
18810-
reconcilerVersion: "19.2.0-www-modern-845d9374-20250506"
18810+
reconcilerVersion: "19.2.0-www-modern-e5a8de81-20250506"
1881118811
};
1881218812
internals.overrideHookState = overrideHookState;
1881318813
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -18841,7 +18841,7 @@ __DEV__ &&
1884118841
exports.Shape = Shape;
1884218842
exports.Surface = Surface;
1884318843
exports.Text = Text;
18844-
exports.version = "19.2.0-www-modern-845d9374-20250506";
18844+
exports.version = "19.2.0-www-modern-e5a8de81-20250506";
1884518845
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1884618846
"function" ===
1884718847
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)