1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[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
This commit is contained in:
Marc Alexander 2015-08-08 15:31:40 +02:00
parent 4aac578908
commit 452b3b4890

View File

@ -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 {