From: Jörn Zaefferer Date: Fri, 18 Nov 2011 11:19:32 +0000 (+0100) Subject: Widget: Remove method argument from _super and _superApply. Was a left-over from... X-Git-Tag: 1.9m7~137 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=66f9e12797c16d8fa9078f45401f08f0f200e1bc;p=jquery-ui.git Widget: Remove method argument from _super and _superApply. Was a left-over from first implementation, not necessary anymore. --- diff --git a/demos/widget/default.html b/demos/widget/default.html index 45cbe3298..3b812ef8e 100644 --- a/demos/widget/default.html +++ b/demos/widget/default.html @@ -106,7 +106,7 @@ // always refresh when changing options _setOptions: function() { // _super and _superApply handle keeping the right this-context - this._superApply( "_setOptions", arguments ); + this._superApply( arguments ); this._refresh(); }, @@ -116,7 +116,7 @@ if ( /red|green|blue/.test(key) && (value < 0 || value > 255) ) { return; } - this._super( "_setOption", key, value ); + this._super( key, value ); } }); diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 0510da4b4..edf1ae0fc 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -346,7 +346,7 @@ test( "._super()", function() { same( this, instance, "this is correct in testWidget2" ); same( a, 5, "parameter passed to testWidget2" ); same( b, 10, "parameter passed to testWidget2" ); - return this._super( "method", a, b*2 ); + return this._super( a, b*2 ); } }); @@ -354,7 +354,7 @@ test( "._super()", function() { method: function( a ) { same( this, instance, "this is correct in testWidget3" ); same( a, 5, "parameter passed to testWidget3" ); - var ret = this._super( "method", a, a*2 ); + var ret = this._super( a, a*2 ); same( ret, 25, "super returned value" ); } }); @@ -382,7 +382,7 @@ test( "._superApply()", function() { same( this, instance, "this is correct in testWidget2" ); same( a, 5, "parameter passed to testWidget2" ); same( b, 10, "second parameter passed to testWidget2" ); - return this._superApply( "method", arguments ); + return this._superApply( arguments ); } }); @@ -391,7 +391,7 @@ test( "._superApply()", function() { same( this, instance, "this is correct in testWidget3" ); same( a, 5, "parameter passed to testWidget3" ); same( b, 10, "second parameter passed to testWidget3" ); - var ret = this._superApply( "method", arguments ); + var ret = this._superApply( arguments ); same( ret, 15, "super returned value" ); } }); @@ -1031,7 +1031,7 @@ test( "redefine", function() { $.widget( "ui.testWidget", $.ui.testWidget, { method: function( str ) { equal( str, "foo", "new invoked with correct parameter" ); - this._super( "method", "bar" ); + this._super(); } }); diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 8289ee81b..127099d59 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -12,7 +12,7 @@ * jquery.ui.widget.js */ (function( $, undefined ) { - + // TODO: use ui-accordion-header-active class and fix styling $.widget( "ui.accordion", { version: "@VERSION", @@ -167,7 +167,7 @@ $.widget( "ui.accordion", { this._setupEvents( value ); } - this._super( "_setOption", key, value ); + this._super( key, value ); // setting collapsible: false while collapsed; open first panel if ( key === "collapsible" && !value && this.options.active === false ) { @@ -244,7 +244,7 @@ $.widget( "ui.accordion", { if ( position === "absolute" || position === "fixed" ) { return; } - maxHeight -= elem.outerHeight( true ); + maxHeight -= elem.outerHeight( true ); }); if ( overflow ) { parent.css( "overflow", overflow ); @@ -437,7 +437,7 @@ $.extend( $.ui.accordion, { options.prevHide.stop( true, true ); options.toHide = options.prevShow; } - + var showOverflow = options.toShow.css( "overflow" ), hideOverflow = options.toHide.css( "overflow" ), percentDone = 0, @@ -449,7 +449,7 @@ $.extend( $.ui.accordion, { easing: "swing", duration: 300 }, options, additions ); - + options.widget.lastToggle = options; if ( !options.toHide.size() ) { diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 4e528dce4..9871b52d7 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -291,7 +291,7 @@ $.widget( "ui.autocomplete", { }, _setOption: function( key, value ) { - this._super( "_setOption", key, value ); + this._super( key, value ); if ( key === "source" ) { this._initSource(); } diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 20eb2ca89..18a950563 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -269,7 +269,7 @@ $.widget( "ui.button", { }, _setOption: function( key, value ) { - this._super( "_setOption", key, value ); + this._super( key, value ); if ( key === "disabled" ) { if ( value ) { this.element.prop( "disabled", true ); @@ -326,7 +326,7 @@ $.widget( "ui.button", { .text(), icons = this.options.icons, multipleIcons = icons.primary && icons.secondary, - buttonClasses = []; + buttonClasses = []; if ( icons.primary || icons.secondary ) { if ( this.options.text ) { @@ -365,7 +365,7 @@ $.widget( "ui.buttonset", { _create: function() { this.element.addClass( "ui-buttonset" ); }, - + _init: function() { this.refresh(); }, @@ -375,12 +375,12 @@ $.widget( "ui.buttonset", { this.buttons.button( "option", key, value ); } - this._super( "_setOption", key, value ); + this._super( key, value ); }, - + refresh: function() { var rtl = this.element.css( "direction" ) === "rtl"; - + this.buttons = this.element.find( this.options.items ) .filter( ":ui-button" ) .button( "refresh" ) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 9c9a9b6fc..49ef8f64b 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -169,7 +169,7 @@ $.widget("ui.dialog", { _destroy: function() { var self = this; - + if ( self.overlay ) { self.overlay.destroy(); } @@ -196,7 +196,7 @@ $.widget("ui.dialog", { var self = this, maxZ, thisZ; - + if ( false === self._trigger( "beforeClose", event ) ) { return; } @@ -493,7 +493,7 @@ $.widget("ui.dialog", { at: myAt.join( " " ), offset: offset.join( " " ) }; - } + } position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); } else { @@ -518,7 +518,7 @@ $.widget("ui.dialog", { $.each( options, function( key, value ) { self._setOption( key, value ); - + if ( key in sizeRelatedOptions ) { resize = true; } @@ -564,7 +564,7 @@ $.widget("ui.dialog", { if ( isDraggable && !value ) { uiDialog.draggable( "destroy" ); } - + if ( !isDraggable && value ) { self._makeDraggable(); } @@ -596,7 +596,7 @@ $.widget("ui.dialog", { break; } - this._super( "_setOption", key, value ); + this._super( key, value ); }, _size: function() { @@ -627,7 +627,7 @@ $.widget("ui.dialog", { }) .height(); minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); - + if ( options.height === "auto" ) { // only needed for IE6 support if ( $.support.minHeight ) { @@ -704,7 +704,7 @@ $.extend( $.ui.dialog.overlay, { $( document ).bind( "keydown.dialog-overlay", function( event ) { if ( dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && event.keyCode === $.ui.keyCode.ESCAPE ) { - + dialog.close( event ); event.preventDefault(); } diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index 187470681..f754f61a4 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -68,7 +68,7 @@ $.widget( "ui.progressbar", { } } - this._super( "_setOption", key, value ); + this._super( key, value ); }, _value: function() { diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 5623722db..b78b4dbea 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -318,7 +318,7 @@ $.widget( "ui.spinner", { return; } - this._super( "_setOption", key, value ); + this._super( key, value ); if ( key === "disabled" ) { if ( value ) { @@ -332,7 +332,7 @@ $.widget( "ui.spinner", { }, _setOptions: modifier(function( options ) { - this._super( "_setOptions", options ); + this._super( options ); this._value( this.element.val() ); }), @@ -387,7 +387,7 @@ $.widget( "ui.spinner", { .removeAttr( "aria-valuemin" ) .removeAttr( "aria-valuemax" ) .removeAttr( "aria-valuenow" ); - this._super( "destroy" ); + this._super(); this.uiSpinner.replaceWith( this.element ); }, diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 5eaab1aae..5c9fc1326 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -136,7 +136,7 @@ $.widget( "ui.tabs", { return; } - this._super( "_setOption", key, value); + this._super( key, value); // setting collapsible: false while collapsed; open first panel if ( key === "collapsible" && !value && this.options.active === false ) { @@ -323,7 +323,7 @@ $.widget( "ui.tabs", { if ( tab.hasClass( "ui-state-disabled" ) || // tab is already loading - tab.hasClass( "ui-tabs-loading" ) || + tab.hasClass( "ui-tabs-loading" ) || // can't switch durning an animation that.running || // click on active header, but not collapsible @@ -555,9 +555,9 @@ $.widget( "ui.tabs", { if ( status === "abort" ) { self.panels.stop( false, true ); } - + self.lis.eq( index ).removeClass( "ui-tabs-loading" ); - + if ( jqXHR === self.xhr ) { delete self.xhr; } @@ -674,13 +674,13 @@ if ( $.uiBackCompat !== false ) { spinner: "Loading…" }, _create: function() { - this._super( "_create" ); + this._super(); this._bind({ tabsbeforeload: function( event, ui ) { if ( !this.options.spinner ) { return; } - + var span = ui.tab.find( "span" ), html = span.html(); span.html( this.options.spinner ); @@ -973,7 +973,7 @@ if ( $.uiBackCompat !== false ) { } options.active = active; } - this._super( "_create" ); + this._super(); }, _cookie: function( active ) { var cookie = [ this.cookie || @@ -985,19 +985,19 @@ if ( $.uiBackCompat !== false ) { return $.cookie.apply( null, cookie ); }, _refresh: function() { - this._super( "_refresh" ); + this._super(); if ( this.options.cookie ) { this._cookie( this.options.active, this.options.cookie ); } }, _eventHandler: function( event ) { - this._superApply( "_eventHandler", arguments ); + this._superApply( arguments ); if ( this.options.cookie ) { this._cookie( this.options.active, this.options.cookie ); } }, _destroy: function() { - this._super( "_destroy" ); + this._super(); if ( this.options.cookie ) { this._cookie( null, this.options.cookie ); } @@ -1012,7 +1012,7 @@ if ( $.uiBackCompat !== false ) { _data.panel = _data.panel[ 0 ]; _data.tab = _data.tab[ 0 ]; } - return this._super( "_trigger", type, event, _data ); + return this._super( type, event, _data ); } }); } diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 35b6f9b50..a006f3bf7 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -54,7 +54,7 @@ $.widget( "ui.tooltip", { // disable element style changes return; } - this._super( "_setOption", key, value ); + this._super( key, value ); }, _disable: function() { diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 294e321a9..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,