(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined)
| 457 | return result; |
| 458 | } |
| 459 | function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) { |
| 460 | if (!selector) return []; |
| 461 | contextNode = contextNode || doc; |
| 462 | if (typeof selector === 'string') { |
| 463 | if (selector.search(/^css;/i) === 0) { |
| 464 | return getAllElementsByCSS(selector.slice(4), contextNode); |
| 465 | } else { |
| 466 | return getAllElementsByXpath(selector, contextNode, doc); |
| 467 | } |
| 468 | } else { |
| 469 | const query = selector(doc, win, _cplink); |
| 470 | if (!Array.isArray(query)) { |
| 471 | throw new Error('getAllElements 返回错误类型'); |
| 472 | } else { |
| 473 | return query; |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | |
| 479 | // 获取GET参数 |
no test coverage detected