Przeglądaj źródła

Changed: view.writer move array out of the function scope so it is not reinitialized in each call.

Szymon Cofalik 9 lat temu
rodzic
commit
9ea96428a8
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      packages/ckeditor5-engine/src/view/writer.js

+ 3 - 3
packages/ckeditor5-engine/src/view/writer.js

@@ -1210,10 +1210,8 @@ function rangeSpansOnAllChildren( range ) {
 // @param Iterable.<module:engine/view/text~Text|module:engine/view/attributeelement~AttributeElement
 // |module:engine/view/containerelement~ContainerElement> nodes
 function validateNodesToInsert( nodes ) {
-	const validNodes = [ Text, AttributeElement, ContainerElement, EmptyElement, UIElement ];
-
 	for ( let node of nodes ) {
-		if ( !validNodes.some( ( validNode => node instanceof validNode ) ) ) {
+		if ( !validNodesToInsert.some( ( validNode => node instanceof validNode ) ) ) {
 			/**
 			 * Inserted nodes should be valid to insert. of {@link module:engine/view/attributeelement~AttributeElement AttributeElement},
 			 * {@link module:engine/view/containerelement~ContainerElement ContainerElement},
@@ -1231,6 +1229,8 @@ function validateNodesToInsert( nodes ) {
 	}
 }
 
+const validNodesToInsert = [ Text, AttributeElement, ContainerElement, EmptyElement, UIElement ];
+
 // Checks if node is ContainerElement or DocumentFragment, because in most cases they should be treated the same way.
 //
 // @param {module:engine/view/node~Node} node