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

Do not use library method in Position#offset.

This is a performance enhancement. Offset is calculated many times in model operations. Getters should be As Fast As Possible thus calling external method that do too much is not desired here.
Maciej Gołaszewski преди 5 години
родител
ревизия
37c7b02591
променени са 1 файла, в които са добавени 1 реда и са изтрити 2 реда
  1. 1 2
      packages/ckeditor5-engine/src/model/position.js

+ 1 - 2
packages/ckeditor5-engine/src/model/position.js

@@ -11,7 +11,6 @@ import TreeWalker from './treewalker';
 import compareArrays from '@ckeditor/ckeditor5-utils/src/comparearrays';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import Text from './text';
-import { last } from 'lodash-es';
 
 // To check if component is loaded more than once.
 import '@ckeditor/ckeditor5-utils/src/version';
@@ -141,7 +140,7 @@ export default class Position {
 	 * @type {Number}
 	 */
 	get offset() {
-		return last( this.path );
+		return this.path[ this.path.length - 1 ];
 	}
 
 	/**