diff --git a/src/editor/deserialize.js b/src/editor/deserialize.js index abcfbf7dd7..58e188457a 100644 --- a/src/editor/deserialize.js +++ b/src/editor/deserialize.js @@ -124,19 +124,19 @@ function parseElement(n, partCreator, lastNode, state) { state.listDepth = (state.listDepth || 0) + 1; // es-lint-disable-next-line no-fallthrough default: - // don't textify block nodes we'll decend into - if (!checkDecendInto(n)) { + // don't textify block nodes we'll descend into + if (!checkDescendInto(n)) { return partCreator.plain(n.textContent); } } } -function checkDecendInto(node) { +function checkDescendInto(node) { switch (node.nodeName) { case "PRE": // a code block is textified in parseCodeBlock // as we don't want to preserve markup in it, - // so no need to decend into it + // so no need to descend into it return false; default: return checkBlockNode(node); @@ -212,11 +212,11 @@ function parseHtmlMessage(html, partCreator, isQuotedMessage) { parts.push(...newParts); - const decend = checkDecendInto(n); - // when not decending (like for PRE), onNodeLeave won't be called to set lastNode + const descend = checkDescendInto(n); + // when not descending (like for PRE), onNodeLeave won't be called to set lastNode // so do that here. - lastNode = decend ? null : n; - return decend; + lastNode = descend ? null : n; + return descend; } function onNodeLeave(n) { diff --git a/src/editor/dom.js b/src/editor/dom.js index e82c3f70ca..3efc64f1c9 100644 --- a/src/editor/dom.js +++ b/src/editor/dom.js @@ -21,8 +21,8 @@ import DocumentOffset from "./offset"; export function walkDOMDepthFirst(rootNode, enterNodeCallback, leaveNodeCallback) { let node = rootNode.firstChild; while (node && node !== rootNode) { - const shouldDecend = enterNodeCallback(node); - if (shouldDecend && node.firstChild) { + const shouldDescend = enterNodeCallback(node); + if (shouldDescend && node.firstChild) { node = node.firstChild; } else if (node.nextSibling) { node = node.nextSibling;