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

Simplified the process of rendering child Views in Template class.

Aleksander Nowodzinski 9 лет назад
Родитель
Сommit
ece62560e7
1 измененных файлов с 9 добавлено и 12 удалено
  1. 9 12
      packages/ckeditor5-ui/src/template.js

+ 9 - 12
packages/ckeditor5-ui/src/template.js

@@ -510,21 +510,18 @@ export default class Template {
 	 */
 	_renderElementChildren( elOrDocFragment, shouldApply ) {
 		let childIndex = 0;
-		let tpl, rendered;
 
 		for ( let child of this.children ) {
-			tpl = isView( child ) ? child.template : child;
-
-			if ( shouldApply ) {
-				rendered = tpl._renderNode( elOrDocFragment.childNodes[ childIndex++ ] );
-			} else {
-				elOrDocFragment.appendChild( ( rendered = tpl.render() ) );
-			}
-
-			// Set the element of the view the template belongs to to avoid re–rendering
-			// when the element later on by the view.
 			if ( isView( child ) ) {
-				child.element = rendered;
+				if ( !shouldApply ) {
+					elOrDocFragment.appendChild( child.element );
+				}
+			} else {
+				if ( shouldApply ) {
+					child._renderNode( elOrDocFragment.childNodes[ childIndex++ ] );
+				} else {
+					elOrDocFragment.appendChild( child.render() );
+				}
 			}
 		}
 	}