Skip to content

Commit 9eec520

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 4374cb6 commit 9eec520

File tree

71 files changed

+412569
-437719
lines changed

Some content is hidden

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

71 files changed

+412569
-437719
lines changed

compiled/babel-plugin-react-refresh/index.js

Lines changed: 551 additions & 804 deletions
Large diffs are not rendered by default.

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 60592 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 346 additions & 1551 deletions
Large diffs are not rendered by default.

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

Lines changed: 346 additions & 1554 deletions
Large diffs are not rendered by default.

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ee5c19493086fdeb32057e16d1e3414370242307
1+
e5a8de81e57181692d33ce916dfd6aa23638ec92
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e5a8de81e57181692d33ce916dfd6aa23638ec92

0 commit comments

Comments
 (0)