aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-11-18 17:13:28 +0100
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-11-18 17:13:28 +0100
commitd6e4d4705d3d3be01ab92ea4f07a52a59ba10b5a (patch)
tree185bf6282643a667a1e69837b106249156f71952 /ui/jquery.ui.widget.js
parent26603de5bafb4fe9e824b28d8f799ed0f7e0604f (diff)
parent66f9e12797c16d8fa9078f45401f08f0f200e1bc (diff)
downloadjquery-ui-d6e4d4705d3d3be01ab92ea4f07a52a59ba10b5a.tar.gz
jquery-ui-d6e4d4705d3d3be01ab92ea4f07a52a59ba10b5a.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 31328a455..53cde389e 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -62,11 +62,11 @@ $.widget = function( name, base, prototype ) {
$.each( prototype, function( prop, value ) {
if ( $.isFunction( value ) ) {
prototype[ prop ] = (function() {
- var _super = function( method ) {
- return base.prototype[ method ].apply( this, slice.call( arguments, 1 ) );
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
};
- var _superApply = function( method, args ) {
- return base.prototype[ method ].apply( this, args );
+ var _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
};
return function() {
var __super = this._super,
@@ -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 ) ?