Removing deprecated <msg /> support in jquery.localize. Maintaing it is a PITA and...
authorKrinkle <krinkle@users.mediawiki.org>
Fri, 15 Jul 2011 22:54:28 +0000 (22:54 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Fri, 15 Jul 2011 22:54:28 +0000 (22:54 +0000)
<html:msg /> has been the new format for a while.

resources/jquery/jquery.localize.js
tests/qunit/suites/resources/jquery/jquery.localize.js

index 653767a..97072e2 100644 (file)
@@ -1,14 +1,11 @@
 /**
  * Simple Placeholder-based Localization
  *
- * Call on a selection of HTML which contains <msg key="message-key" /> elements or elements with
- * title-msg="message-key" or alt-msg="message-key" attributes. <msg /> elements will be replaced
+ * Call on a selection of HTML which contains <html:msg key="message-key" /> elements or elements with
+ * title-msg="message-key" or alt-msg="message-key" attributes. <html:msg /> elements will be replaced
  * with localized text, elements with title-msg and alt-msg attributes will receive localized title
  * and alt attributes.
- *
- * Note that "msg" elements must have html namespacing such as "<html:msg />" to be compatible with
- * Internet Explorer.
- *
+ * *
  * Example:
  *             <p class="somethingCool">
  *                     <html:msg key="my-message" />
@@ -23,7 +20,7 @@
  */
 ( function( $ ) {
 /**
- * Localizes a DOM selection by replacing <msg /> elements with localized text and adding
+ * Localizes a DOM selection by replacing <html:msg /> elements with localized text and adding
  * localized title and alt attributes to elements with title-msg and alt-msg attributes
  * respectively.
  *
@@ -40,7 +37,7 @@ $.fn.localize = function( options ) {
                return mw.msg.apply( mw, args );
        };
        return $(this)
-               .find( 'msg,html\\:msg' )
+               .find( 'html\\:msg' )
                        .each( function() {
                                var $el = $(this);
                                $el
index 43eac09..d2aef7e 100644 (file)
@@ -6,7 +6,7 @@ test( '-- Initial check', function() {
 } );
 
 test( 'Handle basic replacements', function() {
-       expect(4);
+       expect(3);
 
        var html, $lc;
        mw.messages.set( 'basic', 'Basic stuff' );
@@ -17,12 +17,6 @@ test( 'Handle basic replacements', function() {
 
        strictEqual( $lc.text(), 'Basic stuff', 'Tag: html:msg' );
 
-       // Tag: msg (deprecated)
-       html = '<div><span><msg key="basic"></span></div>';
-       $lc = $( html ).localize().find( 'span' );
-
-       strictEqual( $lc.text(), 'Basic stuff', 'Tag: msg' );
-
        // Attribute: title-msg
        html = '<div><span title-msg="basic"></span></div>';
        $lc = $( html ).localize().find( 'span' );