Opened 8 years ago

Closed 8 years ago

#8168 closed bug (notabug)

Some questions about destroy

Reported by: BenLocke Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.selectable Version: 1.8.18
Keywords: Cc:
Blocked by: Blocking:

Description

I am studying jquery ui. I found some questions in it. Hope somebody can give me a response by email:benlocke77@gmail.com Thanks

  1. When the selectable widget has been destroyed, some of the data has not been cleaned.

I use firebug in Firefox to test it. The reason is the destroy function in selectable widget has not cleaned the data of selectableItem instead of selectable-item. And I think the destroy function should try to clean the class ui-selected in selectees.

  1. Maybe the jquery.ui.mouse.js should rewite the functions: _createWidget and destroy. like this:

_createWidget: function( options, element ) {

this._superApply( "_createWidget", arguments ); this._mouseInit();

}, destroy: function() {

this._mouseDestroy(); this._superApply( "destroy", arguments );

},

If rewiting the functions in jquery.ui.mouse.js, the widgets don't need to recall _mouseInit() and _mouseDestroy().

  1. I think the jquery.ui.selectable.js should use function _destroy instead of function destroy. Maybe other widgets should do it like this. If rewriting the function destroy in widget, the logic in original function destroy has been lost. The function destroy calls _destroy and _destroy is a null function. I think rewriting function _destroy in widgets is better.

_destroy: function() {

this.selectees

.removeClass("ui-selectee ui-selected") .removeData("selectableItem");

this.element

.removeClass("ui-selectable ui-selectable-disabled") .removeData("selectable") .unbind(".selectable");

this._mouseDestroy(); return this;

},

destroy: function() {

this.selectees

.removeClass("ui-selectee") .removeData("selectable-item");

this.element

.removeClass("ui-selectable ui-selectable-disabled") .removeData("selectable") .unbind(".selectable");

this._mouseDestroy();

return this;

},

Change History (1)

comment:1 Changed 8 years ago by Scott González

Resolution: invalid
Status: newclosed

Are you aware that _super(), _destroy(), etc. are new features that don't exist in any stable release? The widgets should already be doing the right thing with _destroy() in master. Also, all interactions are being rewritten from scratch for 2.0, and mouse is being replaced by a pointer-agnostic layer called interaction.

Feel free to file tickets about specific bugs, such as selectableitem vs. selectable-item, but this ticket is too broad and this is not the place for long discussions about the API design.

Note: See TracTickets for help on using tickets.