Mercurial > hg
diff mercurial/subrepo.py @ 35157:ccf86aa5797c
hgweb: use strict equals in mercurial.js
This patch changes "==" (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).
Some of the changes in this patch are straightforward, e.g. when comparing
results of typeof (they could only be strings). The same goes for 'none' and
similar strings that can't be sensibly coerced to some other type. Two changes
that compare values to "1" and "0" can be clarified: getAttribute() returns
either a string or null, but comparing null to a string is always false, so no
logic is lost.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 22 Nov 2017 20:52:59 +0800 |
parents | 3da4bd50103d |
children | ee64e677c3cf |