开发者

Can someone explain this javascript code to me?

开发者 https://www.devze.com 2022-12-29 13:00 出处:网络
var vTableExp = \"//a[contains(@href,开发者_如何学编程\'newdid\')]/ancestor::td/ancestor::tr/ancestor::tbody\";
var vTableExp = "//a[contains(@href,开发者_如何学编程'newdid')]/ancestor::td/ancestor::tr/ancestor::tbody";
var vTable = dom.find(vTableExp, XPFirst);

thanks


It is an XPATH searching against the DOM, looking for wrapping <TBODY> elements which have a descendant <a> whose href contains "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.)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号