mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Fix "decend" typo
Signed-off-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
parent
a160bdf4df
commit
29367766fd
2 changed files with 10 additions and 10 deletions
|
@ -124,19 +124,19 @@ function parseElement(n, partCreator, lastNode, state) {
|
||||||
state.listDepth = (state.listDepth || 0) + 1;
|
state.listDepth = (state.listDepth || 0) + 1;
|
||||||
// es-lint-disable-next-line no-fallthrough
|
// es-lint-disable-next-line no-fallthrough
|
||||||
default:
|
default:
|
||||||
// don't textify block nodes we'll decend into
|
// don't textify block nodes we'll descend into
|
||||||
if (!checkDecendInto(n)) {
|
if (!checkDescendInto(n)) {
|
||||||
return partCreator.plain(n.textContent);
|
return partCreator.plain(n.textContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDecendInto(node) {
|
function checkDescendInto(node) {
|
||||||
switch (node.nodeName) {
|
switch (node.nodeName) {
|
||||||
case "PRE":
|
case "PRE":
|
||||||
// a code block is textified in parseCodeBlock
|
// a code block is textified in parseCodeBlock
|
||||||
// as we don't want to preserve markup in it,
|
// 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;
|
return false;
|
||||||
default:
|
default:
|
||||||
return checkBlockNode(node);
|
return checkBlockNode(node);
|
||||||
|
@ -212,11 +212,11 @@ function parseHtmlMessage(html, partCreator, isQuotedMessage) {
|
||||||
|
|
||||||
parts.push(...newParts);
|
parts.push(...newParts);
|
||||||
|
|
||||||
const decend = checkDecendInto(n);
|
const descend = checkDescendInto(n);
|
||||||
// when not decending (like for PRE), onNodeLeave won't be called to set lastNode
|
// when not descending (like for PRE), onNodeLeave won't be called to set lastNode
|
||||||
// so do that here.
|
// so do that here.
|
||||||
lastNode = decend ? null : n;
|
lastNode = descend ? null : n;
|
||||||
return decend;
|
return descend;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNodeLeave(n) {
|
function onNodeLeave(n) {
|
||||||
|
|
|
@ -21,8 +21,8 @@ import DocumentOffset from "./offset";
|
||||||
export function walkDOMDepthFirst(rootNode, enterNodeCallback, leaveNodeCallback) {
|
export function walkDOMDepthFirst(rootNode, enterNodeCallback, leaveNodeCallback) {
|
||||||
let node = rootNode.firstChild;
|
let node = rootNode.firstChild;
|
||||||
while (node && node !== rootNode) {
|
while (node && node !== rootNode) {
|
||||||
const shouldDecend = enterNodeCallback(node);
|
const shouldDescend = enterNodeCallback(node);
|
||||||
if (shouldDecend && node.firstChild) {
|
if (shouldDescend && node.firstChild) {
|
||||||
node = node.firstChild;
|
node = node.firstChild;
|
||||||
} else if (node.nextSibling) {
|
} else if (node.nextSibling) {
|
||||||
node = node.nextSibling;
|
node = node.nextSibling;
|
||||||
|
|
Loading…
Reference in a new issue