From 810428569a329861fda2d725c569f678645de3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 27 Jan 2016 11:45:20 +0100 Subject: [PATCH] Some jshint related fixes. --- src/core/PaperScript.js | 1 - src/load.js | 21 +++++++++------------ src/path/CompoundPath.js | 3 +-- src/path/PathItem.Boolean.js | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index e687e21d..ab5f2f96 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -14,7 +14,6 @@ * @name PaperScript * @namespace */ -/* jshint -W082 */// Do not complain about functions inside Prepro.js statements Base.exports.PaperScript = (function() { // Locally turn of exports and define for inlined acorn. // Just declaring the local vars is enough, as they will be undefined. diff --git a/src/load.js b/src/load.js index ad880b5e..d5334e4b 100644 --- a/src/load.js +++ b/src/load.js @@ -15,22 +15,19 @@ // change. This is very useful during development of the library itself. if (typeof window === 'object') { // Browser based loading through Prepro.js: - - /* jshint -W082 */ - function load(src) { - document.write(''); - } - if (!window.include) { // Get the last script tag and assume it's the one that loaded this file // then get its src attribute and figure out the location of our root. var scripts = document.getElementsByTagName('script'), - src = scripts[scripts.length - 1].getAttribute('src'); - // Assume that we're loading from a non-root folder, either through - // ../../dist/paper-full.js, or directly through ../../src/load.js, - // and match root as all the parts of the path that lead to that folder, - // exclude the last bit (dist|src), since that's the sub-folder of paper - var root = src.match(/^(.*\/)\w*\//)[1]; + src = scripts[scripts.length - 1].getAttribute('src'), + // Assume that we're loading from a non-root folder, either through + // ../../dist/paper-full.js, or directly through ../../src/load.js, + // and match root as all the path's parts that lead to that folder, + // exclude the last bit (dist|src), as that's a sub-folder of paper. + root = src.match(/^(.*\/)\w*\//)[1], + load = function(src) { + document.write(''); + }; // First load the prepro's browser.js file, which provides the include() // function for the browser. load(root + 'node_modules/prepro/lib/browser.js'); diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 235fc513..41252c25 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -181,8 +181,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ }, setClockwise: function(clockwise) { - /* jshint -W018 */// Don't complain about confusing use of !: - if (this.isClockwise() !== !!clockwise) + if (this.isClockwise() ^ !!clockwise) this.reverse(); }, diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index eb231242..9bfd39fc 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -90,7 +90,7 @@ PathItem.inject(new function() { // Give both paths the same orientation except for subtraction // and exclusion, where we need them at opposite orientation. if (_path2 && (operator.subtract || operator.exclude) - ^ (_path2.isClockwise() !== _path1.isClockwise())) + ^ (_path2.isClockwise() ^ _path1.isClockwise())) _path2.reverse(); // Split curves at crossings on both paths. Note that for self- // intersection, path2 is null and getIntersections() handles it.