Improved outer tag removal.
This commit is contained in:
@@ -416,8 +416,8 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
|
|||||||
// Serialize the DOM back to HTML
|
// Serialize the DOM back to HTML
|
||||||
const serializer = new XMLSerializer();
|
const serializer = new XMLSerializer();
|
||||||
let translatedHTML = serializer.serializeToString(dom);
|
let translatedHTML = serializer.serializeToString(dom);
|
||||||
// Remove the outer <body> tags
|
// Remove the outer <html|body|head> tags
|
||||||
translatedHTML = translatedHTML.replace(/^<body[^>]*>|<\/body>$/g, '');
|
translatedHTML = translatedHTML.replace(/<\/?(html|body|head)[^>]*>/g, '');
|
||||||
|
|
||||||
if(charArg !== ''){
|
if(charArg !== ''){
|
||||||
let scripts:customscript[] = []
|
let scripts:customscript[] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user