aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2012-10-24 10:41:48 -0400
committerJörn Zaefferer <joern.zaefferer@gmail.com>2012-10-24 10:42:21 -0400
commit721a4b4ae027b140ca280bbc8fb8ed334081b184 (patch)
tree26d6d48d83d125ed2ef0c778e23cb863b4eba843 /ui/jquery.ui.widget.js
parent848ab485839b6dd26f2b6c6680141d95cab32ceb (diff)
downloadjquery-ui-721a4b4ae027b140ca280bbc8fb8ed334081b184.tar.gz
jquery-ui-721a4b4ae027b140ca280bbc8fb8ed334081b184.zip
Widget: Fix _on to use element argument for delegated events. Fixes #8658 - Widget: this._on delegates using instance.widget() instead of passed element
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index eea12c471..a6eae6580 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -362,17 +362,19 @@ $.Widget.prototype = {
},
_on: function( element, handlers ) {
+ var delegateElement,
+ instance = this;
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
+ delegateElement = this.widget();
} else {
// accept selectors, DOM elements
- element = $( element );
+ element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
- var instance = this;
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
@@ -396,7 +398,7 @@ $.Widget.prototype = {
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
- instance.widget().delegate( selector, eventName, handlerProxy );
+ delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}