SIGN IN SIGN UP
facebook / react UNCLAIMED

The library for web and native user interfaces.

0 0 0 JavaScript

Fix fragmentInstance#compareDocumentPosition nesting and portal cases (#34069)

Found a couple of issues while integrating
FragmentInstance#compareDocumentPosition into Fabric.

1. Basic checks of nested host instances were inaccurate. For example,
checking the first child of the first child of the Fragment would not
return CONTAINED_BY.
2. Then fixing that logic exposed issues with Portals. The DOM
positioning relied on the assumption that the first and last top-level
children were in the same order as the Fiber tree. I added additional
checks against the parent's position in the DOM, and special cased a
portaled Fragment by getting its DOM parent from the child instance,
rather than taking the instance from the Fiber return. This should be
accurate in more cases. Though its still a guess and I'm not sure yet
I've covered every variation of this. Portals are hard to deal with and
we may end up having to push more results towards
IMPLEMENTATION_SPECIFIC if accuracy is an issue.

DiffTrain build for [a96a0f3903ea0a9d45ff7c30a3fd9efe830c4628](https://github.com/facebook/react/commit/a96a0f3903ea0a9d45ff7c30a3fd9efe830c4628)
J
jackpope committed
f2a70d1c1b9905d86efe9b3245cac8723c149256
Parent: 1288c47