Skip to content

Commit

Permalink
simplify Helpers.dom.getSelectedText()
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Sep 10, 2015
1 parent 31f4b7a commit 352c53c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tests/helpers/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,7 @@ function getSelectedText() {
// FIXME?
throw new Error('Unable to get selected text for multiple ranges');
} else {
const {
anchorNode, anchorOffset,
focusNode, focusOffset
} = selection;

if (anchorNode !== focusNode) {
// FIXME
throw new Error('Unable to get selected text when multiple nodes are selected');
} else {
return anchorNode.textContent.slice(anchorOffset, focusOffset);
}
return selection.toString();
}
}

Expand Down

0 comments on commit 352c53c

Please sign in to comment.