diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-06-14 10:51:29 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-06-14 11:17:20 -0400 |
commit | 00d4beb0ca4a99933bb7e786a1dd50618c180a0b (patch) | |
tree | fcd9d94f1e1d9daf44fc14c6bc331fef3c3b38b8 /ui/jquery.ui.widget.js | |
parent | 28b14ec47cfeb3c58e44f35170cdd8a9270aceae (diff) | |
download | jquery-ui-00d4beb0ca4a99933bb7e786a1dd50618c180a0b.tar.gz jquery-ui-00d4beb0ca4a99933bb7e786a1dd50618c180a0b.zip |
Widget: Create eventNamespace property instead of constantly rebuilding it.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r-- | ui/jquery.ui.widget.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index d5e68683e..22049cbb8 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -211,11 +211,12 @@ $.Widget.prototype = { _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 = $(); @@ -249,7 +250,7 @@ $.Widget.prototype = { // 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 ) @@ -258,14 +259,14 @@ $.Widget.prototype = { // 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" ); }, @@ -376,7 +377,7 @@ $.Widget.prototype = { } 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 ); |