diff options
author | FiveFilters.org <[email protected]> | 2021-08-19 13:49:24 +0200 |
---|---|---|
committer | FiveFilters.org <[email protected]> | 2021-08-19 13:49:24 +0200 |
commit | d6ca859088f48563d48792158c9312eb5aa36f62 (patch) | |
tree | cfe93a9265d8a23bda2653f309d3ede664b1a74a /src/Nodes/NodeTrait.php | |
parent | a34a91b5466fef43b041ccb984e8a4beee951b2e (diff) |
Remove aria-hidden="true" nodes
https://github.com/mozilla/readability/commit/60f470c4bb618a7987d5701b1228ec5ff49f2773 (but changes based on current version of Readability.js)
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)); } /** |