Skip to content

Commit

Permalink
Merge pull request #11463 from ckeditor/cf/4467
Browse files Browse the repository at this point in the history
Other (engine): Improved `model.TreeWalker#next()` efficiency. See #11463.
  • Loading branch information
Reinmar authored Mar 28, 2022
2 parents ee63f39 + f46d732 commit 23122e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/ckeditor5-engine/src/model/treewalker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 23122e0

Please sign in to comment.