Merge "Remove redundant checks for .length on jQuery objects"

This commit is contained in:
jenkins-bot 2019-01-14 09:33:12 +00:00 committed by Gerrit Code Review
commit 07982bcc54

View file

@ -240,17 +240,10 @@
* Hides the current tooltip immediately
*/
hideCurrentTooltip: function () {
var $highlightedRevisionWrapper = $( '.mw-revslider-revision-wrapper-hovered' ),
$currentTooltip = $( '.mw-revslider-revision-tooltip' );
if ( this.tooltipTimeout !== -1 ) {
window.clearTimeout( this.tooltipTimeout );
}
if ( $highlightedRevisionWrapper.length !== 0 ) {
$highlightedRevisionWrapper.removeClass( 'mw-revslider-revision-wrapper-hovered' );
}
if ( $currentTooltip.length !== 0 ) {
$currentTooltip.remove();
}
$( '.mw-revslider-revision-wrapper-hovered' )
.removeClass( 'mw-revslider-revision-wrapper-hovered' );
$( '.mw-revslider-revision-tooltip' ).remove();
},
/**
@ -259,14 +252,9 @@
* @param {jQuery} $revisionWrapper
*/
hideTooltip: function ( $revisionWrapper ) {
var $currentTooltip = $( '.mw-revslider-revision-tooltip' );
this.tooltipTimeout = window.setTimeout( function () {
if ( $revisionWrapper.length !== 0 ) {
$revisionWrapper.removeClass( 'mw-revslider-revision-wrapper-hovered' );
}
if ( $currentTooltip.length !== 0 ) {
$currentTooltip.remove();
}
$( '.mw-revslider-revision-tooltip' ).remove();
}, 500 );
},