contentcollector: Fix parent node access

The `parent` property is only available on cheerio's Node-like
objects; DOM Node objects do not have a `parent` property. Switch to
the `parentNode` property so that the code works in browsers as well
as cheerio.
This commit is contained in:
Richard Hansen 2021-01-24 19:29:56 -05:00 committed by John McLear
parent 1d36549152
commit e3ec9d9a4c
1 changed files with 2 additions and 2 deletions

View File

@ -519,7 +519,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
Note how the <ol> item has to be inside a <li>
Because of this we don't increment the start number
*/
if (node.parent && node.parent.name !== 'ol') {
if (node.parentNode && node.parentNode.name !== 'ol') {
/*
TODO: start number has to increment based on indentLevel(numberX)
This means we have to build an object IE
@ -536,7 +536,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
}
}
// UL list items never modify the start value.
if (node.parent && node.parent.name === 'ul') {
if (node.parentNode && node.parentNode.name === 'ul') {
state.start++;
// TODO, this is hacky.
// Because if the first item is an UL it will increment a list no?