*/
( function ( $, mw ) {
+ var hasOwn = Object.prototype.hasOwnProperty;
+
/**
* @class mw.widgets.PageExistenceCache
* @private
queue = this.existenceCheckQueue;
this.existenceCheckQueue = {};
titles = Object.keys( queue ).filter( function ( title ) {
- if ( cache.existenceCache.hasOwnProperty( title ) ) {
+ if ( hasOwn.call( cache.existenceCache, title ) ) {
queue[ title ].resolve( cache.existenceCache[ title ] );
}
- return !cache.existenceCache.hasOwnProperty( title );
+ return !hasOwn.call( cache.existenceCache, title );
} );
if ( !titles.length ) {
return;
} );
titles.forEach( function ( title ) {
var normalizedTitle = title;
- while ( normalized[ normalizedTitle ] ) {
+ while ( hasOwn.call( normalized, normalizedTitle ) ) {
normalizedTitle = normalized[ normalizedTitle ];
}
cache.existenceCache[ title ] = pages[ normalizedTitle ];
*/
PageExistenceCache.prototype.checkPageExistence = function ( title ) {
var key = title.getPrefixedText();
- if ( !this.existenceCheckQueue[ key ] ) {
+ if ( !hasOwn.call( this.existenceCheckQueue, key ) ) {
this.existenceCheckQueue[ key ] = $.Deferred();
}
this.processExistenceCheckQueueDebounced();
* @license The MIT License (MIT); see LICENSE.txt
*/
( function ( $, mw ) {
- var NS_CATEGORY = mw.config.get( 'wgNamespaceIds' ).category;
+ var hasOwn = Object.prototype.hasOwnProperty,
+ NS_CATEGORY = mw.config.get( 'wgNamespaceIds' ).category;
/**
* Category selector widget. Displays an OO.ui.CapsuleMultiselectWidget
cacheKey = input + searchType.toString();
// Check cache
- if ( this.searchCache[ cacheKey ] !== undefined ) {
+ if ( hasOwn.call( this.searchCache, cacheKey ) ) {
return this.searchCache[ cacheKey ];
}
* @license The MIT License (MIT); see LICENSE.txt
*/
( function ( $, mw ) {
+ var hasOwn = Object.prototype.hasOwnProperty;
/**
* Mixin for title widgets
titles.push( suggestionPage.title );
}
- redirects = redirectsTo[ suggestionPage.title ] || [];
+ redirects = hasOwn.call( redirectsTo, suggestionPage.title ) ? redirectsTo[ suggestionPage.title ] : [];
for ( i = 0, len = redirects.length; i < len; i++ ) {
pageData[ redirects[ i ] ] = {
missing: false,
// mismatch where normalisation would make them matching (T50476)
pageExistsExact = (
- Object.prototype.hasOwnProperty.call( pageData, this.getQueryValue() ) &&
+ hasOwn.call( pageData, this.getQueryValue() ) &&
(
!pageData[ this.getQueryValue() ].missing ||
pageData[ this.getQueryValue() ].known
);
pageExists = pageExistsExact || (
titleObj &&
- Object.prototype.hasOwnProperty.call( pageData, titleObj.getPrefixedText() ) &&
+ hasOwn.call( pageData, titleObj.getPrefixedText() ) &&
(
!pageData[ titleObj.getPrefixedText() ].missing ||
pageData[ titleObj.getPrefixedText() ].known
}
for ( i = 0, len = titles.length; i < len; i++ ) {
- page = pageData[ titles[ i ] ] || {};
+ page = hasOwn.call( pageData, titles[ i ] ) ? pageData[ titles[ i ] ] : {};
items.push( this.createOptionWidget( this.getOptionWidgetData( titles[ i ], page ) ) );
}