From e3ec9d9a4c9afba34a3edb14f73c7a1fa1f4988f Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 24 Jan 2021 19:29:56 -0500 Subject: [PATCH] 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. --- src/static/js/contentcollector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index c7db55fa0..0b85b434b 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -519,7 +519,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author) Note how the
    item has to be inside a
  1. 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?