summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2018-09-02 20:39:52 +0100
committerAndres Rey <[email protected]>2018-09-02 20:39:52 +0100
commit84dcd2b1c8907e2e102ad05f8142e3d3b1ab3ede (patch)
tree3d7265d7727ceeec41646d615050c9a05dc4d54d /src
parent41c0328fd6253e57f0e4cd1607e8c489826fe6a4 (diff)
Add isProbablyVisible function
Diffstat (limited to 'src')
-rw-r--r--src/Nodes/NodeTrait.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Nodes/NodeTrait.php b/src/Nodes/NodeTrait.php
index 4e54566..9f878ce 100644
--- a/src/Nodes/NodeTrait.php
+++ b/src/Nodes/NodeTrait.php
@@ -463,4 +463,16 @@ trait NodeTrait
})
);
}
+
+ 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.
+ *
+ * Might be a good idea to check for classes or other attributes like 'aria-hidden'
+ */
+
+ return !$this->hasAttribute('hidden');
+ }
}