Fixed passing non-Ranges into Document methods
Fixed regression from b23265ad: ! takes precedence over instanceof.
This commit is contained in:
parent
ffc9cec9ef
commit
3eefd3365a
1 changed files with 2 additions and 2 deletions
|
|
@ -402,7 +402,7 @@ var Document = function(text) {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.remove = function(range) {
|
this.remove = function(range) {
|
||||||
if (!range instanceof Range)
|
if (!(range instanceof Range))
|
||||||
range = Range.fromPoints(range.start, range.end);
|
range = Range.fromPoints(range.start, range.end);
|
||||||
// clip to document
|
// clip to document
|
||||||
range.start = this.$clipPosition(range.start);
|
range.start = this.$clipPosition(range.start);
|
||||||
|
|
@ -522,7 +522,7 @@ var Document = function(text) {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.replace = function(range, text) {
|
this.replace = function(range, text) {
|
||||||
if (!range instanceof Range)
|
if (!(range instanceof Range))
|
||||||
range = Range.fromPoints(range.start, range.end);
|
range = Range.fromPoints(range.start, range.end);
|
||||||
if (text.length == 0 && range.isEmpty())
|
if (text.length == 0 && range.isEmpty())
|
||||||
return range.start;
|
return range.start;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue