From 075969aea08e5cf767db489f8feeadbc0ef0ae50 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 21 Jan 2021 02:46:22 -0500 Subject: [PATCH] contentcollector: Fix Element tag name fetch The `name` property is only available on cheerio's Element-like objects; DOM Element objects do not have a `name` property. Switch to `dom.tagName()` to fix the logic for browsers. --- src/static/js/contentcollector.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index 0b85b434..89dfd8ff 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -484,7 +484,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author) if (!rr && !type) { for (let i = 0; i < dom.numChildNodes(node); i++) { const child = dom.childNode(node, i); - if (child.name !== 'ul') continue; + if (dom.tagName(child) !== 'ul') continue; type = dom.getAttribute(child, 'class'); if (type) break; } @@ -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.parentNode && node.parentNode.name !== 'ol') { + if (node.parentNode && dom.tagName(node.parentNode) !== '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.parentNode && node.parentNode.name === 'ul') { + if (node.parentNode && dom.tagName(node.parentNode) === 'ul') { state.start++; // TODO, this is hacky. // Because if the first item is an UL it will increment a list no?