jenkins-bot has submitted this change and it was merged.

Change subject: Improved jQuery.ui.inputextender/jQuery.ui.listrotator destroy 
implementations
......................................................................


Improved jQuery.ui.inputextender/jQuery.ui.listrotator destroy implementations

Change-Id: I0c6a377bafab7132ddd4be44b86c79efb5da39cb
---
M ValueView/resources/jquery.ui/jquery.ui.inputextender.js
M ValueView/resources/jquery.ui/jquery.ui.listrotator.js
2 files changed, 25 insertions(+), 7 deletions(-)

Approvals:
  Henning Snater: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ValueView/resources/jquery.ui/jquery.ui.inputextender.js 
b/ValueView/resources/jquery.ui/jquery.ui.inputextender.js
index 8064753..6a36c4a 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.inputextender.js
+++ b/ValueView/resources/jquery.ui/jquery.ui.inputextender.js
@@ -212,10 +212,6 @@
                                this.options.initCallback();
                        }
 
-                       $.each( this.options.content, function( i, node ) {
-                               $( node ).addClass( self.widgetBaseClass + 
'-contentnode' );
-                       } );
-
                        this.$extension.hide();
                },
 
@@ -223,10 +219,28 @@
                 * @see jQuery.Widget.destroy
                 */
                destroy: function() {
-                       this.$extension.remove();
+                       if( !this.$extension ) {
+                               return; // already destroyed
+                       }
+
+                       clearTimeout( this._animationTimeout );
+                       this._animationTimeout = null;
+
+                       this.element.removeClass( this.widgetBaseClass + 
'-input' );
+
+                       this.$extension.stop( true );
+                       this.$extension.detach();
+                       // There might be references to extension's content 
nodes on the outside, so make sure
+                       // those content nodes get cleaned up as well:
+                       this.$extension.children().removeClass( 
this.widgetBaseClass + '-contentnode' );
+                       this.$extension = null;
+
+                       this.$closeIcon.remove();
+                       this.$closeIcon = null;
 
                        $.Widget.prototype.destroy.call( this );
 
+                       // TODO: Improve performance by maintaining array with 
widget references instead.
                        if( $( ':' + this.widgetBaseClass ).length === 0 ) {
                                $( 'html' ).off( '.' + this.widgetName );
                        }
@@ -241,6 +255,7 @@
                        this.$extension.empty().append( this.$closeIcon );
 
                        $.each( this.options.content, function( i, $node ) {
+                               $node.addClass( self.widgetBaseClass + 
'-contentnode' );
                                self.$extension.append( $node );
                        } );
                },
diff --git a/ValueView/resources/jquery.ui/jquery.ui.listrotator.js 
b/ValueView/resources/jquery.ui/jquery.ui.listrotator.js
index 4a562aa..4659fc3 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.listrotator.js
+++ b/ValueView/resources/jquery.ui/jquery.ui.listrotator.js
@@ -243,9 +243,12 @@
                 * @see $.Widget.destroy
                 */
                destroy: function() {
-                       this.$menu.data( 'menu' ).destroy();
-                       this.$menu.remove();
+                       var menu = this.$menu.data( 'menu' );
+                       if( menu ) {
+                               menu.destroy();
+                       }
 
+                       this.$menu.remove();
                        this.$auto.remove();
                        this.$curr.remove();
                        this.$prev.remove();

-- 
To view, visit https://gerrit.wikimedia.org/r/76745
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0c6a377bafab7132ddd4be44b86c79efb5da39cb
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <daniel.wer...@wikimedia.de>
Gerrit-Reviewer: Daniel Werner <daniel.wer...@wikimedia.de>
Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to