'use strict';
$( function () {
- var $checkboxes = $( 'li input[type=checkbox]' );
+ // FIXME: This shouldn't be a global selector to avoid conflicts
+ // with unrelated content on the same page. (T131318)
+ var $checkboxes = $( 'li input[type="checkbox"]' );
function selectAll( check ) {
$checkboxes.prop( 'checked', check );
}
$( '.mw-checkbox-all' ).click( function ( e ) {
- selectAll( true );
e.preventDefault();
+ selectAll( true );
} );
$( '.mw-checkbox-none' ).click( function ( e ) {
- selectAll( false );
e.preventDefault();
+ selectAll( false );
} );
$( '.mw-checkbox-invert' ).click( function ( e ) {
- $checkboxes.each( function () {
- $( this ).prop( 'checked', !$( this ).is( ':checked' ) );
- } );
e.preventDefault();
+ $checkboxes.prop( 'checked', function ( i, val ) {
+ return !val;
+ } );
} );
} );
}( mediaWiki, jQuery ) );
-