From 7a88a4b0e9770b5575fb4910577405cda755e32a Mon Sep 17 00:00:00 2001 From: TDaglis Date: Tue, 3 Nov 2015 09:32:43 +0000 Subject: [PATCH 1/2] fixed selection in firefox --- src/xterm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xterm.js b/src/xterm.js index 94257e24..e0264d64 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -585,7 +585,7 @@ on(this.element, 'mouseup', function() { var selection = document.getSelection(); - if (selection.type != 'Range') { + if (selection.isCollapsed) { self.focus(); } }); From f53f5735e18cbd93e2b0588b38e741ac444f4b46 Mon Sep 17 00:00:00 2001 From: TDaglis Date: Tue, 3 Nov 2015 12:00:28 +0200 Subject: [PATCH 2/2] added selection.type fallback check for browsers that might not support Selection.isCollapsed property --- src/xterm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xterm.js b/src/xterm.js index e0264d64..42c8b81c 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -584,8 +584,10 @@ this.startBlink(); on(this.element, 'mouseup', function() { - var selection = document.getSelection(); - if (selection.isCollapsed) { + var selection = document.getSelection(), + collapsed = selection.isCollapsed, + isRange = typeof collapsed == 'boolean' ? !collapsed : selection.type == 'Range'; + if (!isRange) { self.focus(); } });