(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined)
| 586 | } |
| 587 | } |
| 588 | function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) { |
| 589 | if (!selector) return []; |
| 590 | contextNode = contextNode || doc; |
| 591 | if (typeof selector === 'string') { |
| 592 | if (selector.search(/^css;/i) === 0) { |
| 593 | return getAllElementsByCSS(selector.slice(4), contextNode); |
| 594 | } else { |
| 595 | return getAllElementsByXpath(selector, contextNode, doc); |
| 596 | } |
| 597 | } else { |
| 598 | const query = selector(doc, win, _cplink); |
| 599 | if (!Array.isArray(query)) { |
| 600 | throw new Error('getAllElements 返回错误类型'); |
| 601 | } else { |
| 602 | return query; |
| 603 | } |
| 604 | } |
| 605 | } |
| 606 | })(); |
no test coverage detected