|
|
@@ -290,21 +290,21 @@ export default class Selection {
|
|
|
* @returns {Boolean} `true` if selections are equal, `false` otherwise.
|
|
|
*/
|
|
|
isEqual( otherSelection ) {
|
|
|
- if ( this.rangeCount != otherSelection.rangeCount ) {
|
|
|
+ if ( this.isFake != otherSelection.isFake ) {
|
|
|
return false;
|
|
|
- } else if ( this.rangeCount === 0 ) {
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
- if ( !this.anchor.isEqual( otherSelection.anchor ) || !this.focus.isEqual( otherSelection.focus ) ) {
|
|
|
+ if ( this.isFake && this.fakeSelectionLabel != otherSelection.fakeSelectionLabel ) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if ( this.isFake != otherSelection.isFake ) {
|
|
|
+ if ( this.rangeCount != otherSelection.rangeCount ) {
|
|
|
return false;
|
|
|
+ } else if ( this.rangeCount === 0 ) {
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- if ( this.isFake && this.fakeSelectionLabel != otherSelection.fakeSelectionLabel ) {
|
|
|
+ if ( !this.anchor.isEqual( otherSelection.anchor ) || !this.focus.isEqual( otherSelection.focus ) ) {
|
|
|
return false;
|
|
|
}
|
|
|
|