Fixed passing non-Ranges into Document methods

Fixed regression from b23265ad: ! takes precedence over instanceof.
This commit is contained in:
Minh Nguyễn 2014-02-12 03:48:42 -08:00
commit 3eefd3365a

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;