MediaWiki talk:Wdsearch-autodesc.js: Difference between revisions
Content deleted Content added
Petr Matas (talk | contribs) |
|||
Line 127:
:: {{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. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</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)
:::: {{ping|Petr Matas}} Ah yes, you're quite right. Sorry about that. We should probably go with the version that is better supported, in that case. I've restored $.grep in your version - does the [https://en.wikipedia.org/wiki/Special:ComparePages?page1=&rev1=757138647&page2=&rev2=757176210&action=&diffonly=&unhide= diff] look ok to you now? — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 06:29, 29 December 2016 (UTC)
== Language selection bugfix ==
|