有人可以向我解释这段 JavaScript 代码吗?

发布于 2024-09-01 06:25:51 字数 169 浏览 15 评论 0原文

var vTableExp = "//a[contains(@href,'newdid')]/ancestor::td/ancestor::tr/ancestor::tbody";
var vTable = dom.find(vTableExp, XPFirst);

谢谢

var vTableExp = "//a[contains(@href,'newdid')]/ancestor::td/ancestor::tr/ancestor::tbody";
var vTable = dom.find(vTableExp, XPFirst);

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

奶气 2024-09-08 06:25:51

这是一个 XPATH 搜索 DOM,寻找具有后代 < 的包装 元素/code> 其 href 包含“newdid”。

It is an XPATH searching against the DOM, looking for wrapping <TBODY> elements which have a descendant <a> whose href contains "newdid".

脱离于你 2024-09-08 06:25:51

它找到第一个 tbody,它是 aa tr 元素的祖先,而 tr 元素是 td 元素的祖先,而 td 元素是 td 元素的祖先。 >a 元素,其 href 包含字符串 newdid。 (IOW,假设解析的文档是 (X)HTML,请选择第一个表格的正文,该表格的单元格包含一个链接,该链接的地址包含字符串 newdid。)

It finds the first tbody which is an ancestor of a a tr element which is an ancestor of a td element which is an ancestor of an a element whose href contains the string newdid. (IOW, assuming that the parsed document is (X)HTML, select the body of the first table that has a cell containing a link whose address contains the string newdid.)

晚雾 2024-09-08 06:25:51

vTableExp 可能是一个正则表达式模式,然后正在搜索它。

vTableExp is probably a regexp pattern and then it's being searched for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文