Find 'all' special ns regardless of its rank in the select
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 28 Jun 2011 19:32:25 +0000 (19:32 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 28 Jun 2011 19:32:25 +0000 (19:32 +0000)
This is done by looking for an <option> element with an empty string value
which denote the special case 'all'.
Also removed a comment in Xml.php asking to keep 'all' as a first element
since it is no longer needed.

Follow up r90943 (comment 18872 by Brion)

includes/Xml.php
resources/mediawiki.special/mediawiki.special.recentchanges.js

index 1e8696b..a100a8b 100644 (file)
@@ -132,8 +132,6 @@ class Xml {
                }
 
                if( !is_null( $all ) )
-                       # Please make sure the 'namespacesall' is the first or you will break
-                       # such an assumption (ex js: mw.special.recentchanges.updateCheckboxes)
                        $namespaces = array( $all => wfMsg( 'namespacesall' ) ) + $namespaces;
                foreach( $namespaces as $index => $name ) {
                        if( $index < NS_MAIN ) {
index 7b11759..7e284fb 100644 (file)
@@ -15,8 +15,8 @@
                 * special 'all' namespace is selected/unselected respectively.
                 */
                updateCheckboxes: function() {
-                       // The 'all' namespace is the FIRST in the list.
-                       var isAllNS = $select.find( 'option' ).first().is( ':selected' );
+                       // The option element for the 'all' namespace has an empty value
+                       var isAllNS = ('' === $select.find('option:selected').val() );
 
                        // Iterates over checkboxes and propagate the selected option
                        $.each( checkboxes, function( i, id ) {