Skip to content

Commit 0599c38

Browse files
committed
Add compareDocumentPosition to fragment instances (facebook#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](facebook@e5a8de8)
1 parent fc578ff commit 0599c38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+328865
-109993
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19.2.0-native-fb-e5a8de81-20250506

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 408 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
8+
* @nolint
9+
* @preventMunge
10+
* @generated SignedSource<<e0055236c23545f61906397ccc9a19f8>>
11+
*/
12+
13+
"use strict";
14+
var React = require("react");
15+
function formatProdErrorMessage(code) {
16+
var url = "https://react.dev/errors/" + code;
17+
if (1 < arguments.length) {
18+
url += "?args[]=" + encodeURIComponent(arguments[1]);
19+
for (var i = 2; i < arguments.length; i++)
20+
url += "&args[]=" + encodeURIComponent(arguments[i]);
21+
}
22+
return (
23+
"Minified React error #" +
24+
code +
25+
"; visit " +
26+
url +
27+
" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
28+
);
29+
}
30+
function noop() {}
31+
var Internals = {
32+
d: {
33+
f: noop,
34+
r: function () {
35+
throw Error(formatProdErrorMessage(522));
36+
},
37+
D: noop,
38+
C: noop,
39+
L: noop,
40+
m: noop,
41+
X: noop,
42+
S: noop,
43+
M: noop
44+
},
45+
p: 0,
46+
findDOMNode: null
47+
},
48+
REACT_PORTAL_TYPE = Symbol.for("react.portal");
49+
function createPortal$1(children, containerInfo, implementation) {
50+
var key =
51+
3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
52+
return {
53+
$$typeof: REACT_PORTAL_TYPE,
54+
key: null == key ? null : "" + key,
55+
children: children,
56+
containerInfo: containerInfo,
57+
implementation: implementation
58+
};
59+
}
60+
var ReactSharedInternals =
61+
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
62+
function getCrossOriginStringAs(as, input) {
63+
if ("font" === as) return "";
64+
if ("string" === typeof input)
65+
return "use-credentials" === input ? input : "";
66+
}
67+
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
68+
Internals;
69+
exports.createPortal = function (children, container) {
70+
var key =
71+
2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
72+
if (
73+
!container ||
74+
(1 !== container.nodeType &&
75+
9 !== container.nodeType &&
76+
11 !== container.nodeType)
77+
)
78+
throw Error(formatProdErrorMessage(299));
79+
return createPortal$1(children, container, null, key);
80+
};
81+
exports.flushSync = function () {
82+
throw Error(
83+
"Expected this build of React to not support legacy mode but it does. This is a bug in React."
84+
);
85+
};
86+
exports.preconnect = function (href, options) {
87+
"string" === typeof href &&
88+
(options
89+
? ((options = options.crossOrigin),
90+
(options =
91+
"string" === typeof options
92+
? "use-credentials" === options
93+
? options
94+
: ""
95+
: void 0))
96+
: (options = null),
97+
Internals.d.C(href, options));
98+
};
99+
exports.prefetchDNS = function (href) {
100+
"string" === typeof href && Internals.d.D(href);
101+
};
102+
exports.preinit = function (href, options) {
103+
if ("string" === typeof href && options && "string" === typeof options.as) {
104+
var as = options.as,
105+
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
106+
integrity =
107+
"string" === typeof options.integrity ? options.integrity : void 0,
108+
fetchPriority =
109+
"string" === typeof options.fetchPriority
110+
? options.fetchPriority
111+
: void 0;
112+
"style" === as
113+
? Internals.d.S(
114+
href,
115+
"string" === typeof options.precedence ? options.precedence : void 0,
116+
{
117+
crossOrigin: crossOrigin,
118+
integrity: integrity,
119+
fetchPriority: fetchPriority
120+
}
121+
)
122+
: "script" === as &&
123+
Internals.d.X(href, {
124+
crossOrigin: crossOrigin,
125+
integrity: integrity,
126+
fetchPriority: fetchPriority,
127+
nonce: "string" === typeof options.nonce ? options.nonce : void 0
128+
});
129+
}
130+
};
131+
exports.preinitModule = function (href, options) {
132+
if ("string" === typeof href)
133+
if ("object" === typeof options && null !== options) {
134+
if (null == options.as || "script" === options.as) {
135+
var crossOrigin = getCrossOriginStringAs(
136+
options.as,
137+
options.crossOrigin
138+
);
139+
Internals.d.M(href, {
140+
crossOrigin: crossOrigin,
141+
integrity:
142+
"string" === typeof options.integrity ? options.integrity : void 0,
143+
nonce: "string" === typeof options.nonce ? options.nonce : void 0
144+
});
145+
}
146+
} else null == options && Internals.d.M(href);
147+
};
148+
exports.preload = function (href, options) {
149+
if (
150+
"string" === typeof href &&
151+
"object" === typeof options &&
152+
null !== options &&
153+
"string" === typeof options.as
154+
) {
155+
var as = options.as,
156+
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
157+
Internals.d.L(href, as, {
158+
crossOrigin: crossOrigin,
159+
integrity:
160+
"string" === typeof options.integrity ? options.integrity : void 0,
161+
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
162+
type: "string" === typeof options.type ? options.type : void 0,
163+
fetchPriority:
164+
"string" === typeof options.fetchPriority
165+
? options.fetchPriority
166+
: void 0,
167+
referrerPolicy:
168+
"string" === typeof options.referrerPolicy
169+
? options.referrerPolicy
170+
: void 0,
171+
imageSrcSet:
172+
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
173+
imageSizes:
174+
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
175+
media: "string" === typeof options.media ? options.media : void 0
176+
});
177+
}
178+
};
179+
exports.preloadModule = function (href, options) {
180+
if ("string" === typeof href)
181+
if (options) {
182+
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
183+
Internals.d.m(href, {
184+
as:
185+
"string" === typeof options.as && "script" !== options.as
186+
? options.as
187+
: void 0,
188+
crossOrigin: crossOrigin,
189+
integrity:
190+
"string" === typeof options.integrity ? options.integrity : void 0
191+
});
192+
} else Internals.d.m(href);
193+
};
194+
exports.requestFormReset = function (form) {
195+
Internals.d.r(form);
196+
};
197+
exports.unstable_batchedUpdates = function (fn, a) {
198+
return fn(a);
199+
};
200+
exports.useFormState = function (action, initialState, permalink) {
201+
return ReactSharedInternals.H.useFormState(action, initialState, permalink);
202+
};
203+
exports.useFormStatus = function () {
204+
return ReactSharedInternals.H.useHostTransitionStatus();
205+
};
206+
exports.version = "19.2.0-native-fb-e5a8de81-20250506";

0 commit comments

Comments
 (0)