summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-11-18 19:00:54 +0000
committerAndres Rey <[email protected]>2016-11-18 19:00:54 +0000
commit060654dab569e9f3bef56bfedacdbf748678c4d0 (patch)
tree45324daff6449457c5d9c22e51ccca76013c8426 /src
parentbfe8bc4d21845a6cb7c96045a3ee57985784a706 (diff)
Checking for text before replacing it with P nodes
Diffstat (limited to 'src')
-rw-r--r--src/HTMLParser.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index 0d255e4..f1ac646 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -327,9 +327,11 @@ class HTMLParser
} else {
// EXPERIMENTAL
foreach ($node->getChildren() as $child) {
- /** @var Readability $child */
- $newNode = $node->createNode($child, 'p');
- $child->replaceChild($newNode);
+ if ($child->isText()) {
+ /** @var Readability $child */
+ $newNode = $node->createNode($child, 'p');
+ $child->replaceChild($newNode);
+ }
}
}
}