(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined)
| 376 | return result; |
| 377 | } |
| 378 | function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) { |
| 379 | if (!selector) return []; |
| 380 | contextNode = contextNode || doc; |
| 381 | if (typeof selector === 'string') { |
| 382 | if (selector.search(/^css;/i) === 0) { |
| 383 | return getAllElementsByCSS(selector.slice(4), contextNode); |
| 384 | } else { |
| 385 | return getAllElementsByXpath(selector, contextNode, doc); |
| 386 | } |
| 387 | } else { |
| 388 | const query = selector(doc, win, _cplink); |
| 389 | if (!Array.isArray(query)) { |
| 390 | throw new Error('getAllElements 返回错误类型'); |
| 391 | } else { |
| 392 | return query; |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | })(); |
no test coverage detected