* Determines whether an element or its parents have `display: none` or similar CSS properties set * @param {!Node} e the element * @return {!boolean}
(e)
| 598 | * @return {!boolean} |
| 599 | */ |
| 600 | function displayed(e) { |
| 601 | if (bot.dom.isElement(e)) { |
| 602 | var elem = /** @type {!Element} */ (e); |
| 603 | if ((bot.dom.getEffectiveStyle(elem, 'display') == 'none') |
| 604 | || (bot.dom.getEffectiveStyle(elem, 'content-visibility') == 'hidden')) { |
| 605 | return false; |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | var parent = bot.dom.getParentNodeInComposedDom(e); |
| 610 | |
| 611 | if (bot.dom.IS_SHADOW_DOM_ENABLED && (parent instanceof ShadowRoot)) { |
| 612 | if (parent.host.shadowRoot && parent.host.shadowRoot !== parent) { |
| 613 | // There is a younger shadow root, which will take precedence over |
| 614 | // the shadow this element is in, thus this element won't be |
| 615 | // displayed. |
| 616 | return false; |
| 617 | } else { |
| 618 | parent = parent.host; |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | if (parent && (parent.nodeType == goog.dom.NodeType.DOCUMENT || |
| 623 | parent.nodeType == goog.dom.NodeType.DOCUMENT_FRAGMENT)) { |
| 624 | return true; |
| 625 | } |
| 626 | |
| 627 | // Child of DETAILS element is not shown unless the DETAILS element is open |
| 628 | // or the child is a SUMMARY element. |
| 629 | if (parent && bot.dom.isElement(parent, goog.dom.TagName.DETAILS) && |
| 630 | !parent.open && !bot.dom.isElement(e, goog.dom.TagName.SUMMARY)) { |
| 631 | return false; |
| 632 | } |
| 633 | |
| 634 | return !!parent && displayed(parent); |
| 635 | } |
| 636 | |
| 637 | return bot.dom.isShown_(elem, !!opt_ignoreOpacity, displayed); |
| 638 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected