Solve the Google Translate problem in v2
Open
Nobody has claimed this yet.
bug
V2
- Dominant language
- TypeScript
- Stars
- 22.1k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
Probably we should use some comments nodes for this
One of developer reported, that this code fixed problems with google translate in v2 (worth checking):
export const fix = () => {
if (typeof Node !== "function" || !Node.prototype) {
return;
}
const originalRemoveChild = Node.prototype.removeChild;
const originalInsertBefore = Node.prototype.insertBefore;
// @ts-expect-error
Node.prototype.removeChild = function (child, ...rest) {
if (child.parentNode !== this) {
return child;
}
return originalRemoveChild.apply(this, [child, ...rest]);
};
// @ts-expect-error
Node.prototype.insertBefore = function (newNode, referenceNode, ...rest) {
if (referenceNode && referenceNode.parentNode !== this) {
return newNode;
}
return originalInsertBefore.apply(this, [
newNode,
referenceNode,
...rest,
]);
};
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by locating the v2 DOM update path and investigate how Google Translate interacts with node removal and insertion; compare that behavior with the proposed comment-node approach and Node.prototype guards. Done means the Google Translate problem is reproduced and resolved without breaking normal DOM updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100