aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-01-14 15:52:03 -0500
committerScott González <scott.gonzalez@gmail.com>2011-01-14 15:52:03 -0500
commit25dae411bc7bb0e618db4df062fa2f1c08bfcc77 (patch)
tree66b910c6c697491a4c47b4ebede9000c24f5d454 /ui/jquery.ui.widget.js
parentf711e362cd998f956a21d8e2ef455aca329fd0d7 (diff)
downloadjquery-ui-25dae411bc7bb0e618db4df062fa2f1c08bfcc77.tar.gz
jquery-ui-25dae411bc7bb0e618db4df062fa2f1c08bfcc77.zip
Widget: Added _super() and _superApply() methods. Fixes #6861 - Widget: Add _super() and _superApply() for easy access to parent methods.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 82b88ea71..444367423 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -9,6 +9,8 @@
*/
(function( $, undefined ) {
+var slice = Array.prototype.slice;
+
var _cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
@@ -50,7 +52,8 @@ $.widget = function( name, base, prototype ) {
namespace: namespace,
widgetName: name,
widgetEventPrefix: name,
- widgetBaseClass: fullName
+ widgetBaseClass: fullName,
+ base: base.prototype
}, prototype );
$.widget.bridge( name, $[ namespace ][ name ] );
@@ -59,7 +62,7 @@ $.widget = function( name, base, prototype ) {
$.widget.bridge = function( name, object ) {
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
- args = Array.prototype.slice.call( arguments, 1 ),
+ args = slice.call( arguments, 1 ),
returnValue = this;
// allow multiple hashes to be passed on init
@@ -141,6 +144,13 @@ $.Widget.prototype = {
_create: function() {},
_init: function() {},
+ _super: function( method ) {
+ return this.base[ method ].apply( this, slice.call( arguments, 1 ) );
+ },
+ _superApply: function( method, args ) {
+ return this.base[ method ].apply( this, args );
+ },
+
destroy: function() {
this.element
.unbind( "." + this.widgetName )