Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Changed: Slight refactor in view.Position#compareWith.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Mar 21, 2018
1 parent 8089a5d commit a163b72
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/view/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,9 @@ export default class Position {
return 'same';
}

// Get path from root to position's parent element. "Indexify" the paths (change elements to indices).
const thisPath = this.getAncestors().map( element => element.index );
const otherPath = otherPosition.getAncestors().map( element => element.index );

// Remove `null`s that came from root elements.
thisPath.shift();
otherPath.shift();
// Get path from root to position's parent element.
const thisPath = this.parent.is( 'node' ) ? this.parent.getPath() : [];
const otherPath = otherPosition.parent.is( 'node' ) ? otherPosition.parent.getPath() : [];

// Add the positions' offsets to the parents offsets.
thisPath.push( this.offset );
Expand Down

0 comments on commit a163b72

Please sign in to comment.