diff --git a/src/models/node.js b/src/models/node.js index 7f7483b1c..dff96ee50 100644 --- a/src/models/node.js +++ b/src/models/node.js @@ -170,7 +170,9 @@ const Node = { forEachDescendant(iterator) { return this.nodes.forEach((child, i, nodes) => { - iterator(child, i, nodes) + if (iterator(child, i, nodes) === false) { + return false + } if (child.kind != 'text') child.forEachDescendant(iterator) }) },