Skip to content
This repository

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

Closed
wants to merge 1 commit into from

3 participants

Arian Stolwijk Dimitar Christoff Olmo Maldonado
Arian Stolwijk
Owner

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

Dimitar Christoff

excellent. thank you so much :)

Olmo Maldonado
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

Olmo Maldonado
Owner

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

Olmo Maldonado
Owner

See: 45cd384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 16, 2011
Arian Stolwijk arian Fixes #2125 - re-add undocumented from argument to Element.fade a7816d9
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 11 additions and 10 deletions. Show diff stats Hide diff stats

  1. +11 10 Source/Fx/Fx.Tween.js
21 Source/Fx/Fx.Tween.js
@@ -68,24 +68,25 @@ Element.implement({
68 68 },
69 69
70 70 fade: function(how){
71   - var fade = this.get('tween'), method, to, toggle;
72   - if (how == null) how = 'toggle';
73   - switch (how){
74   - case 'in': method = 'start'; to = 1; break;
75   - case 'out': method = 'start'; to = 0; break;
76   - case 'show': method = 'set'; to = 1; break;
77   - case 'hide': method = 'set'; to = 0; break;
  71 + var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
  72 + if (args[1] == null) args[1] = 'toggle';
  73 + switch (args[1]){
  74 + case 'in': method = 'start'; args[1] = 1; break;
  75 + case 'out': method = 'start'; args[1] = 0; break;
  76 + case 'show': method = 'set'; args[1] = 1; break;
  77 + case 'hide': method = 'set'; args[1] = 0; break;
78 78 case 'toggle':
79 79 var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
80 80 method = 'start';
81   - to = flag ? 0 : 1;
  81 + args[1] = flag ? 0 : 1;
82 82 this.store('fade:flag', !flag);
83 83 toggle = true;
84 84 break;
85   - default: method = 'start'; to = how;
  85 + default: method = 'start';
86 86 }
87 87 if (!toggle) this.eliminate('fade:flag');
88   - fade[method]('opacity', to);
  88 + fade[method].apply(fade, args);
  89 + var to = args[args.length - 1];
89 90 if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
90 91 else fade.chain(function(){
91 92 this.element.setStyle('visibility', 'hidden');

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.