From 29367766fd107b1209a1d3965a33df7dbcc081f4 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 13 Oct 2019 14:10:11 +0300 Subject: [PATCH] Fix "decend" typo Signed-off-by: Tulir Asokan --- src/editor/deserialize.js | 16 ++++++++-------- src/editor/dom.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) 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;