From 7e6d6a6be64d10d974678b4c33d5695049a56887 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 5 Apr 2014 15:05:02 -0700 Subject: [PATCH] [ticket/12083] Fix Select All in CODE bbcode with only one char PHPBB3-12083 --- phpBB/styles/prosilver/template/forum_fn.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index de51b54e9b..56dfcb04c7 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -184,9 +184,10 @@ function selectCode(a) { // Not IE and IE9+ if (window.getSelection) { s = window.getSelection(); - // Safari + // Safari and Chrome if (s.setBaseAndExtent) { - s.setBaseAndExtent(e, 0, e, e.innerText.length - 1); + var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1; + s.setBaseAndExtent(e, 0, e, l); } // Firefox and Opera else {