diff options
author | Andres Rey <[email protected]> | 2019-06-17 23:12:02 +0100 |
---|---|---|
committer | Andres Rey <[email protected]> | 2019-06-17 23:12:02 +0100 |
commit | 45a5ab6f11ce59a2ab9b18eb8c734ad18de86605 (patch) | |
tree | 2d15729a0b1b66c5ca87b0492a42fd553fda7ff2 /src/Nodes/NodeTrait.php | |
parent | a1243b7fa248f5abf197c4ff8c406d75dfdbdc6e (diff) |
Minor change
Diffstat (limited to 'src/Nodes/NodeTrait.php')
-rw-r--r-- | src/Nodes/NodeTrait.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Nodes/NodeTrait.php b/src/Nodes/NodeTrait.php index dfff138..26f9c16 100644 --- a/src/Nodes/NodeTrait.php +++ b/src/Nodes/NodeTrait.php @@ -504,18 +504,22 @@ trait NodeTrait ); } + /** + * In the original JS project they check if the node has the style display=none, which unfortunately + * in our case we have no way of knowing that. So we just check for the attribute hidden or "display: none". + * + * Might be a good idea to check for classes or other attributes like 'aria-hidden' + * + * @return bool + */ public function isProbablyVisible() { - /* - * In the original JS project they check if the node has the style display=none, which unfortunately - * in our case we have no way of knowing that. So we just check for the attribute hidden or "display: none". - * - * Might be a good idea to check for classes or other attributes like 'aria-hidden' - */ - return !preg_match('/display:( )?none/', $this->getAttribute('style')) && !$this->hasAttribute('hidden'); } + /** + * @return bool + */ public function isWhitespace() { return ($this->nodeType === XML_TEXT_NODE && mb_strlen(trim($this->textContent)) === 0) || |