On 2015-05-12 05:05, Sukyoung Ryu wrote:
We've noticed that a bug we reported on Jan 28, 2014 and got fixed right away as follows:
http://meta.wikimedia.org/w/index.php?title=MediaWiki%3AGadget-wm-portal.js&...
revived recently as follows:
http://meta.wikimedia.org/w/index.php?title=MediaWiki%3AGadget-wm-portal.js&...
Could you kindly let us know the reason?
Hi Sukyoung,
Since the fix was originally put in, we made an effort to clean up the page's JavaScript code in part using the JSHint tool. [1] JSHint flags uses of JavaScript's == operator, suggesting === instead. I blindly followed that suggestion without noticing that the left-hand expression was a call to String.prototype.match(), which either returns null or an array.
It turns out the former code had been working because ['foo'] == 'foo' in JavaScript. I've been coding in JavaScript for years and was totally unaware of that behavior -- more reason to use === instead of ==. I fixed the code in a way that is unlikely to regress in the future.
Thank you for re-reporting the bug! Please report any future bugs you find to the portals' talk page [2].
[1] http://jshint.com/ [2] https://meta.wikimedia.org/wiki/Talk:Project_portals