Browse Source

Fixed: view.Selection#isEqual for fake selections.

Szymon Cofalik 9 years ago
parent
commit
da5f9cf7df
1 changed files with 6 additions and 6 deletions
  1. 6 6
      packages/ckeditor5-engine/src/view/selection.js

+ 6 - 6
packages/ckeditor5-engine/src/view/selection.js

@@ -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;
 		}