(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined)
| 391 | return result; |
| 392 | } |
| 393 | function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) { |
| 394 | if (!selector) return []; |
| 395 | contextNode = contextNode || doc; |
| 396 | if (typeof selector === 'string') { |
| 397 | if (selector.search(/^css;/i) === 0) { |
| 398 | return getAllElementsByCSS(selector.slice(4), contextNode); |
| 399 | } else { |
| 400 | return getAllElementsByXpath(selector, contextNode, doc); |
| 401 | } |
| 402 | } else { |
| 403 | const query = selector(doc, win, _cplink); |
| 404 | if (!Array.isArray(query)) { |
| 405 | throw new Error('getAllElements 返回错误类型'); |
| 406 | } else { |
| 407 | return query; |
| 408 | } |
| 409 | } |
| 410 | } |
| 411 | })(); |
no test coverage detected