Skip to content

Instantly share code, notes, and snippets.

@petersendidit
Created May 25, 2014 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petersendidit/4a4cb89654e88433eecd to your computer and use it in GitHub Desktop.
Save petersendidit/4a4cb89654e88433eecd to your computer and use it in GitHub Desktop.
Diff to handle bug described in http://bugs.jqueryui.com/ticket/10056
diff --git a/ui/widget.js b/ui/widget.js
index b86232b..e4a1426 100644
--- a/ui/widget.js
+++ b/ui/widget.js
@@ -434,9 +434,21 @@ $.Widget.prototype = {
});
},
- _off: function( element, eventName ) {
+ _off: function( elements, eventName ) {
+ var instance = this;
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
- element.unbind( eventName ).undelegate( eventName );
+ elements.unbind( eventName ).undelegate( eventName );
+ function offHelper( list, element ) {
+ var index = list.index( element );
+ if ( index !== -1 ) {
+ list.splice( index, 1 );
+ }
+ }
+ elements.each(function( arrayIndex, element ) {
+ offHelper( instance.bindings, element );
+ offHelper( instance.hoverable, element );
+ offHelper( instance.focusable, element );
+ });
},
_delay: function( handler, delay ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment