mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Squire cleanTree() use while instead of for
This commit is contained in:
parent
280660314f
commit
a5d749ec05
1 changed files with 3 additions and 8 deletions
11
vendors/squire/build/squire-raw.js
vendored
11
vendors/squire/build/squire-raw.js
vendored
|
|
@ -673,7 +673,7 @@ const
|
||||||
*/
|
*/
|
||||||
cleanTree = (node, preserveWS) => {
|
cleanTree = (node, preserveWS) => {
|
||||||
let children = node.childNodes,
|
let children = node.childNodes,
|
||||||
nonInlineParent, i, l, child, nodeName, childLength;
|
nonInlineParent, i = children.length, child, nodeName, childLength;
|
||||||
// startsWithWS, endsWithWS, data, sibling;
|
// startsWithWS, endsWithWS, data, sibling;
|
||||||
|
|
||||||
nonInlineParent = node;
|
nonInlineParent = node;
|
||||||
|
|
@ -682,7 +682,7 @@ const
|
||||||
}
|
}
|
||||||
// let walker = createTreeWalker(nonInlineParent, SHOW_ELEMENT_OR_TEXT);
|
// let walker = createTreeWalker(nonInlineParent, SHOW_ELEMENT_OR_TEXT);
|
||||||
|
|
||||||
for (i = 0, l = children.length; i < l; ++i) {
|
while (i--) {
|
||||||
child = children[i];
|
child = children[i];
|
||||||
nodeName = child.nodeName;
|
nodeName = child.nodeName;
|
||||||
if (isElement(child)) {
|
if (isElement(child)) {
|
||||||
|
|
@ -691,12 +691,9 @@ const
|
||||||
child = stylesRewriters[nodeName](child);
|
child = stylesRewriters[nodeName](child);
|
||||||
} else if (blacklist.has(nodeName)) {
|
} else if (blacklist.has(nodeName)) {
|
||||||
child.remove();
|
child.remove();
|
||||||
--i;
|
|
||||||
--l;
|
|
||||||
continue;
|
continue;
|
||||||
} else if (!allowedBlock.test(nodeName) && !isInline(child)) {
|
} else if (!allowedBlock.test(nodeName) && !isInline(child)) {
|
||||||
--i;
|
i += childLength;
|
||||||
l += childLength - 1;
|
|
||||||
child.replaceWith(empty(child));
|
child.replaceWith(empty(child));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -747,8 +744,6 @@ const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
child.remove();
|
child.remove();
|
||||||
--i;
|
|
||||||
--l;
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue