$.ui.testWidget();
});
-test( "_bind() to common element", function() {
+test( "_on() to common element", function() {
expect( 1 );
$.widget( "ui.testWidget", {
_create: function() {
- this._bind( this.document, {
+ this._on( this.document, {
"customevent": "_handler"
});
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
+ this.uuid = uuid++;
+ this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );
- this.uuid = uuid++;
this.bindings = $();
this.hoverable = $();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
- .unbind( "." + this.widgetName + this.uuid )
+ .unbind( this.eventNamespace )
// 1.9 BC for #7810
// TODO remove dual storage
.removeData( this.widgetName )
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
this.widget()
- .unbind( "." + this.widgetName + this.uuid )
+ .unbind( this.eventNamespace )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
// clean up events and states
- this.bindings.unbind( "." + this.widgetName + this.uuid );
+ this.bindings.unbind( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
},
}
var match = event.match( /^(\w+)\s*(.*)$/ ),
- eventName = match[1] + "." + instance.widgetName + instance.uuid,
+ eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
instance.widget().delegate( selector, eventName, handlerProxy );