MCPcopy Create free account
hub / github.com/XIU2/UserScript / getOneElements

Function getOneElements

V2ex-Enhanced.user.js:579–587  ·  view source on GitHub ↗
(selector, contextNode = undefined, doc = document)

Source from the content-addressed store, hash-verified

577 return result;
578 }
579 function getOneElements(selector, contextNode = undefined, doc = document) {
580 if (!selector) return;
581 contextNode = contextNode || doc;
582 if (selector.search(/^css;/i) === 0) {
583 return getElementByCSS(selector.slice(4), contextNode);
584 } else {
585 return getElementByXpath(selector, contextNode, doc);
586 }
587 }
588 function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) {
589 if (!selector) return [];
590 contextNode = contextNode || doc;

Callers 1

Calls 2

getElementByCSSFunction · 0.70
getElementByXpathFunction · 0.70

Tested by

no test coverage detected