|
|
@@ -38,6 +38,7 @@ this.docHelper = this.docHelper || (() => {
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
+ initDoc,
|
|
|
preProcessDoc,
|
|
|
postProcessDoc,
|
|
|
serialize,
|
|
|
@@ -50,6 +51,13 @@ this.docHelper = this.docHelper || (() => {
|
|
|
SHADOW_ROOT_ATTRIBUTE_NAME
|
|
|
};
|
|
|
|
|
|
+ function initDoc(doc) {
|
|
|
+ doc.querySelectorAll("meta[http-equiv=refresh]").forEach(element => {
|
|
|
+ element.removeAttribute("http-equiv");
|
|
|
+ element.setAttribute("disabled-http-equiv", "refresh");
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function preProcessDoc(doc, win, options) {
|
|
|
doc.querySelectorAll("script").forEach(element => element.textContent = element.textContent.replace(/<\/script>/gi, "<\\/script>"));
|
|
|
doc.querySelectorAll("noscript").forEach(element => {
|
|
|
@@ -58,6 +66,7 @@ this.docHelper = this.docHelper || (() => {
|
|
|
disabledNoscriptElement.hidden = true;
|
|
|
element.parentElement.replaceChild(disabledNoscriptElement, element);
|
|
|
});
|
|
|
+ initDoc(doc);
|
|
|
if (doc.head) {
|
|
|
doc.head.querySelectorAll("*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)").forEach(element => element.hidden = true);
|
|
|
}
|
|
|
@@ -211,6 +220,10 @@ this.docHelper = this.docHelper || (() => {
|
|
|
Array.from(element.childNodes).forEach(node => noscriptElement.appendChild(node));
|
|
|
element.parentElement.replaceChild(noscriptElement, element);
|
|
|
});
|
|
|
+ doc.querySelectorAll("meta[disabled-http-equiv]").forEach(element => {
|
|
|
+ element.setAttribute("http-equiv", element.getAttribute("disabled-http-equiv"));
|
|
|
+ element.removeAttribute("disabled-http-equiv");
|
|
|
+ });
|
|
|
if (doc.head) {
|
|
|
doc.head.querySelectorAll("*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)").forEach(element => element.removeAttribute("hidden"));
|
|
|
}
|