r103172 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103171‎ | r103172 | r103173 >
Date:14:09, 15 November 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Don't use HTML fragments that don't work - I18n/#241
Modified paths:
  • /trunk/extensions/Narayam/js/ext.narayam.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/js/ext.narayam.core.js
@@ -505,12 +505,12 @@
506506 var $input = $( '<input type="radio" name="narayam-input-method" class="narayam-scheme" />' );
507507 $input.attr( 'id', 'narayam-' + scheme ).val( scheme );
508508
509 - var $narayamMenuItemLabel = $( '<label />' )
 509+ var $narayamMenuItemLabel = $( '<label>' )
510510 .attr( 'for' ,'narayam-' + scheme )
511511 .append( $input )
512512 .append( mw.message( "narayam-"+ scheme ).escaped() );
513513
514 - var $narayamMenuItem = $( '<li/>' )
 514+ var $narayamMenuItem = $( '<li>' )
515515 .append( $input )
516516 .append( $narayamMenuItemLabel );
517517 return $narayamMenuItem;
@@ -523,7 +523,7 @@
524524 this.buildMenuItems = function(){
525525 var haveSchemes = false;
526526 // Build schemes option list
527 - var $narayamMenuItems = $( '<ul/>' );
 527+ var $narayamMenuItems = $( '<ul>' );
528528 var count = 1;
529529 var seen = [];
530530
@@ -572,15 +572,15 @@
573573 .attr( 'title', mw.msg( 'narayam-checkbox-tooltip' ) )
574574 .click( that.toggle );
575575
576 - var $label = $( '<label for="narayam-toggle" />' );
 576+ var $label = $( '<label>' ).attr( 'for', 'narayam-toggle' );
577577 $label
578578 .text( mw.msg( 'narayam-toggle-ime', shortcutText() ) )
579579 .prepend( $checkbox )
580 - .attr( 'title', mw.msg( 'narayam-checkbox-tooltip' ) );
 580+ .prop( 'title', mw.msg( 'narayam-checkbox-tooltip' ) );
581581
582 - $narayamMenuItems.append( $( '<li class="narayam-more-imes-link" />')
 582+ $narayamMenuItems.append( $( '<li>' ).addClass( 'narayam-more-imes-link' )
583583 .append(
584 - $( '<a/>' )
 584+ $( '<a>' )
585585 .text( mw.msg( 'narayam-more-imes' ) )
586586 .click( function() {
587587 $('.narayam-scheme-dynamic-item').toggle('fast');
@@ -619,23 +619,18 @@
620620
621621 var helppage = mw.config.get( 'wgNarayamHelpPage' );
622622 if ( helppage ) {
623 - $narayamMenuItems.append( $( '<li class="narayam-help-link" />')
624 - .append(
625 - $( '<a/>' )
626 - .text( mw.msg( 'narayam-help' ) )
627 - .attr(
628 - 'href',
629 - mw.util.wikiGetlink( helppage )
630 - )
631 - )
632 - );
 623+ var $link = $( '<a>' )
 624+ .text( mw.msg( 'narayam-help' ) )
 625+ .prop( 'href', mw.util.wikiGetlink( helppage ) );
 626+ var $li = $( '<li>' ).addClass( 'narayam-help-link' );
 627+ $narayamMenuItems.append( $li.append( $link ) );
633628 }
634629
635 - $narayamMenuItems.prepend( $( '<li/>' ).append( $label ) );
636 - var $menuItemsDiv = $( '<div id="narayam-menu-items" class="menu-items" />' );
637 - $menuItemsDiv
 630+ $narayamMenuItems.prepend( $( '<li>' ).append( $label ) );
 631+ return $( '<div>' )
 632+ .attr( 'id', 'narayam-menu-items' )
 633+ .addClass( 'menu-items' )
638634 .append( $narayamMenuItems );
639 - return $menuItemsDiv;
640635 }
641636
642637
@@ -644,18 +639,17 @@
645640 */
646641 this.buildMenu = function() {
647642 var $menuItemsDiv = that.buildMenuItems();
648 - var $menu = $( '<div id="narayam-menu" class="narayam-menu" />');
649 - $menu
650 - .append(
651 - $( '<a href="#" />' )
652 - .text( mw.msg( 'narayam-menu' ) )
653 - .attr( 'title', mw.msg( 'narayam-menu-tooltip' ) )
654 - )
655 - .append( $menuItemsDiv );
 643+ var $menu = $( '<div>' )
 644+ .attr( 'id', 'narayam-menu' )
 645+ .addClass( 'narayam-menu' );
 646+ var $link = $( '<a>' )
 647+ .prop( 'href', '#' )
 648+ .text( mw.msg( 'narayam-menu' ) )
 649+ .attr( 'title', mw.msg( 'narayam-menu-tooltip' ) );
 650+
 651+ $menu.append( $link ).append( $menuItemsDiv );
 652+ var $li = $( '<li>' ).attr( 'id', 'pt-narayam' ).append( $menu );
656653
657 - var $li = $( '<li id="pt-narayam" />' );
658 - $li.append( $menu );
659 -
660654 // If rtl, add to the right of top personal links. Else, to the left
661655 var fn = $( 'body' ).hasClass( 'rtl' ) ? "append" : "prepend";
662656 $( '#p-personal ul:first' )[fn]( $li );

Status & tagging log