8
0
Prechádzať zdrojové kódy

Remove unnecessary transformation to array.

Oskar Wróbel 8 rokov pred
rodič
commit
70bda18f9a

+ 2 - 2
packages/ckeditor5-engine/src/controller/deletecontent.js

@@ -74,7 +74,7 @@ export default function deleteContent( selection, batch, options = {} ) {
 		//
 		// e.g. bold is disallowed for <H1>
 		// <h1>Fo{o</h1><p>b}a<b>r</b><p> -> <h1>Fo{}a<b>r</b><h1> -> <h1>Fo{}ar<h1>.
-		removeDisallowedAttributes( Array.from( startPos.parent.getChildren() ), startPos, batch );
+		removeDisallowedAttributes( startPos.parent.getChildren(), startPos, batch );
 	}
 
 	selection.setCollapsedAt( startPos );
@@ -249,7 +249,7 @@ function removeDisallowedAttributes( nodes, schemaPath, batch ) {
 		}
 
 		if ( node.is( 'element' ) ) {
-			removeDisallowedAttributes( Array.from( node.getChildren() ), Position.createAt( node ), batch );
+			removeDisallowedAttributes( node.getChildren(), Position.createAt( node ), batch );
 		}
 	}
 }

+ 4 - 4
packages/ckeditor5-engine/src/controller/insertcontent.js

@@ -291,7 +291,7 @@ class Insertion {
 			// We need to check and strip disallowed attributes in all nested nodes because after merge
 			// some attributes could end up in a path where are disallowed.
 			const parent = position.nodeBefore;
-			removeDisallowedAttributes( Array.from( parent.getChildren() ), Position.createAt( parent ), this.schema, this.batch );
+			removeDisallowedAttributes( parent.getChildren(), Position.createAt( parent ), this.schema, this.batch );
 
 			this.position = Position.createFromPosition( position );
 			position.detach();
@@ -318,7 +318,7 @@ class Insertion {
 
 			// We need to check and strip disallowed attributes in all nested nodes because after merge
 			// some attributes could end up in a place where are disallowed.
-			removeDisallowedAttributes( Array.from( position.parent.getChildren() ), position, this.schema, this.batch );
+			removeDisallowedAttributes( position.parent.getChildren(), position, this.schema, this.batch );
 
 			this.position = Position.createFromPosition( position );
 			position.detach();
@@ -330,7 +330,7 @@ class Insertion {
 		// When there was no merge we need to check and strip disallowed attributes in all nested nodes of
 		// just inserted node because some attributes could end up in a place where are disallowed.
 		if ( !mergeLeft && !mergeRight ) {
-			removeDisallowedAttributes( Array.from( node.getChildren() ), Position.createAt( node ), this.schema, this.batch );
+			removeDisallowedAttributes( node.getChildren(), Position.createAt( node ), this.schema, this.batch );
 		}
 	}
 
@@ -482,7 +482,7 @@ function removeDisallowedAttributes( nodes, schemaPath, schema, batch ) {
 		}
 
 		if ( node.is( 'element' ) ) {
-			removeDisallowedAttributes( Array.from( node.getChildren() ), Position.createAt( node ), schema, batch );
+			removeDisallowedAttributes( node.getChildren(), Position.createAt( node ), schema, batch );
 		}
 	}
 }