(node: HTMLElement)
| 1 | import {TEXT_NODE} from './helpers' |
| 2 | |
| 3 | function getNodeText(node: HTMLElement): string { |
| 4 | if ( |
| 5 | node.matches('input[type=submit], input[type=button], input[type=reset]') |
| 6 | ) { |
| 7 | return (node as HTMLInputElement).value |
| 8 | } |
| 9 | |
| 10 | return Array.from(node.childNodes) |
| 11 | .filter(child => child.nodeType === TEXT_NODE && Boolean(child.textContent)) |
| 12 | .map(c => c.textContent) |
| 13 | .join('') |
| 14 | } |
| 15 | |
| 16 | export {getNodeText} |
no outgoing calls
no test coverage detected