Merge "Improve mw.popups.selectPopupElements"

This commit is contained in:
jenkins-bot 2015-03-04 12:10:23 +00:00 committed by Gerrit Code Review
commit 62659d2c34
2 changed files with 7 additions and 1 deletions

View file

@ -53,6 +53,7 @@ class PopupsHooks {
$moduleDependencies = array(
'mediawiki.api',
'mediawiki.jqueryMsg',
'mediawiki.Uri',
'moment',
'jquery.jStorage',
'jquery.client',

View file

@ -154,7 +154,12 @@
return mw.popups.$content
.find( 'a[href][title]:not(' + mw.popups.IGNORE_CLASSES.join(', ') + ')' )
.filter( function () {
return ( this.href.replace(/^https?:\/\//,'//') === ( mw.config.get( 'wgServer' ) + mw.util.getUrl( this.title ) ).replace(/^https?:\/\//,'//') );
var linkHref = new mw.Uri( this.href ),
expectedHref = new mw.Uri( mw.util.getUrl( this.title ) );
// don't compare fragment to display popups on anchored page links
linkHref.fragment = undefined;
return linkHref.toString() === expectedHref.toString();
} );
};