MCPcopy Index your code
hub / github.com/XIU2/UserScript / getAllParentElement

Function getAllParentElement

Autopage.user.js:2395–2405  ·  view source on GitHub ↗
(selector, contextNode = undefined, doc = document)

Source from the content-addressed store, hash-verified

2393 }
2394 // 获取所有父元素
2395 function getAllParentElement(selector, contextNode = undefined, doc = document) {
2396 contextNode = contextNode || doc;
2397 const parents = [];
2398 getAll(selector, contextNode, doc).forEach((next) => {
2399 const parent = next.parentElement;
2400 if (!parents.includes(parent)) {
2401 parents.push(parent);
2402 }
2403 });
2404 return parents
2405 }
2406 function createDocumentByString(e) {
2407 if (e) {
2408 if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml');

Callers 1

replaceElemsFunction · 0.85

Calls 1

getAllFunction · 0.85

Tested by

no test coverage detected