Created
August 11, 2022 16:21
-
-
Save sicknarlo/11b15851a105c0b003ff107dc25be23a to your computer and use it in GitHub Desktop.
Preact Google Translate Patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const insertBefore = Element.prototype.insertBefore; | |
Element.prototype.insertBefore = function <T extends Node>( | |
newNode: T, | |
referenceNode: Node | null, | |
): T { | |
if ( | |
newNode instanceof Text && | |
referenceNode instanceof HTMLElement && | |
referenceNode?.localName === 'font' | |
) { | |
return newNode; | |
} | |
return insertBefore.apply<Element, [T, Node | null], T>(this, [ | |
newNode, | |
referenceNode, | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment