【发布时间】:2017-09-20 07:03:40
【问题描述】:
我正在使用cheerio.js,如下所示:
var $ = cheerio.load(html,{withStartIndices : true});
当我使用console.log($('#element1'));。它将返回带有字符位置的节点。
{
type: 'tag',
name: 'h6',
attribs: { align: 'center', id: 'r' },
children: [ [Object] ],
next: null,
startIndex: 310,
.......
有什么方法可以获取cheerio.js 中特定元素的行号?
【问题讨论】:
-
你能告诉我它(withStartIndices)在哪个版本中工作,因为在最新版本中无法获取行号,因为没有允许 withStartIndices 的选项