merge method
Merges other
node into this node.
Implementation
@override
bool merge(DOMNode other, {bool onlyConsecutive = true}) {
if (onlyConsecutive) {
if (isPreviousNode(other)) {
return other.merge(this, onlyConsecutive: false);
} else if (!isNextNode(other)) {
return false;
}
}
if (other is TextNode) {
other.remove();
absorbNode(other);
return true;
} else if (other is DOMElement &&
other.isStringElement &&
(other.isEmptyContent || other.hasOnlyTextNodes)) {
other.remove();
absorbNode(other);
return true;
} else {
return false;
}
}