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