remove conditional console

This commit is contained in:
David Taylor
2025-02-11 20:07:04 +00:00
parent a9b4362ca8
commit decdd13b97

View File

@@ -53,14 +53,13 @@ function defendAgainstGoogleTranslate() {
const originalRemoveChild = Node.prototype.removeChild;
Node.prototype.removeChild = function (child) {
if (child.parentNode !== this) {
if (console) {
// eslint-disable-next-line no-console
console.error(
"[Google Translate Defender] Caught error: cannot remove a child from a different parent",
child,
this
);
}
// eslint-disable-next-line no-console
console.error(
"[Google Translate Defender] Caught error: cannot remove a child from a different parent",
child,
this
);
return child;
}
return originalRemoveChild.apply(this, arguments);
@@ -69,15 +68,14 @@ function defendAgainstGoogleTranslate() {
const originalInsertBefore = Node.prototype.insertBefore;
Node.prototype.insertBefore = function (newNode, referenceNode) {
if (referenceNode && referenceNode.parentNode !== this) {
if (console) {
// eslint-disable-next-line no-console
console.error(
"[Google Translate Defender] Caught error: Cannot insert before a reference node from a different parent",
"",
referenceNode,
this
);
}
// eslint-disable-next-line no-console
console.error(
"[Google Translate Defender] Caught error: Cannot insert before a reference node from a different parent",
"",
referenceNode,
this
);
return newNode;
}
return originalInsertBefore.apply(this, arguments);