Преглед на файлове

Remove unnecessary array copying in core.treeModel.SchemaItem.

Szymon Cofalik преди 9 години
родител
ревизия
e5d2b96fdf
променени са 1 файла, в които са добавени 2 реда и са изтрити 4 реда
  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.