+
+ if(this.anchorElement.sameNode(this.focusElement)) {
+ anchorFirst = this.anchorOffset <= this.focusOffset;
+ } else {
+ /*jshint bitwise: false*/
+ /* globals Node */
+ anchorFirst = this.anchorElement.dom[0].compareDocumentPosition(this.focusElement.dom[0]) & Node.DOCUMENT_POSITION_FOLLOWING;
+ }
+
+ if(anchorFirst) {
+ this.startElement = this.anchorElement;
+ this.startOffset = this.anchorOffset;
+ this.endElement = this.focusElement;
+ this.endOffset = this.focusOffset;
+
+ } else {
+ this.startElement = this.focusElement;
+ this.startOffset = this.focusOffset;
+ this.endElement = this.anchorElement;
+ this.endOffset = this.anchorOffset;
+ }