Ignore name-less inputs on preference page confirmCloseWindow check
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Sun, 17 Jan 2016 17:24:28 +0000 (12:24 -0500)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 8 Mar 2016 01:28:36 +0000 (02:28 +0100)
Ignore any fields that will not be submitted when checking
if the user has made changes to the Preferences form.

Bug: T122702
Change-Id: I1cf27267e60f2077180b7bb6a3bc29fded4b67f6

resources/src/mediawiki.special/mediawiki.special.preferences.js

index 29322f4..a756f22 100644 (file)
 
                // Check if all of the form values are unchanged
                function isPrefsChanged() {
-                       var inputs = $( '#mw-prefs-form :input' ),
+                       var inputs = $( '#mw-prefs-form :input[name]' ),
                                input, $input, inputType,
                                index, optIndex,
                                opt;
                                $input = $( input );
 
                                // Different types of inputs have different methods for accessing defaults
-                               if ( $input.is( 'select' ) ) { // <select> has the property defaultSelected for each option
+                               if ( $input.is( 'select' ) ) {
+                                       // <select> has the property defaultSelected for each option
                                        for ( optIndex = 0; optIndex < input.options.length; optIndex++ ) {
                                                opt = input.options[ optIndex ];
                                                if ( opt.selected !== opt.defaultSelected ) {