diff --git a/src/item/Item.js b/src/item/Item.js index 2324e4a7..2f376b81 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -843,7 +843,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ var children = this._children; // TODO: What to return if nothing is defined, e.g. empty Groups? // Scriptographer behaves weirdly then too. - if (!children || children.length == 0) + if (!children || children.length === 0) return new Rectangle(); // Call _updateBoundsCache() even when the group is currently empty // (or only holds empty / invisible items), so future changes in these @@ -880,8 +880,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ // Scale to new Size, if size changes and avoid divisions by 0: if (rect.width != bounds.width || rect.height != bounds.height) { matrix.scale( - bounds.width != 0 ? rect.width / bounds.width : 1, - bounds.height != 0 ? rect.height / bounds.height : 1); + bounds.width !== 0 ? rect.width / bounds.width : 1, + bounds.height !== 0 ? rect.height / bounds.height : 1); } // Translate to bounds center: center = bounds.getCenter(); diff --git a/src/path/Curve.js b/src/path/Curve.js index c5be505c..83d3e5e2 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -1173,7 +1173,7 @@ new function() { // // Scope to inject various curve evaluation methods statics: { evaluateMethods: methods } - }) + }); }, new function() { // Scope for methods that require private functions @@ -1308,7 +1308,7 @@ new function() { // Scope for methods that require private functions getParameterAt: function(v, offset, start) { if (start === undefined) - start = offset < 0 ? 1 : 0 + start = offset < 0 ? 1 : 0; if (offset === 0) return start; // See if we're going forward or backward, and handle cases @@ -1557,7 +1557,7 @@ new function() { // Scope for intersection using bezier fat-line clipping // p2 is inside, the hull is a triangle. distRatio >= 2 ? [p0, p1, p3] // p1 is inside, the hull is a triangle. - : distRatio <= .5 ? [p0, p2, p3] + : distRatio <= 0.5 ? [p0, p2, p3] // Hull is a quadrilateral, we need all lines in correct order. : [p0, p1, p2, p3], // Line [p0, p3] is part of the hull. diff --git a/src/path/Path.js b/src/path/Path.js index 72efb248..54008d88 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1206,7 +1206,7 @@ var Path = PathItem.extend(/** @lends Path# */{ if (typeof arg === 'number') arg = this.getLocationAt(arg); if (!arg) - return null + return null; // split(location) index = arg.index; parameter = arg.parameter; diff --git a/src/path/PathIterator.js b/src/path/PathIterator.js index e610cf53..4b229c9b 100644 --- a/src/path/PathIterator.js +++ b/src/path/PathIterator.js @@ -101,7 +101,7 @@ var PathIterator = Base.extend({ var i, j = this.index; for (;;) { i = j; - if (j == 0 || this.parts[--j].offset < offset) + if (j === 0 || this.parts[--j].offset < offset) break; } // Find the part that succeeds the given offset, then interpolate diff --git a/src/tool/Tool.js b/src/tool/Tool.js index 2a4ccc05..0c28442c 100644 --- a/src/tool/Tool.js +++ b/src/tool/Tool.js @@ -289,7 +289,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{ return false; // Produce a new point on the way to point if point is further // away than maxDistance - if (maxDistance != null && maxDistance != 0) { + if (maxDistance != null && maxDistance !== 0) { if (distance > maxDistance) { point = this._point.add(vector.normalize(maxDistance)); } else if (matchMaxDistance) { diff --git a/src/util/Numerical.js b/src/util/Numerical.js index e6b4f795..85a88abc 100644 --- a/src/util/Numerical.js +++ b/src/util/Numerical.js @@ -312,10 +312,10 @@ var Numerical = new function() { // iteration) and solve the quadratic. x = -(b / a) / 3; // Evaluate q, q', b1 and c2 at x - tmp = a * x, - b1 = tmp + b, - c2 = b1 * x + c, - qd = (tmp + b1) * x + c2, + tmp = a * x; + b1 = tmp + b; + c2 = b1 * x + c; + qd = (tmp + b1) * x + c2; q = c2 * x + d; // Get a good initial approximation. t = q /a; @@ -329,10 +329,10 @@ var Numerical = new function() { do { x = x0; // Evaluate q, q', b1 and c2 at x - tmp = a * x, - b1 = tmp + b, - c2 = b1 * x + c, - qd = (tmp + b1) * x + c2, + tmp = a * x; + b1 = tmp + b; + c2 = b1 * x + c; + qd = (tmp + b1) * x + c2; q = c2 * x + d; // Newton's. Divide by ec to avoid x0 crossing over a // root. diff --git a/src/view/View.js b/src/view/View.js index c40d8769..9e71dca1 100644 --- a/src/view/View.js +++ b/src/view/View.js @@ -55,7 +55,7 @@ var View = Base.extend(Emitter, /** @lends View# */{ function getSize(name) { return element[name] || parseInt(element.getAttribute(name), 10); - }; + } function getCanvasSize() { // Try visible size first, since that will help handling previously @@ -67,7 +67,7 @@ var View = Base.extend(Emitter, /** @lends View# */{ // Reading the attributes should still work. ? new Size(getSize('width'), getSize('height')) : size; - }; + } // If the element has the resize attribute, listen to resize events and // update its coordinate space accordingly