mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-27 17:20:01 +00:00
Merge "Simplify some overly complex comparisons with undefined"
This commit is contained in:
commit
310bf46cf9
|
@ -614,7 +614,7 @@ Model.prototype.setTemplateParamOrder = function ( orderArray ) {
|
|||
* @fires change
|
||||
*/
|
||||
Model.prototype.setTemplateFormat = function ( format ) {
|
||||
format = format !== undefined ? format : null;
|
||||
format = format || null;
|
||||
if ( this.format !== format ) {
|
||||
this.format = format;
|
||||
this.emit( 'change-format', format );
|
||||
|
|
|
@ -405,7 +405,7 @@ Dialog.prototype.onModelChangeDescription = function ( description ) {
|
|||
*/
|
||||
Dialog.prototype.onModelChangeMapInfo = function ( map ) {
|
||||
var selectedItem = this.mapsGroup.findSelectedItem();
|
||||
map = map === undefined ? {} : map;
|
||||
map = map || {};
|
||||
this.mapsCache = OO.copy( map );
|
||||
if ( selectedItem ) {
|
||||
this.templateMapsInput.setValue( this.stringifyObject( map[ selectedItem.label ] ) );
|
||||
|
@ -511,7 +511,7 @@ Dialog.prototype.onDescriptionInputChange = function ( value ) {
|
|||
* @param {Object|undefined} mapsObject
|
||||
*/
|
||||
Dialog.prototype.populateMapsItems = function ( mapsObject ) {
|
||||
mapsObject = mapsObject === undefined ? {} : mapsObject;
|
||||
mapsObject = mapsObject || {};
|
||||
var mapKeysList = Object.keys( mapsObject );
|
||||
|
||||
var items = mapKeysList.map( function ( mapKey ) {
|
||||
|
@ -535,7 +535,7 @@ Dialog.prototype.populateMapsItems = function ( mapsObject ) {
|
|||
Dialog.prototype.onMapInfoChange = function ( value ) {
|
||||
var selectedItem = this.mapsGroup.findSelectedItem();
|
||||
// Update map Info
|
||||
this.model.maps = this.model.getMapInfo() === undefined ? {} : this.model.getMapInfo();
|
||||
this.model.maps = this.model.getMapInfo() || {};
|
||||
if ( selectedItem ) {
|
||||
if ( this.model.getMapInfo()[ selectedItem.label ] !== value ) {
|
||||
// Disable Done button in case of invalid JSON
|
||||
|
|
Loading…
Reference in a new issue