Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

3 participants

@arian
Owner

Only concern is that it doesn't get prettier, don't know if there are better solutions?

@DimitarChristoff
Collaborator

excellent. thank you so much :)

@ibolmo
Owner

Ok I think I understand how this got all jumbled up.

Here's when we had the default: fade.start(o, arguments); 1;

Here's when we had the visibility problems with fade 2.

Finally we're trying to get this going because default case is no longer present.

I think this function would be simplified if we dealt with the visibility problems separately.

Here's an untested and probably not done work, but I think it's clear of the direction I'd like for us to go: https://gist.github.com/1389476

@ibolmo
Owner

@arian the only thing missing is just a spec that covers this special case. perhaps in a compat test.

@ibolmo
Owner

See: 45cd384

@ibolmo ibolmo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 16, 2011
  1. @arian
This page is out of date. Refresh to see the latest.
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');
Something went wrong with that request. Please try again.