Skip to content

Commit

Permalink
chore: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed Jan 5, 2025
1 parent 84cb7f1 commit d0d4383
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/core/event/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ export function Events(Base) {
if (headingsInView.size === 1) {
activeHeading = headingsInView.values().next().value;
} else if (headingsInView.size > 1) {
activeHeading = Array.from(headingsInView).reduce((closest, current) => {
return !closest || (closest.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_FOLLOWING)
? current
: closest;
}, null);
activeHeading = Array.from(headingsInView).reduce(
(closest, current) => {
return !closest ||
closest.compareDocumentPosition(current) &
Node.DOCUMENT_POSITION_FOLLOWING
? current
: closest;
},
null,
);
}

if (activeHeading) {
Expand Down

0 comments on commit d0d4383

Please sign in to comment.