Merge pull request #1813 from 1ec5/patch-1

Fixed passing non-Ranges into Document methods
This commit is contained in:
Harutyun Amirjanyan 2014-02-12 20:21:32 +04:00
commit 7981e0ca6c

View file

@ -402,7 +402,7 @@ var Document = function(text) {
*
**/
this.remove = function(range) {
if (!range instanceof Range)
if (!(range instanceof Range))
range = Range.fromPoints(range.start, range.end);
// clip to document
range.start = this.$clipPosition(range.start);
@ -522,7 +522,7 @@ var Document = function(text) {
*
**/
this.replace = function(range, text) {
if (!range instanceof Range)
if (!(range instanceof Range))
range = Range.fromPoints(range.start, range.end);
if (text.length == 0 && range.isEmpty())
return range.start;