-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
this.find("", mode == this.modes.FIND_BACKWARD);
},
- bootstrap: function bootstrap(str, backward) {
- if (arguments.length < 2 && this.rangeFind)
- backward = this.rangeFind.reverse;
+ bootstrap: function bootstrap(str, backward=this.rangeFind && this.rangeFind.reverse) {
let highlighted = this.rangeFind && this.rangeFind.highlighted;
let selections = this.rangeFind && this.rangeFind.selections;
return "";
}
- this.options["findflags"].forEach(function (f) replacer(f, f));
+ this.options["findflags"].forEach(f => replacer(f, f));
let pattern = str.replace(/\\(.|$)/g, replacer);
findRange: function findRange(range) {
let doc = range.startContainer.ownerDocument;
let win = doc.defaultView;
- let ranges = this.ranges.filter(function (r)
+ let ranges = this.ranges.filter(r =>
r.window === win && RangeFind.sameDocument(r.range, range) && RangeFind.contains(r.range, range));
if (this.backward)
},
iter: function iter(word) {
- let saved = ["lastRange", "lastString", "range", "regexp"].map(function (s) [s, this[s]], this);
+ let saved = ["lastRange", "lastString", "range", "regexp"].map(s => [s, this[s]]);
let res;
try {
let regexp = this.regexp && word != util.regexp.escape(word);
}
}
finally {
- saved.forEach(function ([k, v]) this[k] = v, this);
+ saved.forEach(([k, v]) => { this[k] = v; });
}
},
this.range = this.findRange(this.startRange) || this.ranges[0];
util.assert(this.range, "Null range", false);
this.ranges.first = this.range;
- this.ranges.forEach(function (range) range.save());
+ this.ranges.forEach(range => { range.save(); });
this.forward = null;
this.found = false;
},
}
return true;
},
- selectNodePath: ["a", "xhtml:a", "*[@onclick]"].map(function (p) "ancestor-or-self::" + p).join(" | "),
+ selectNodePath: ["a", "xhtml:a", "*[@onclick]"].map(p => "ancestor-or-self::" + p).join(" | "),
union: function union(a, b) {
let start = a.compareBoundaryPoints(a.START_TO_START, b) < 0 ? a : b;
let end = a.compareBoundaryPoints(a.END_TO_END, b) > 0 ? a : b;