From ef26e1967fd4011ccd422c04501f58a79477d40e Mon Sep 17 00:00:00 2001 From: halliday Date: Mon, 4 Aug 2025 16:32:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- src/firefox/content/content.js | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ab63911..cc5fff1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /node_modules /src/.amo-upload-uuid /src/web-ext-artifacts -/.chrome-debug \ No newline at end of file +/.chrome-debug +/.vscode \ No newline at end of file diff --git a/src/firefox/content/content.js b/src/firefox/content/content.js index dbf4716..e28a686 100644 --- a/src/firefox/content/content.js +++ b/src/firefox/content/content.js @@ -369,11 +369,14 @@ ortoni.buildXpath = (element, boolAnchor) => { // let childNextSibling = element.nextSibling; let preiousSiblingElement = element.previousElementSibling; - + let childElement = element.children; + for (const child of childElement) { + console.log(child); // 只有 ,没有 #text + } // To iterate all attributes xpath try { xpathAttributes(attributeElement, tagName, element); } catch (e) { } - // Following-sibling push to array + // Following-sibling push to array 根据前一个兄弟节点的对象来定位的 try { xpathFollowingSibling(preiousSiblingElement, tagName); } catch (e) { } // Text Based xpath @@ -837,7 +840,7 @@ function addPreviousSibling(preSib, tagName) { case 'robotid': if (preSib.hasAttribute('robotid')) { tempvalue = item.value - // 这个获取的是前一个兄弟节点的元素 + // 这个获取的是前一个兄弟节点的元素,不能直接推送 // xpathArray.push([2, 'Following sibling based RobotId:', tempvalue]) } break;