r94331 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94330‎ | r94331 | r94332 >
Date:08:40, 12 August 2011
Author:dantman
Status:resolved (Comments)
Tags:
Comment:
Use jQuery's $.isArray, not instanceof Array. The later has troubles with cross-frame Array instances, and doesn't use the ES5 native method.
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.mwExtension.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.mwExtension.js
@@ -43,7 +43,7 @@
4444 return false;
4545 }
4646 for ( var i = 0; i < arrThis.length; i++ ) {
47 - if ( arrThis[i] instanceof Array ) {
 47+ if ( $.isArray(arrThis[i]) ) {
4848 if ( !$.compareArray( arrThis[i], arrAgainst[i] ) ) {
4949 return false;
5050 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r94332Fix usage of the jQuery global in a few spots....dantman09:27, 12 August 2011

Comments

#Comment by Krinkle (talk | contribs)   08:45, 12 August 2011

Aside from the whitespace (which you already mentioned on IRC), $ is not available as a global here as jquery.mwExtension doesn't have a closure yet to call $ for jQuery.

#Comment by Dantman (talk | contribs)   09:33, 12 August 2011

As you know, $ was already used on the line below so I just continued what was already there.

Fixed this in r94332, along with a few other files that used the global jQuery instead of a locally scoped $.

Status & tagging log