mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-18 19:25:53 +08:00
fix: potential invalid html
This commit is contained in:
parent
be993c2cb1
commit
ccb4b8a49d
@ -46,7 +46,10 @@ export class JSDomControl extends AsyncService {
|
||||
if (options?.withShadowDom && snapshot.shadowExpanded) {
|
||||
sourceHTML = snapshot.shadowExpanded;
|
||||
}
|
||||
const jsdom = this.linkedom.parseHTML(sourceHTML);
|
||||
let jsdom = this.linkedom.parseHTML(sourceHTML);
|
||||
if (!jsdom.window.document.documentElement) {
|
||||
jsdom = this.linkedom.parseHTML(`<html><body>${sourceHTML}</body></html>`);
|
||||
}
|
||||
const allNodes: Node[] = [];
|
||||
jsdom.window.document.querySelectorAll('svg').forEach((x) => x.innerHTML = '');
|
||||
if (options?.withIframe) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user