diff options
Diffstat (limited to 'src/Nodes/NodeTrait.php')
-rw-r--r-- | src/Nodes/NodeTrait.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Nodes/NodeTrait.php b/src/Nodes/NodeTrait.php index 690c91a..cdd28bf 100644 --- a/src/Nodes/NodeTrait.php +++ b/src/Nodes/NodeTrait.php @@ -508,13 +508,14 @@ 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() { - return !preg_match('/display:( )?none/', $this->getAttribute('style')) && !$this->hasAttribute('hidden'); + return !preg_match('/display:( )?none/i', $this->getAttribute('style')) && + !$this->hasAttribute('hidden') && + //check for "fallback-image" so that wikimedia math images are displayed + (!$this->hasAttribute('aria-hidden') || $this->getAttribute('aria-hidden') !== 'true' || ($this->hasAttribute('class') && mb_strpos($this->getAttribute('class'), 'fallback-image') !== false)); } /** |