Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tilgovi committed Sep 25, 2015
1 parent ce6d642 commit 9e7d3e3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"es3": true,
"excludeFiles": [
"node_modules/**",
"lib/**",
Expand Down
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"strict": true,
"undef": true,
"unused": true,
"predef": ["-Promise"]
"predef": ["-Promise", "JSON"]
}

6 changes: 3 additions & 3 deletions src/ui/highlighter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var Range = require('xpath-range').Range;
var xpathRange = require('xpath-range');

var util = require('../util');

Expand Down Expand Up @@ -46,9 +46,9 @@ function highlightRange(normedRange, cssClass) {
// for those ranges which are not reanchorable in the current document.
function reanchorRange(range, rootElement) {
try {
return Range.sniff(range).normalize(rootElement);
return xpathRange.Range.sniff(range).normalize(rootElement);
} catch (e) {
if (!(e instanceof Range.RangeError)) {
if (!(e instanceof xpathRange.Range.RangeError)) {
// Oh Javascript, why you so crap? This will lose the traceback.
throw(e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/textselector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var Range = require('xpath-range').Range;
var xpathRange = require('xpath-range');

var util = require('../util');

Expand Down Expand Up @@ -67,7 +67,7 @@ TextSelector.prototype.captureDocumentSelection = function () {

for (i = 0; i < selection.rangeCount; i++) {
var r = selection.getRangeAt(i),
browserRange = new Range.BrowserRange(r),
browserRange = new xpathRange.Range.BrowserRange(r),
normedRange = browserRange.normalize().limit(this.element);

// If the new range falls fully outside our this.element, we should
Expand Down
1 change: 1 addition & 0 deletions test/.jscsrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"es3": true,
"requireCurlyBraces": true,
"requireSpaceAfterKeywords": true,
"requireSpaceBeforeBlockStatements": true,
Expand Down
8 changes: 4 additions & 4 deletions test/spec/ui/highlighter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('assertive-chai').assert;

var Range = require('xpath-range').Range;
var xpathRange = require('xpath-range');

var highlighter = require('../../../src/ui/highlighter'),
util = require('../../../src/util');
Expand Down Expand Up @@ -89,8 +89,8 @@ describe('ui.highlighter.Highlighter', function () {
});

afterEach(function () {
if (typeof Range.sniff.restore === 'function') {
Range.sniff.restore();
if (typeof xpathRange.Range.sniff.restore === 'function') {
xpathRange.Range.sniff.restore();
}
});

Expand Down Expand Up @@ -120,7 +120,7 @@ describe('ui.highlighter.Highlighter', function () {
});

it("should swallow errors if the annotation fails to normalize", function () {
var e = new Range.RangeError("typ", "RangeError should have been caught!");
var e = new xpathRange.Range.RangeError("typ", "RangeError should have been caught!");
sinon.stub(Range, 'sniff').returns({
normalize: sinon.stub().throws(e)
});
Expand Down

0 comments on commit 9e7d3e3

Please sign in to comment.