Browse Source

Fixed: Don't inject child view's element into DOM if collection has no _parentElement.

Aleksander Nowodziński 9 years ago
parent
commit
5550f078e9
1 changed files with 6 additions and 7 deletions
  1. 6 7
      packages/ckeditor5-ui/src/viewcollection.js

+ 6 - 7
packages/ckeditor5-ui/src/viewcollection.js

@@ -88,16 +88,15 @@ export default class ViewCollection extends Collection {
 			throw new CKEditorError( 'ui-viewviewcollection-init-reinit: This ViewCollection has already been initialized.' );
 		}
 
-		// Do not render unbound children. They're already in DOM by explicit declaration
-		// in Template definition.
-		if ( !this._parentElement ) {
-			return Promise.resolve();
-		}
-
 		const promises = [];
 
 		for ( let view of this ) {
-			this._parentElement.appendChild( view.element );
+			// Do not render unbound children. They're already in DOM by explicit declaration
+			// in Template definition.
+			if ( this._parentElement && view.element ) {
+				this._parentElement.appendChild( view.element );
+			}
+
 			promises.push( view.init() );
 		}