Permalink
Browse files

Fix for core selection text demo when selection has zero ranges

  • Loading branch information...
timdown committed Jul 19, 2015
1 parent a7b5eec commit 79357b295a710cd33326c779e04f0934f9ab7576
Showing with 8 additions and 8 deletions.
  1. +8 −8 demos/core.html
View
@@ -10,16 +10,21 @@
return document.getElementById(id);
}
+ function getFirstRange() {
+ var sel = rangy.getSelection();
+ return sel.rangeCount ? sel.getRangeAt(0) : null;
+ }
+
function reportSelectionText() {
- alert(rangy.getSelection().getRangeAt(0));
+ alert( rangy.getSelection().toString() );
}
function reportSelectionHtml() {
- alert(rangy.getSelection().toHtml());
+ alert( rangy.getSelection().toHtml() );
}
function inspectSelection() {
- alert(rangy.getSelection().inspect());
+ alert( rangy.getSelection().inspect() );
}
function deleteSelection() {
@@ -34,11 +39,6 @@
rangy.getSelection().collapseToEnd();
}
- function getFirstRange() {
- var sel = rangy.getSelection();
- return sel.rangeCount ? sel.getRangeAt(0) : null;
- }
-
function showContent(frag) {
var displayEl = gEBI("selectioncontent");
var codeEl = gEBI("code");

0 comments on commit 79357b2

Please sign in to comment.