# HG changeset patch # User Anton Shestakov # Date 2017-11-22 12:32:07 # Node ID 9f44d44626a0822b1edf4b7a3531120cf8dc3cdb # Parent 6d5718e3965711c64aa79dd10bff4431fba6c8bc hgweb: use strict equals, remove non-breaking space in followlines.js The first hunk had a non-breaking space character just before "{", it's not an error or anything, but let's fix it while we're at it. (This corresponds to "nonbsp" option of jshint). Hunks 2 and 3 change "==" (equals operator) to "===" (strict equals operator). The difference between them is that the latter doesn't do any type coercions. It's handy to compare string '1' to number 1 sometimes, but most of the time using "==" is inadvertent and can be replaced by an explicit type conversion. (This corresponds to "eqeqeq" option of jshint). Most of this file already uses strict equals operator, and in the code affected type coercion is not needed, because tagName and selectableTag are both strings and endId and startId are both numbers. diff --git a/mercurial/templates/static/followlines.js b/mercurial/templates/static/followlines.js --- a/mercurial/templates/static/followlines.js +++ b/mercurial/templates/static/followlines.js @@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoa } // URL to complement with "linerange" query parameter var targetUri = sourcelines.dataset.logurl; - if (typeof targetUri === 'undefined') { + if (typeof targetUri === 'undefined') { return; } @@ -114,7 +114,7 @@ document.addEventListener('DOMContentLoa if (parent === null) { return null; } - if (element.tagName == selectableTag && parent.isSameNode(sourcelines)) { + if (element.tagName === selectableTag && parent.isSameNode(sourcelines)) { return element; } return selectableParent(parent); @@ -182,7 +182,7 @@ document.addEventListener('DOMContentLoa // compute line range (startId, endId) var endId = parseInt(endElement.id.slice(1)); - if (endId == startId) { + if (endId === startId) { // clicked twice the same line, cancel and reset initial state // (CSS, event listener for selection start) removeSelectedCSSClass();