From: MatmaRex Date: Wed, 3 Oct 2012 17:33:05 +0000 (+0200) Subject: mw.notification: fix error on notif. close with $.fx.off=true X-Git-Tag: 1.31.0-rc.0~21745^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=02e44d462fcf84da2104ea95f242c6bf08424c05;p=lhc%2Fweb%2Fwiklou.git mw.notification: fix error on notif. close with $.fx.off=true I didn't investigate why, but apparently $placeholder being defined lexically after it is first used causes it to be null when it shouldn't be, causing at least Opera to blow up. This only appears when $.fx.off is set to true (to disable all jQuery animations; there's a gadget that does this on pl.wikipedia). Change-Id: If0aa6279515694ef20337ef02a05562c5543b2e2 --- diff --git a/resources/mediawiki/mediawiki.notification.js b/resources/mediawiki/mediawiki.notification.js index 5bcbfcc9ea..58a3ab6ae2 100644 --- a/resources/mediawiki/mediawiki.notification.js +++ b/resources/mediawiki/mediawiki.notification.js @@ -291,8 +291,19 @@ } ) // Fix the top/left position to the current computed position from which we // can animate upwards. - .css( this.$notification.position() ) - // Animate opacity and top to create fade upwards animation for notification closing + .css( this.$notification.position() ); + + // This needs to be done *after* notification's position has been made absolute. + if ( options.placeholder ) { + // Insert a placeholder with a height equal to the height of the + // notification plus it's vertical margins in place of the notification + var $placeholder = $( '
' ) + .css( 'height', this.$notification.outerHeight( true ) ) + .insertBefore( this.$notification ); + } + + // Animate opacity and top to create fade upwards animation for notification closing + this.$notification .animate( { opacity: 0, top: '-=35' @@ -311,14 +322,6 @@ } } } ); - - if ( options.placeholder ) { - // Insert a placeholder with a height equal to the height of the - // notification plus it's vertical margins in place of the notification - var $placeholder = $( '
' ) - .css( 'height', this.$notification.outerHeight( true ) ) - .insertBefore( this.$notification ); - } }; /**