You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
We probably ought to have an extra function to check if a given node is an HTMLElement, and then use that to make an extra assertion before relying on children - something like:
function isHTMLElement(node) {
return node instanceof HTMLElement;
}
function isEmptyInlineElement(node) {
if (isHTMLElement(node)) {
if (node.children.length > 1) {
return false;
}
if (node.children.length === 1 && node.textContent.trim() !== '') {
return false;
}
if (node.children.length === 0) {
return node.textContent.trim() === '';
}
return isEmptyInlineElement(node.children[0]);
}
return false;
}
In this function, did you really mean
node
orelement
?Because
Node
objects do not have thechildren
property - onlyElement
objects have that.The text was updated successfully, but these errors were encountered: