r103455 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103454‎ | r103455 | r103456 >
Date:11:01, 17 November 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Use chaining and prop instead of attr where I think it is correct
Modified paths:
  • /trunk/extensions/Narayam/js/ext.narayam.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/js/ext.narayam.core.js
@@ -348,9 +348,10 @@
349349 this.enable = function() {
350350 if ( !enabled ) {
351351 $.cookie( 'narayam-enabled', '1', { 'path': '/', 'expires': 30 } );
352 - $( '#narayam-toggle' ).attr( 'checked', true );
353 - $( 'li#pt-narayam').removeClass( 'narayam-inactive' );
354 - $( 'li#pt-narayam').addClass( 'narayam-active' );
 352+ $( '#narayam-toggle' ).prop( 'checked', true );
 353+ $( 'li#pt-narayam')
 354+ .removeClass( 'narayam-inactive' )
 355+ .addClass( 'narayam-active' );
355356 enabled = true;
356357 }
357358 };
@@ -361,9 +362,10 @@
362363 this.disable = function() {
363364 if ( enabled ) {
364365 $.cookie( 'narayam-enabled', '0', { 'path': '/', 'expires': 30 } );
365 - $( '#narayam-toggle' ).attr( 'checked', false );
366 - $( 'li#pt-narayam').removeClass( 'narayam-active' );
367 - $( 'li#pt-narayam').addClass( 'narayam-inactive' );
 366+ $( '#narayam-toggle' ).prop( 'checked', false );
 367+ $( 'li#pt-narayam')
 368+ .removeClass( 'narayam-active' )
 369+ .addClass( 'narayam-inactive' );
368370 enabled = false;
369371 }
370372 };
@@ -474,12 +476,12 @@
475477 }
476478 if ( lastScheme) {
477479 that.setScheme( lastScheme );
478 - $( '#narayam-' + lastScheme ).attr( 'checked', 'checked' );
 480+ $( '#narayam-' + lastScheme ).prop( 'checked', true );
479481 } else {
480482 //if no saved input scheme, select the first.
481483 var $firstScheme = $( 'input.narayam-scheme:first' );
482484 that.setScheme( $firstScheme.val() );
483 - $firstScheme.attr( 'checked', 'checked' );
 485+ $firstScheme.prop( 'checked', true );
484486
485487 }
486488 var enabledCookie = $.cookie( 'narayam-enabled' );
@@ -611,9 +613,9 @@
612614 that.setScheme( $(this).val() );
613615 // rebuild the menu items with recent items.
614616 $( '#narayam-menu-items' ).html( $.narayam.buildMenuItems() );
615 - $( '#narayam-' + $(this).val() ).attr( 'checked', 'checked' );
 617+ $( '#narayam-' + $(this).val() ).prop( 'checked', true );
616618 if ( enabled ) {
617 - $( '#narayam-toggle' ).attr( 'checked', true );
 619+ $( '#narayam-toggle' ).prop( 'checked', true );
618620 }
619621 } );
620622

Status & tagging log