From 452b3b4890b161b3dc030f8f5940df1838ec5ad0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 8 Aug 2015 15:31:40 +0200 Subject: [PATCH] [ticket/14077] Fall back to 1 as focusOffset if length is unsupported The setBaseAndExtent() in Microsoft's Edge browser is incompatible with the one Webkit browsers use. As a result of that, we have to fall back to setting the focusOffset to 1 instead of the text length. PHPBB3-14077 --- phpBB/styles/prosilver/template/forum_fn.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 0d53a53d8e..8e5b257ba4 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -156,7 +156,11 @@ function selectCode(a) { // Safari and Chrome if (s.setBaseAndExtent) { var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1; - s.setBaseAndExtent(e, 0, e, l); + try { + s.setBaseAndExtent(e, 0, e, l); + } catch (error) { + s.setBaseAndExtent(e, 0, e, 1); + } } // Firefox and Opera else {