summaryrefslogtreecommitdiff
path: root/src/Readability.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2017-11-12 01:32:03 +0000
committerAndres Rey <[email protected]>2017-11-12 01:32:03 +0000
commitfcf8ba9de0a532433178686bde2f78afc6e063c2 (patch)
tree4c550f7a85efe12d5b02316b3408c2b366777f8e /src/Readability.php
parent00ab1e503a7d804a19365ffe3ee19cd9ca9f8643 (diff)
Add new regexp to check for whitespace include unicode version of &nbsp;
Diffstat (limited to 'src/Readability.php')
-rw-r--r--src/Readability.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Readability.php b/src/Readability.php
index b5bc723..8d856d8 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -528,7 +528,8 @@ class Readability extends Element implements ReadabilityInterface
public function isElementWithoutContent()
{
return ($this->node instanceof \DOMElement &&
- mb_strlen(trim($this->node->textContent)) === 0 &&
+ // /\x{00A0}|\s+/u TODO to be replaced with regexps array
+ mb_strlen(preg_replace('/\x{00A0}|\s+/u','',$this->node->textContent)) === 0 &&
($this->node->childNodes->length === 0 ||
$this->node->childNodes->length === $this->node->getElementsByTagName('br')->length + $this->node->getElementsByTagName('hr')->length ||
/*