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.
This commit is contained in:
parent
e3ec9d9a4c
commit
075969aea0
1 changed files with 3 additions and 3 deletions
|
@ -484,7 +484,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
|
||||||
if (!rr && !type) {
|
if (!rr && !type) {
|
||||||
for (let i = 0; i < dom.numChildNodes(node); i++) {
|
for (let i = 0; i < dom.numChildNodes(node); i++) {
|
||||||
const child = dom.childNode(node, i);
|
const child = dom.childNode(node, i);
|
||||||
if (child.name !== 'ul') continue;
|
if (dom.tagName(child) !== 'ul') continue;
|
||||||
type = dom.getAttribute(child, 'class');
|
type = dom.getAttribute(child, 'class');
|
||||||
if (type) break;
|
if (type) break;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
|
||||||
Note how the <ol> item has to be inside a <li>
|
Note how the <ol> item has to be inside a <li>
|
||||||
Because of this we don't increment the start number
|
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)
|
TODO: start number has to increment based on indentLevel(numberX)
|
||||||
This means we have to build an object IE
|
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.
|
// 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++;
|
state.start++;
|
||||||
// TODO, this is hacky.
|
// TODO, this is hacky.
|
||||||
// Because if the first item is an UL it will increment a list no?
|
// Because if the first item is an UL it will increment a list no?
|
||||||
|
|
Loading…
Reference in a new issue