mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-19 11:15:51 +08:00
fix: there may be invalid root doc
This commit is contained in:
parent
68c4df2df3
commit
be993c2cb1
@ -111,9 +111,9 @@ export class JSDomControl extends AsyncService {
|
||||
}
|
||||
const textNodes: HTMLElement[] = [];
|
||||
let rootDoc: Document;
|
||||
if (allNodes.length === 1 && allNodes[0].nodeName === '#document') {
|
||||
if (allNodes.length === 1 && allNodes[0].nodeName === '#document' && (allNodes[0] as any).documentElement) {
|
||||
rootDoc = allNodes[0] as any;
|
||||
if (rootDoc.documentElement && rootDoc.body?.innerText) {
|
||||
if (rootDoc.body?.innerText) {
|
||||
textNodes.push(rootDoc.body);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user