Social Reiot

Social Game Developer wandering in strange dungeon.

Do Not Remove this.element in ui.widget.destroy()

ui.widget.element.remove() will call own destroy() automatically.

$.Widget.prototype = {

_createWidget: function( options, element ) {
    // $.widget.bridge stores the plugin instance, but we do it anyway
    // so that it's stored even before the _create function runs
    $.data( element, this.widgetName, this );
    this.element = $( element );
    this.options = $.extend( true, {},
        this.options,
        $.metadata && $.metadata.get( element )[ this.widgetName ],
        options );

    var self = this;
    this.element.bind( "remove." + this.widgetName, function() {
        self.destroy();
    });

    this._create();
    this._init();
},

Comments