MediaWiki talk:Wdsearch-autodesc.js: Difference between revisions

Content deleted Content added
Please ignore claims marked with deprecated rank: change the diff to link to the version that actually filters the array
Line 126:
: [[Special:Diff/756970705|Diff/756970705]] should do the trick. Can anyone apply it and test it, please? <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 00:16, 28 December 2016 (UTC)
:: {{ping|Petr Matas}} I spotted two things which I think are bugs in the filterClaims function. The first is the $.each syntax - the first parameter to the callback function is the array index, not the value. The second is the use of $.grep in a loop. According to the [http://api.jquery.com/jquery.grep/ docs], this function alters the existing array. It would work fine on the first iteration if there are any preferred statements, but as the original values array is altered, on the second iteration $.grep would be working with an empty array (it has no preferred statements, and any normal or deprecated statements were removed in the first iteration). I've fixed both of these bugs in [[Special:Diff/756970705/757143441|this diff]], but I haven't tested the code yet. Could you look over my changes and see if they look ok? Best — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr.&nbsp;Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪&nbsp;talk&nbsp;♪]]</sup> 01:23, 29 December 2016 (UTC)
::: {{ping|Mr. Stradivarius}} Thank you for your review. Your fix of the $.each syntax seems correct. Concerning $.grep, its docs say that ''"The original array is not affected."'' Therefore I believe that the two versions are equivalent, except that Array.prototype.filter is only supported since IE 9. <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 05:22, 29 December 2016 (UTC)
 
== Language selection bugfix ==