Skip to content

Commit 105ed49

Browse files
committed
Update pagetual.user.js
1 parent 00d1efc commit 105ed49

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Pagetual/pagetual.user.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4572,6 +4572,7 @@
45724572
parseHTMLToFragment(String(html), fragment, targetDoc);
45734573
return fragment;
45744574
}
4575+
let canDirectSetHTML = true;
45754576
const SVG_NS = 'http://www.w3.org/2000/svg';
45764577
const VOID_TAGS = {
45774578
area: true,
@@ -4663,6 +4664,15 @@
46634664
}
46644665
function setHTML(target, html, doc) {
46654666
if (!target) return;
4667+
if (canDirectSetHTML !== false) {
4668+
try {
4669+
target.innerHTML = html === null || html === undefined ? '' : String(html);
4670+
canDirectSetHTML = true;
4671+
return;
4672+
} catch (e) {
4673+
canDirectSetHTML = false;
4674+
}
4675+
}
46664676
const targetDoc = doc || target.ownerDocument || document;
46674677
const fragment = createHTML(html, targetDoc);
46684678
while (target.firstChild) {

0 commit comments

Comments
 (0)