Răsfoiți Sursa

Remove unnecessary array copying in core.treeModel.SchemaItem.

Szymon Cofalik 9 ani în urmă
părinte
comite
e5d2b96fdf
1 a modificat fișierele cu 2 adăugiri și 4 ștergeri
  1. 2 4
      packages/ckeditor5-engine/src/treemodel/schema.js

+ 2 - 4
packages/ckeditor5-engine/src/treemodel/schema.js

@@ -79,10 +79,10 @@ export class SchemaItem {
 	_addPath( member, path, attribute ) {
 		if ( typeof path === 'string' ) {
 			path = path.split( ' ' );
+		} else {
+			path = path.slice();
 		}
 
-		path = path.slice();
-
 		this[ member ].push( { path, attribute } );
 	}
 
@@ -119,8 +119,6 @@ export class SchemaItem {
 	_hasMatchingPath( type, checkPath, attribute ) {
 		const itemPaths = this._getPaths( type, attribute );
 
-		checkPath = checkPath.slice();
-
 		// We check every path registered (possibly with given attribute) in the item.
 		for ( let itemPath of itemPaths ) {
 			// We have one of paths registered in the item.