8
0
Prechádzať zdrojové kódy

Remove redundant check for parent element.

Tomek Wytrębowicz 5 rokov pred
rodič
commit
f00e282844

+ 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';
 		}