aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 31328a455..294e321a9 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -195,6 +195,12 @@ $.Widget.prototype = {
if ( element !== this ) {
$.data( element, this.widgetName, this );
this._bind({ remove: "destroy" });
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}
this._create();
@@ -270,10 +276,11 @@ $.Widget.prototype = {
return this;
},
_setOptions: function( options ) {
- var that = this;
- $.each( options, function( key, value ) {
- that._setOption( key, value );
- });
+ var key;
+
+ for ( key in options ) {
+ this._setOption( key, options[ key ] );
+ }
return this;
},
@@ -386,6 +393,10 @@ $.Widget.prototype = {
}
}
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[0];
+
this.element.trigger( event, data );
args = $.isArray( data ) ?