mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-18 02:00:53 +00:00
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. Bug: 67728 Change-Id: I4cc744bea10af34741681f11e03d77b3d53e3a3b
This commit is contained in:
parent
d60a70867c
commit
5025f2beee
|
@ -91,6 +91,7 @@
|
|||
*/
|
||||
mw.popups.removeTooltips = function ( $elements ) {
|
||||
$elements
|
||||
.filter( '[title]:not([title=""])' )
|
||||
.on( 'mouseenter focus', function () {
|
||||
$( this )
|
||||
.data( 'title', $( this ).attr( 'title' ) )
|
||||
|
@ -146,9 +147,7 @@
|
|||
* @method selectPopupElements
|
||||
*/
|
||||
mw.popups.selectPopupElements = function () {
|
||||
var notSelector = ':not(' + mw.popups.IGNORE_CLASSES.join(', ') + ')';
|
||||
|
||||
return mw.popups.$content.find( 'a' + notSelector + ':not([title=""])' );
|
||||
return mw.popups.$content.find( 'a:not(' + mw.popups.IGNORE_CLASSES.join(', ') + ')' );
|
||||
};
|
||||
|
||||
mw.hook( 'wikipage.content').add( function ( $content ) {
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
title = link.data( 'title' ),
|
||||
deferred = $.Deferred();
|
||||
|
||||
if ( !title ) {
|
||||
return deferred.reject().promise();
|
||||
}
|
||||
|
||||
mw.popups.render.currentRequest = mw.popups.api.get( {
|
||||
action: 'query',
|
||||
prop: 'extracts|pageimages|revisions|info',
|
||||
|
|
Loading…
Reference in a new issue