r90244 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90243‎ | r90244 | r90245 >
Date:23:24, 16 June 2011
Author:brion
Status:deferred
Tags:
Comment:
CodeEditor: compat fix for use as gadget on MediaWiki 1.17

$.map doesn't handle objects in jQuery before 1.6, so roll our own helper internally
Modified paths:
  • /trunk/extensions/CodeEditor/modules/jquery.codeEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeEditor/modules/jquery.codeEditor.js
@@ -226,7 +226,15 @@
227227 */
228228 var saveAndExtend = function( base, extended ) {
229229 var saved = {};
230 - $.map( extended, function( func, name ) {
 230+ // $.map doesn't handle objects in jQuery < 1.6; need this for compat with MW 1.17
 231+ var map = function( obj, callback ) {
 232+ for (var key in extended ) {
 233+ if ( obj.hasOwnProperty( key ) ) {
 234+ callback( obj[key], key );
 235+ }
 236+ }
 237+ };
 238+ map( extended, function( func, name ) {
231239 if ( name in base ) {
232240 var orig = base[name];
233241 base[name] = function() {

Status & tagging log