From c4e11804db001201341dd041e563b5131e8b9dac Mon Sep 17 00:00:00 2001 From: Luke Hudson Date: Wed, 16 Dec 2009 01:24:47 +0000 Subject: [PATCH] BUGFIX: Prevent text-selection during drag operation, Firefox-specific git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@95511 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/LeftAndMain.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 687b1f7a..7c2482cc 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -26,6 +26,10 @@ DraggableSeparator.prototype = { document.onmousemove = this.document_mousemove.bindAsEventListener(this); document.onmouseup = this.document_mouseup.bindAsEventListener(this); + // MozUserSelect='none' prevents text-selection during drag, in firefox. + Element.setStyle($('right'), {MozUserSelect: 'none'}); + Element.setStyle($('left'), {MozUserSelect: 'none'}); + // onselectstart captured to prevent text-selection in IE document.body.onselectstart = this.body_selectstart.bindAsEventListener(this); }, document_mousemove : function(event) { @@ -33,6 +37,9 @@ DraggableSeparator.prototype = { fixRightWidth(); }, document_mouseup : function(e) { + // MozUserSelect='' re-enables text-selection in firefox. + Element.setStyle($('right'), {MozUserSelect: ''}); + Element.setStyle($('left'), {MozUserSelect: ''}); document.onmousemove = null; },