in Readability.js [538:566]
_simplifyNestedElements(articleContent) {
var node = articleContent;
while (node) {
if (
node.parentNode &&
["DIV", "SECTION"].includes(node.tagName) &&
!(node.id && node.id.startsWith("readability"))
) {
if (this._isElementWithoutContent(node)) {
node = this._removeAndGetNext(node);
continue;
} else if (
this._hasSingleTagInsideElement(node, "DIV") ||
this._hasSingleTagInsideElement(node, "SECTION")
) {
var child = node.children[0];
for (var i = 0; i < node.attributes.length; i++) {
child.setAttributeNode(node.attributes[i].cloneNode());
}
node.parentNode.replaceChild(child, node);
node = child;
continue;
}
}
node = this._getNextNode(node);
}
},