(e)
| 517 | |
| 518 | // Any element without positive size dimensions is not shown. |
| 519 | function positiveSize(e) { |
| 520 | var rect = bot.dom.getClientRect(e); |
| 521 | if (rect.height > 0 && rect.width > 0) { |
| 522 | return true; |
| 523 | } |
| 524 | // A vertical or horizontal SVG Path element will report zero width or |
| 525 | // height but is "shown" if it has a positive stroke-width. |
| 526 | if (bot.dom.isElement(e, 'PATH') && (rect.height > 0 || rect.width > 0)) { |
| 527 | var strokeWidth = bot.dom.getEffectiveStyle(e, 'stroke-width'); |
| 528 | return !!strokeWidth && (parseInt(strokeWidth, 10) > 0); |
| 529 | } |
| 530 | |
| 531 | // Any element with hidden/collapsed visibility is not shown. |
| 532 | var visibility = bot.dom.getEffectiveStyle(e, 'visibility'); |
| 533 | if (visibility == 'collapse' || visibility == 'hidden') { |
| 534 | return false; |
| 535 | } |
| 536 | |
| 537 | if (!displayedFn(e)) { |
| 538 | return false; |
| 539 | } |
| 540 | // Zero-sized elements should still be considered to have positive size |
| 541 | // if they have a child element or text node with positive size, unless |
| 542 | // the element has an 'overflow' style of 'hidden'. |
| 543 | // Note: Text nodes containing only structural whitespace (with newlines |
| 544 | // or tabs) are ignored as they are likely just HTML formatting, not |
| 545 | // visible content. |
| 546 | return bot.dom.getEffectiveStyle(e, 'overflow') != 'hidden' && |
| 547 | goog.array.some(e.childNodes, function (n) { |
| 548 | if (n.nodeType == goog.dom.NodeType.TEXT) { |
| 549 | var text = n.nodeValue; |
| 550 | // Ignore text nodes that are purely structural whitespace |
| 551 | // (contain newlines or tabs and nothing else besides spaces) |
| 552 | if (/^[\s]*$/.test(text) && /[\n\r\t]/.test(text)) { |
| 553 | return false; |
| 554 | } |
| 555 | return true; |
| 556 | } |
| 557 | return bot.dom.isElement(n) && positiveSize(n); |
| 558 | }); |
| 559 | } |
| 560 | if (!positiveSize(elem)) { |
| 561 | return false; |
| 562 | } |
no test coverage detected