Skip to content

Commit

Permalink
move displayed to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored and shs96c committed Apr 30, 2018
1 parent 011338d commit 665ee8d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions javascript/atoms/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,12 @@ bot.dom.isShown_ = function(elem, ignoreOpacity, parentsDisplayedFn) {
* @return {boolean} Whether or not the element is visible.
*/
bot.dom.isShown = function(elem, opt_ignoreOpacity) {
var displayed;

// Any element with a display style equal to 'none' or that has an ancestor
// with display style equal to 'none' is not shown.
displayed = function(e) {
/**
* Determines whether an element or its parents have `display: none` set
* @param {?Node}
* @return {boolean}
*/
function displayed(e) {
if (bot.dom.isElement(e) && bot.dom.getEffectiveStyle(e, 'display') == 'none') {
return false;
}
Expand All @@ -593,7 +594,7 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) {
}

return parent && displayed(parent);
};
}

return bot.dom.isShown_(elem, !!opt_ignoreOpacity, displayed);
};
Expand Down

0 comments on commit 665ee8d

Please sign in to comment.