8
0
Просмотр исходного кода

Remove redundant check for parent element.

Tomek Wytrębowicz 5 лет назад
Родитель
Сommit
f00e282844
1 измененных файлов с 2 добавлено и 4 удалено
  1. 2 4
      packages/ckeditor5-select-all/src/selectallcommand.js

+ 2 - 4
packages/ckeditor5-select-all/src/selectallcommand.js

@@ -33,14 +33,12 @@ export default class SelectAllCommand extends Command {
 		const model = this.editor.model;
 		const selection = model.document.selection;
 		let limitElement = model.schema.getLimitElement( selection );
-
 		let place = 'in';
 		// If entire element was already selected, try selecting all in a parent limit element (if any).
 		if ( selection.containsEntireContent( limitElement ) && limitElement.root !== limitElement ) {
 			do {
-				if ( limitElement.parent ) {
-					limitElement = limitElement.parent;
-				}
+				// Eventually, the $root (limitElement.root === limitElement) will be a limit.
+				limitElement = limitElement.parent;
 			} while ( !model.schema.isLimit( limitElement ) );
 			place = 'on';
 		}