summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-11-14 16:45:12 +0000
committerAndres Rey <[email protected]>2016-11-14 16:45:12 +0000
commit1c176922209b8a3002434a670b64a6f3683f812f (patch)
treede472bdf516c8ebae33c9f07e86e7c8128e659d5 /src
parent4ff745766c127ecfa013c8344fd1c1e2f4a2dc5d (diff)
Replacing old node when setting a new node tag
Diffstat (limited to 'src')
-rw-r--r--src/HTMLParser.php5
-rw-r--r--src/Readability.php2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index 0fae247..2e37d22 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -322,7 +322,6 @@ class HTMLParser
$node->replaceChild($pNode);
$node = $pNode;
} elseif (!$this->hasSingleChildBlockElement($node)) {
- // FIXME!!!
$node->setNodeTag('p');
$this->elementsToScore[] = $node;
}
@@ -532,8 +531,8 @@ class HTMLParser
* Turn it into a div so it doesn't get filtered out later by accident.
*/
- // TODO This is not working! Fix!
-// $sibling->setNodeName('div');
+ // TODO This is not working? Fix!
+ $sibling->setNodeTag('div');
}
$import = $articleContent->importNode($sibling->getDOMNode(), true);
diff --git a/src/Readability.php b/src/Readability.php
index 0ad22e4..7fc0d2b 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -287,6 +287,8 @@ class Readability extends Element implements ReadabilityInterface
// The import must be done on the firstChild of $new, since $new is a DOMDocument and not a DOMElement.
$import = $this->node->ownerDocument->importNode($new->firstChild, true);
$this->node->parentNode->replaceChild($import, $this->node);
+
+ $this->node = $import;
}
/**