$( "#widget" ).testWidget().detach();
});
});
+
+ test( "destroy - remove event bubbling", function() {
+ shouldDestroy( false, function() {
+ $( "<div>child</div>" ).appendTo( $( "#widget" ).testWidget() )
+ .trigger( "remove" );
+ });
+ });
}());
test( "redefine", function() {
// TODO remove dual storage
$.data( element, this.widgetName, this );
$.data( element, this.widgetFullName, this );
- this._on({ remove: "destroy" });
+ this._on({
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
this.document = $( element.style ?
// element within the document
element.ownerDocument :