From 21b8f3b83f58677445d52cccb169b698e3b98073 Mon Sep 17 00:00:00 2001 From: Hector Espeso Date: Wed, 28 Oct 2026 22:06:04 +0100 Subject: [PATCH] Count Microsoft Translator (Edge) as page translation in the lost-node assert. Edge's translator doesn't add Google's `translated-*` class to ; it marks the elements it translated with `_msthash`. Seen on Edge for Android, where it rewrites text nodes that coconut later tries to delete. Co-Authored-By: Claude Opus 5.5 --- src/coconut/vdom/Renderer.hx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coconut/vdom/Renderer.hx b/src/coconut/vdom/Renderer.hx index 8851d19..d0e5e18 100644 --- a/src/coconut/vdom/Renderer.hx +++ b/src/coconut/vdom/Renderer.hx @@ -85,7 +85,11 @@ private class DomCursor extends Cursor { function lostNode(index:Int, count:Int, node:Null):String return 'assert: node ${index + 1}/$count to delete under ${describe(parent)} (in ${ancestors(parent)}) ' + (if (node == null) 'is missing' else 'is ${describe(node)}, now under ${describe(node.parentNode)}') - + (if (document.documentElement.className.indexOf('translated-') > -1) ', page translated' else ''); + + (if (isTranslated()) ', page translated' else ''); + + static function isTranslated():Bool + return document.documentElement.className.indexOf('translated-') > -1 // Google Translate + || document.querySelector('[_msthash]') != null; // Microsoft Translator (Edge) marks the elements it translated static function describe(n:Null):String { if (n == null) return 'nothing';