-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
To select the direct child of the root node, I'm using :scope pseudo class in the selector.
For example,
const html=`
<collection>
<id value="a"/>
<relatedCollections>
<collection>
<id value="a1"/>
</collection>
</relatedCollections>
</collection>
<collection>
<id value="b"/>
<relatedCollections>
<collection>
<id value="b1"/>
</collection>
</relatedCollections>
</collection>
`
let $ = cheerio.load(html,{xmlMode:true},false);
to get the root collection id, I'm using
$(":scope> collection > id").map(function(){ return $(this).attr("value");}).get()
, which should return ["a","b"]
however, it is currently returning empty result []
Is it a bug? Any solution? or any workaround?
Thanks and Best Regards,
Shady
Metadata
Metadata
Assignees
Labels
No labels