flont.js
// and also ensure that the anchor is before the focus
and also ensure that the anchor is before the focus
and also ensure that the anchor is before the focus
function cloneSelection() {
            var selection = window.getSelection();
            var backward = selection.isCollapsed
                || (selection.anchorNode === selection.focusNode && selection.anchorOffset > selection.focusOffset)
                || (selection.anchorNode.compareDocumentPosition(selection.focusNode) & Node.DOCUMENT_POSITION_PRECEDING);
            return {
                'anchorNode': backward ? selection.focusNode : selection.anchorNode,
                'anchorOffset': backward ? selection.focusOffset : selection.anchorOffset,
                'focusNode': backward ? selection.anchorNode : selection.focusNode,
                'focusOffset': backward ? selection.anchorOffset : selection.focusOffset,
                'text': selection.toString(),
                'rectangle': selection.isCollapsed ? null : selection.getRangeAt(0).getBoundingClientRect(),
                'toString': function() { return this.text; }
            };
        }
function cloneSelection ( ) { var selection = window . getSelection ( ) ; var backward = selection . isCollapsed || ( selection . anchorNode === selection . focusNode && selection . anchorOffset > selection . focusOffset ) || ( selection . anchorNode . compareDocumentPosition ( selection . focusNode ) & Node . DOCUMENT_POSITION_PRECEDING ) ; return { 'anchorNode' : backward ? selection . focusNode : selection . anchorNode , 'anchorOffset' : backward ? selection . focusOffset : selection . anchorOffset , 'focusNode' : backward ? selection . anchorNode : selection . focusNode , 'focusOffset' : backward ? selection . anchorOffset : selection . focusOffset , 'text' : selection . toString ( ) , 'rectangle' : selection . isCollapsed ? null : selection . getRangeAt ( 0 ) . getBoundingClientRect ( ) , 'toString' : function ( ) { return this . text ; } } ; }
and also ensure that the anchor is before the focus
and also ensure that the anchor is before the focus