UNPKG

@qualweb/util

Version:
19 lines (18 loc) 527 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getVisibleText(element) { const children = element.getElementChildren(); let text = ''; if (children.length === 0) { text = element.getElementText(); } else { for (const child of children) { if (window.DomUtils.isElementVisible(child)) { text += ' ' + getVisibleText(child); } } } return text ? text.trim() : ''; } exports.default = getVisibleText;