TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/134268
Change subject: Popups: handle links with empty or no title attributes ...................................................................... Popups: handle links with empty or no title attributes The script depends on a title being present in title attribute. So skip links without title attributes (which were getting empty attributes due to the implementation of removeTooltips) and bail on trying to open a preview for links without a title. Change-Id: I4cc744bea10af34741681f11e03d77b3d53e3a3b --- M resources/ext.popups.core.js M resources/ext.popups.renderer.article.js 2 files changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups refs/changes/68/134268/1 diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js index 873ec2e..7e23758 100644 --- a/resources/ext.popups.core.js +++ b/resources/ext.popups.core.js @@ -143,7 +143,7 @@ function selectPopupElements() { var notSelector = ':not(' + mw.popups.IGNORE_CLASSES.join(', ') + ')'; - return mw.popups.$content.find( 'a' + notSelector + ':not([title=""])' ); + return mw.popups.$content.find( 'a[title]' + notSelector + ':not([title=""])' ); } mw.hook( 'wikipage.content').add( function ( $content ) { diff --git a/resources/ext.popups.renderer.article.js b/resources/ext.popups.renderer.article.js index d308bd7..720c8d3 100644 --- a/resources/ext.popups.renderer.article.js +++ b/resources/ext.popups.renderer.article.js @@ -35,6 +35,11 @@ title = link.data( 'title' ), deferred = $.Deferred(); + if( !title ) { + deferred.reject(); + return deferred.promise(); + } + mw.popups.render.currentRequest = mw.popups.api.get( { action: 'query', prop: 'extracts|pageimages|revisions|info', -- To view, visit https://gerrit.wikimedia.org/r/134268 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4cc744bea10af34741681f11e03d77b3d53e3a3b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Popups Gerrit-Branch: master Gerrit-Owner: TheDJ <hartman.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits