Ver Fonte

Fixed comments wording.

Piotrek Koszuliński há 9 anos atrás
pai
commit
62fd93331c

+ 11 - 10
packages/ckeditor5-engine/src/view/observer/selectionobserver.js

@@ -71,21 +71,21 @@ export default class SelectionObserver extends Observer {
 		this._documents = new WeakSet();
 		this._documents = new WeakSet();
 
 
 		/**
 		/**
-		 * Private property to store the last selection, to check if the code do not enter infinite loop.
+		 * Private property to store the last selection, to check if the code does not enter infinite loop.
 		 *
 		 *
 		 * @private
 		 * @private
 		 * @member {engine.view.Selection} engine.view.observer.SelectionObserver#_lastSelection
 		 * @member {engine.view.Selection} engine.view.observer.SelectionObserver#_lastSelection
 		 */
 		 */
 
 
 		/**
 		/**
-		 * Private property to store the last but one selection, to check if the code do not enter infinite loop.
+		 * Private property to store the last but one selection, to check if the code does not enter infinite loop.
 		 *
 		 *
 		 * @private
 		 * @private
 		 * @member {engine.view.Selection} engine.view.observer.SelectionObserver#_lastButOneSelection
 		 * @member {engine.view.Selection} engine.view.observer.SelectionObserver#_lastButOneSelection
 		 */
 		 */
 
 
 		/**
 		/**
-		 * Private property to check if the code do not enter infinite loop.
+		 * Private property to check if the code does not enter infinite loop.
 		 *
 		 *
 		 * @private
 		 * @private
 		 * @member {Number} engine.view.observer.SelectionObserver#_loopbackCounter
 		 * @member {Number} engine.view.observer.SelectionObserver#_loopbackCounter
@@ -137,16 +137,17 @@ export default class SelectionObserver extends Observer {
 			return;
 			return;
 		}
 		}
 
 
-		// Ensure we are no in the infinite loop (#400).
+		// Ensure we are not in the infinite loop (#400).
 		if ( this._isInfiniteLoop( newViewSelection ) ) {
 		if ( this._isInfiniteLoop( newViewSelection ) ) {
 			/**
 			/**
-			 * Selection infinite loop. Most probably you try to put the selection in the position which is not allowed
-			 * by the browser and browser fix it automatically what causes selectionChange event, re-rendering wrong
-			 * selection and again.
+			 * Selection change observer detected an infinite rendering loop.
+			 * Most probably you try to put the selection in the position which is not allowed
+			 * by the browser and browser fixes it automatically what causes `selectionchange` event on
+			 * which a loopback through a model tries to re-render the wrong selection and again.
 			 *
 			 *
-			 * @error selectionchange-inifite-loop
+			 * @error selectionchange-infinite-loop
 			 */
 			 */
-			log.warn( 'selectionchange-inifite-loop: Selection change enter infinite loop.' );
+			log.warn( 'selectionchange-infinite-loop: Selection change observer detected an infinite rendering loop.' );
 
 
 			return;
 			return;
 		}
 		}
@@ -162,7 +163,7 @@ export default class SelectionObserver extends Observer {
 	}
 	}
 
 
 	/**
 	/**
-	 * Checks if we do enter infinite loop.
+	 * Checks if selection rendering entered an infinite loop.
 	 *
 	 *
 	 * @private
 	 * @private
 	 * @param {engine.view.Selection} newSelection DOM selection converted to view.
 	 * @param {engine.view.Selection} newSelection DOM selection converted to view.

+ 3 - 3
packages/ckeditor5-engine/tests/view/observer/selectionobserver.js

@@ -153,7 +153,7 @@ describe( 'SelectionObserver', () => {
 				warnedOnce = true;
 				warnedOnce = true;
 
 
 				setTimeout( () => {
 				setTimeout( () => {
-					expect( msg ).to.match( /^selectionchange-inifite-loop/ );
+					expect( msg ).to.match( /^selectionchange-infinite-loop/ );
 					done();
 					done();
 				}, 200 );
 				}, 200 );
 			}
 			}
@@ -162,7 +162,7 @@ describe( 'SelectionObserver', () => {
 		changeDomSelection();
 		changeDomSelection();
 	} );
 	} );
 
 
-	it( 'should not be thread as an infinite loop if the position is different', ( done ) => {
+	it( 'should not be treated as an infinite loop if the position is different', ( done ) => {
 		let counter = 30;
 		let counter = 30;
 
 
 		const viewFoo = viewDocument.getRoot().getChild( 0 ).getChild( 0 );
 		const viewFoo = viewDocument.getRoot().getChild( 0 ).getChild( 0 );
@@ -181,7 +181,7 @@ describe( 'SelectionObserver', () => {
 		changeCollapsedDomSelection( counter );
 		changeCollapsedDomSelection( counter );
 	} );
 	} );
 
 
-	it( 'should not be thread as an infinite loop if it is less then 3 times', ( done ) => {
+	it( 'should not be treated as an infinite loop if it is less then 3 times', ( done ) => {
 		let counter = 3;
 		let counter = 3;
 
 
 		const viewFoo = viewDocument.getRoot().getChild( 0 ).getChild( 0 );
 		const viewFoo = viewDocument.getRoot().getChild( 0 ).getChild( 0 );