Avoid adding id that might already exists

We append a new node when it isn't a `div` or `p` (like when it's an `article`) with the same id which generate a DOM error "DOMElement::setAttribute(): ID blabla already defined".
This commit is contained in:
Jeremy Benoist
2016-02-29 10:21:52 +01:00
parent 41d7440c6e
commit dc590542f0
2 changed files with 61 additions and 4 deletions
-4
View File
@@ -951,10 +951,6 @@ class Readability
$nodeToAppend = $this->dom->createElement('div');
try {
if ($siblingNode->getAttribute('id')) {
$nodeToAppend->setAttribute('id', $siblingNode->getAttribute('id'));
}
$nodeToAppend->setAttribute('alt', $siblingNodeName);
$nodeToAppend->innerHTML = $siblingNode->innerHTML;
} catch (Exception $e) {