浏览代码

Code refactoring in Region class.

Aleksander Nowodzinski 10 年之前
父节点
当前提交
ac9abd9551
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      packages/ckeditor5-ui/src/ui/region.js

+ 4 - 3
packages/ckeditor5-ui/src/ui/region.js

@@ -43,6 +43,9 @@ CKEDITOR.define( [ 'collection', 'model' ], function( Collection, Model ) {
 			this.views.on( 'remove', ( evt, view ) => view.el.remove() );
 		}
 
+		/**
+		 * Destroys the Region instance.
+		 */
 		destroy() {
 			// Drop the reference to HTMLElement but don't remove it from DOM.
 			// Element comes as a parameter and it could be a part of the View.
@@ -50,9 +53,7 @@ CKEDITOR.define( [ 'collection', 'model' ], function( Collection, Model ) {
 			this.el = null;
 
 			// Remove and destroy views.
-			for ( let i = this.views.length; i--; ) {
-				this.views.remove( i ).destroy();
-			}
+			this.views.forEach( v => this.views.remove( v ).destroy() );
 		}
 	}