Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes #2125 - re-add undocumented from argument to Element.fade

  • Loading branch information...
commit a7816d99ef3007d350aeead806bdb8d773aaf70c 1 parent 094428d
@arian authored
Showing with 11 additions and 10 deletions.
  1. +11 −10 Source/Fx/Fx.Tween.js
View
21 Source/Fx/Fx.Tween.js
@@ -68,24 +68,25 @@ Element.implement({
},
fade: function(how){
- var fade = this.get('tween'), method, to, toggle;
- if (how == null) how = 'toggle';
- switch (how){
- case 'in': method = 'start'; to = 1; break;
- case 'out': method = 'start'; to = 0; break;
- case 'show': method = 'set'; to = 1; break;
- case 'hide': method = 'set'; to = 0; break;
+ var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
+ if (args[1] == null) args[1] = 'toggle';
+ switch (args[1]){
+ case 'in': method = 'start'; args[1] = 1; break;
+ case 'out': method = 'start'; args[1] = 0; break;
+ case 'show': method = 'set'; args[1] = 1; break;
+ case 'hide': method = 'set'; args[1] = 0; break;
case 'toggle':
var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
method = 'start';
- to = flag ? 0 : 1;
+ args[1] = flag ? 0 : 1;
this.store('fade:flag', !flag);
toggle = true;
break;
- default: method = 'start'; to = how;
+ default: method = 'start';
}
if (!toggle) this.eliminate('fade:flag');
- fade[method]('opacity', to);
+ fade[method].apply(fade, args);
+ var to = args[args.length - 1];
if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
else fade.chain(function(){
this.element.setStyle('visibility', 'hidden');

0 comments on commit a7816d9

Please sign in to comment.
Something went wrong with that request. Please try again.