X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.widgets%2Fmw.widgets.CategoryCapsuleItemWidget.js;h=17da7d85f032c6a3c23b657a7f3bb923873e58c2;hp=488d9e099f5e415914f49cb9d5f2581ca64fa084;hb=faf7cc4a09848c538320bd2b9067b1a77c0a0183;hpb=2c8f7978df47f338ee6e245e3efba6175ba425e9 diff --git a/resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js b/resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js index 488d9e099f..17da7d85f0 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js @@ -6,6 +6,8 @@ */ ( function ( $, mw ) { + var hasOwn = Object.prototype.hasOwnProperty; + /** * @class mw.widgets.PageExistenceCache * @private @@ -38,10 +40,10 @@ 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; @@ -61,9 +63,9 @@ $.each( response.query.pages, function ( index, page ) { pages[ page.title ] = !page.missing; } ); - $.each( titles, function ( index, title ) { + titles.forEach( function ( title ) { var normalizedTitle = title; - while ( normalized[ normalizedTitle ] ) { + while ( hasOwn.call( normalized, normalizedTitle ) ) { normalizedTitle = normalized[ normalizedTitle ]; } cache.existenceCache[ title ] = pages[ normalizedTitle ]; @@ -81,7 +83,7 @@ */ 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();