diff --git a/packages/ckeditor5-engine/src/model/treewalker.js b/packages/ckeditor5-engine/src/model/treewalker.js index 4ed3c1dd821..1e92acb818b 100644 --- a/packages/ckeditor5-engine/src/model/treewalker.js +++ b/packages/ckeditor5-engine/src/model/treewalker.js @@ -233,9 +233,8 @@ export default class TreeWalker { // Get node just after the current position. // Use a highly optimized version instead of checking the text node first and then getting the node after. See #6582. - const positionParent = position.parent; - const textNodeAtPosition = getTextNodeAtPosition( position, positionParent ); - const node = textNodeAtPosition ? textNodeAtPosition : getNodeAfterPosition( position, positionParent, textNodeAtPosition ); + const textNodeAtPosition = getTextNodeAtPosition( position, parent ); + const node = textNodeAtPosition ? textNodeAtPosition : getNodeAfterPosition( position, parent, textNodeAtPosition ); if ( node instanceof Element ) { if ( !this.shallow ) {