From 3eefd3365ac477a3ece51008eefe5d9561143e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Wed, 12 Feb 2014 03:48:42 -0800 Subject: [PATCH] Fixed passing non-Ranges into Document methods Fixed regression from b23265ad: ! takes precedence over instanceof. --- lib/ace/document.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ace/document.js b/lib/ace/document.js index ce9a6e31..24d82cc3 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -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;