From 4fc3d9567478270cfa611d7dfd096e16f304c535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5var=20N=C3=B8vik?= Date: Thu, 25 Aug 2016 14:18:38 +0200 Subject: [PATCH] Set correct zero-space-non-braking space The code that tries to set a zero-space-non-braking space doesn't work as intended. 'workingNode.innerHTML = "&#feff;";' works differently in different browsers: Chrome: parses the string a escapes the ampersand. IE: fails with a 'XML5608' syntax error (see https://msdn.microsoft.com/en-us/library/dn423949(v=vs.85).aspx). Corrected to use the correct 'String.fromCharCode(0xfeff)'. --- src/core/wrappedrange.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/wrappedrange.js b/src/core/wrappedrange.js index 88ea7264..e83612ce 100644 --- a/src/core/wrappedrange.js +++ b/src/core/wrappedrange.js @@ -487,7 +487,7 @@ // Making the working element non-empty element persuades IE to consider the TextRange boundary to be within // the element rather than immediately before or after it - workingNode.innerHTML = "&#feff;"; + workingNode.innerHTML = String.fromCharCode(0xfeff); // insertBefore is supposed to work like appendChild if the second parameter is null. However, a bug report // for IERange suggests that it can crash the browser: http://code.google.com/p/ierange/issues/detail?id=12