Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created July 4, 2013 18:47
Show Gist options
  • Select an option

  • Save AutomatedTester/5929589 to your computer and use it in GitHub Desktop.

Select an option

Save AutomatedTester/5929589 to your computer and use it in GitHub Desktop.
diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js
index 4796dfe..523927c 100644
--- a/javascript/atoms/dom.js
+++ b/javascript/atoms/dom.js
@@ -618,6 +618,13 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) {
if (!bot.dom.isElement(elem)) {
throw new Error('Argument to isShown must be of type Element');
}
+ // Check the element is the top element
+ var doc = goog.dom.getOwnerDocument(elem);
+ var locationOfElement = goog.style.getClientPosition(elem);
+ var elemAtPoint = doc.elementFromPoint(locationOfElement.x, locationOfElement.y);
+ if (elemAtPoint !== null && (elemAtPoint != elem)){
+ return false;
+ }
// Option or optgroup is shown iff enclosing select is shown (ignoring the
// select's opacity).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment