r92329 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92328‎ | r92329 | r92330 >
Date:22:54, 15 July 2011
Author:krinkle
Status:resolved (Comments)
Tags:
Comment:
Removing deprecated <msg /> support in jquery.localize. Maintaing it is a PITA and it doesn't work properly in IE6, 7 and 8.

<html:msg /> has been the new format for a while.
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.localize.js (modified) (history)
  • /trunk/phase3/tests/qunit/suites/resources/jquery/jquery.localize.js (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.localize.js
@@ -6,7 +6,7 @@
77 } );
88
99 test( 'Handle basic replacements', function() {
10 - expect(4);
 10+ expect(3);
1111
1212 var html, $lc;
1313 mw.messages.set( 'basic', 'Basic stuff' );
@@ -17,12 +17,6 @@
1818
1919 strictEqual( $lc.text(), 'Basic stuff', 'Tag: html:msg' );
2020
21 - // Tag: msg (deprecated)
22 - html = '<div><span><msg key="basic"></span></div>';
23 - $lc = $( html ).localize().find( 'span' );
24 -
25 - strictEqual( $lc.text(), 'Basic stuff', 'Tag: msg' );
26 -
2721 // Attribute: title-msg
2822 html = '<div><span title-msg="basic"></span></div>';
2923 $lc = $( html ).localize().find( 'span' );
Index: trunk/phase3/resources/jquery/jquery.localize.js
@@ -1,14 +1,11 @@
22 /**
33 * Simple Placeholder-based Localization
44 *
5 - * Call on a selection of HTML which contains <msg key="message-key" /> elements or elements with
6 - * title-msg="message-key" or alt-msg="message-key" attributes. <msg /> elements will be replaced
 5+ * Call on a selection of HTML which contains <html:msg key="message-key" /> elements or elements with
 6+ * title-msg="message-key" or alt-msg="message-key" attributes. <html:msg /> elements will be replaced
77 * with localized text, elements with title-msg and alt-msg attributes will receive localized title
88 * and alt attributes.
9 - *
10 - * Note that "msg" elements must have html namespacing such as "<html:msg />" to be compatible with
11 - * Internet Explorer.
12 - *
 9+ * *
1310 * Example:
1411 * <p class="somethingCool">
1512 * <html:msg key="my-message" />
@@ -23,7 +20,7 @@
2421 */
2522 ( function( $ ) {
2623 /**
27 - * Localizes a DOM selection by replacing <msg /> elements with localized text and adding
 24+ * Localizes a DOM selection by replacing <html:msg /> elements with localized text and adding
2825 * localized title and alt attributes to elements with title-msg and alt-msg attributes
2926 * respectively.
3027 *
@@ -40,7 +37,7 @@
4138 return mw.msg.apply( mw, args );
4239 };
4340 return $(this)
44 - .find( 'msg,html\\:msg' )
 41+ .find( 'html\\:msg' )
4542 .each( function() {
4643 var $el = $(this);
4744 $el

Follow-up revisions

RevisionCommit summaryAuthorDate
r92758Followup r92329: Fixes the localize test cases in IE 6 and 7....brion17:45, 21 July 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   17:46, 21 July 2011

This left the tests broken on IE 6 and IE 7 -- please test before marking these things ok!

Tests fixed in r92758.

Status & tagging log