From d6ca859088f48563d48792158c9312eb5aa36f62 Mon Sep 17 00:00:00 2001 From: "FiveFilters.org" Date: Thu, 19 Aug 2021 13:49:24 +0200 Subject: Remove aria-hidden="true" nodes https://github.com/mozilla/readability/commit/60f470c4bb618a7987d5701b1228ec5ff49f2773 (but changes based on current version of Readability.js) --- src/Nodes/NodeTrait.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Nodes/NodeTrait.php') 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)); } /** -- cgit v1.2.3