Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
acusti committed Oct 13, 2016
1 parent f6ee84e commit ee466e5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/renderers/dom/client/ReactInputSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ function getElementsWithSelections(acc, win) {
var element = null;
if (win.getSelection) {
var selection = win.getSelection();
if (selection.anchorNode === selection.focusNode) {
element = selection.anchorNode;
var startNode = selection.anchorNode;
var endNode = selection.focusNode;
var startOffset = selection.anchorOffset;
var endOffset = selection.focusOffset;
if (startNode.childNodes.length) {
if (startNode.childNodes[startOffset] === endNode.childNodes[endOffset]) {
element = startNode.childNodes[startOffset];
}
} else {
element = startNode;
}
} else if (doc.selection) {
var range = doc.selection.createRange();
Expand Down

0 comments on commit ee466e5

Please sign in to comment.