From: Krinkle Date: Thu, 24 Feb 2011 23:02:56 +0000 (+0000) Subject: caching selector instead of re-creating the jQuery object for 'this' two or three... X-Git-Tag: 1.31.0-rc.0~31782 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=76935df945b43fec9dc2604b10ab28fae5dfc630;p=lhc%2Fweb%2Fwiklou.git caching selector instead of re-creating the jQuery object for 'this' two or three times --- diff --git a/resources/jquery/jquery.localize.js b/resources/jquery/jquery.localize.js index 27d6584758..15e0164955 100644 --- a/resources/jquery/jquery.localize.js +++ b/resources/jquery/jquery.localize.js @@ -37,22 +37,24 @@ $.fn.localize = function( options ) { .find( 'msg,html\\:msg' ) .each( function() { var $el = $(this); - $(this) - .text( mw.msg( options.prefix + $(this).attr( 'key' ) ) ) - .replaceWith( $(this).html() ); + $el + .text( mw.msg( options.prefix + $el.attr( 'key' ) ) ) + .replaceWith( $el.html() ); } ) .end() .find( '[title-msg]' ) .each( function() { - $(this) - .attr( 'title', mw.msg( options.prefix + $(this).attr( 'title-msg' ) ) ) + var $el = $(this); + $el + .attr( 'title', mw.msg( options.prefix + $el.attr( 'title-msg' ) ) ) .removeAttr( 'title-msg' ); } ) .end() .find( '[alt-msg]' ) .each( function() { - $(this) - .attr( 'alt', mw.msg( options.prefix + $(this).attr( 'alt-msg' ) ) ) + var $el = $(this); + $el + .attr( 'alt', mw.msg( options.prefix + $el.attr( 'alt-msg' ) ) ) .removeAttr( 'alt-msg' ); } ) .end();