aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2012-06-10 20:55:04 +0200
committerScott González <scott.gonzalez@gmail.com>2012-06-14 10:39:41 -0400
commit28b14ec47cfeb3c58e44f35170cdd8a9270aceae (patch)
tree57b21aac4c95f31f6fe4677d271898e95f7c8e2c /ui
parent4a215e3f7215e17e0010d9439a78f74fd2c2fd66 (diff)
downloadjquery-ui-28b14ec47cfeb3c58e44f35170cdd8a9270aceae.tar.gz
jquery-ui-28b14ec47cfeb3c58e44f35170cdd8a9270aceae.zip
Generate a uuid for each widget for unique namespaces. Fixes #8385 - Widget: _bind() on elements such as document are dangerous
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.widget.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 410b7003a..d5e68683e 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -9,7 +9,8 @@
*/
(function( $, undefined ) {
-var slice = Array.prototype.slice,
+var uuid = 0,
+ slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
@@ -214,6 +215,7 @@ $.Widget.prototype = {
this.options,
this._getCreateOptions(),
options );
+ this.uuid = uuid++;
this.bindings = $();
this.hoverable = $();
@@ -247,7 +249,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 )
+ .unbind( "." + this.widgetName + this.uuid )
// 1.9 BC for #7810
// TODO remove dual storage
.removeData( this.widgetName )
@@ -256,14 +258,14 @@ $.Widget.prototype = {
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
this.widget()
- .unbind( "." + this.widgetName )
+ .unbind( "." + this.widgetName + this.uuid )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
// clean up events and states
- this.bindings.unbind( "." + this.widgetName );
+ this.bindings.unbind( "." + this.widgetName + this.uuid );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
},
@@ -374,7 +376,7 @@ $.Widget.prototype = {
}
var match = event.match( /^(\w+)\s*(.*)$/ ),
- eventName = match[1] + "." + instance.widgetName,
+ eventName = match[1] + "." + instance.widgetName + instance.uuid,
selector = match[2];
if ( selector ) {
instance.widget().delegate( selector, eventName, handlerProxy );