Opened 13 years ago
Closed 12 years ago
#6490 closed defect (fixed)
Using dojo.fx.combine in dojo.fx.chain throws errors
Reported by: | guest | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | fx | Version: | 1.1.0 |
Keywords: | combine chain | Cc: | |
Blocked By: | Blocking: |
Description
When I do this:
var fx = []; var d = 1500; fx.push(dojo.fadeOut({ node:"a", duration:d })); fx.push(dojo.fadeOut({ node:"b", duration:d })); dojo.fx.chain([ dojo.fx.combine(fx), dojo.fadeOut({ node:"c", duration:d }) ]).play();
I get a TypeError?:
TypeError: second argument to Function.prototype.apply must be an arraydojo.xd.js
This only happens when I pass dojo.fx.combine
as an argument. Stepping through the call, it appears that the arguments are getting "unwrapped" too many times somehow.
The animation still runs fine (the error gets squashed somewhere) but the error shows up in Firebug which is annoying in the least (it happens once per onAnimate call!).
Attachments (1)
Change History (12)
Changed 13 years ago by
Attachment: | dojo-fx-bug.html added |
---|
comment:1 Changed 13 years ago by
I've posted the bug online so you can see it "work", not just the src in trac.
comment:2 Changed 13 years ago by
Milestone: | → tbd |
---|
mark all (open) tickets w/blank milestones to be "tbd"; their milestones need to be set to a version number or to "future"
comment:3 Changed 13 years ago by
This error also occurs when using NodeList?-fx. For example, with this (assuming a class="foo" exists on some node in the document):
dojo.fx.chain([ dojo.query(".foo").fadeOut(), dojo.query(".foo).fadeIn() ]).play();
The animation runs, followed by a exception:
exception in animation handler for: onAnimate TypeError: second argument to Function.prototype.apply must be an array
NodeList?-fx builds its animation using dojo.fx.combine, so this is obviously exercising the same bug.
(This is with svn head as of today.)
comment:4 Changed 13 years ago by
Milestone: | tbd → 1.2 |
---|
comment:5 Changed 12 years ago by
Milestone: | 1.2 → 1.3 |
---|
comment:6 Changed 12 years ago by
Milestone: | 1.3 → future |
---|---|
Owner: | changed from Bryan Forbes to eugene |
uhop - you did the current chain/combine implementation. Reassign back to me if you are unable to spend time on this. I've looked briefly, and nothing apparent jumped out at me.
comment:7 Changed 12 years ago by
Just noticed this bug in some test code I was playing with.
In dojo/fx.js, the _baseObj._fire method is pushing through a numeric value to the onAnimate event rather than an args array. The bug can be made quiet by putting an arrayLike check before calling the "this[evt].apply(this,args)" but not sure why a non array is getting in there yet.
comment:8 Changed 12 years ago by
Found it to be the way events are hitched in the _combine.
File dojo/fx.js
problem line:
this._connects.push(dojo.connect(this._pseudoAnimation, evt, dojo.hitch(this, "_fire", evt)));
rewrote it to:
this._connects.push(dojo.connect(this._pseudoAnimation, evt, dojo.hitch(this, function(){this._fire(evt,arguments)})));
Although it's less elegant, argument is passed correctly.
comment:10 Changed 12 years ago by
Owner: | changed from eugene to Eugene Lazutkin |
---|
comment:11 Changed 12 years ago by
Milestone: | future → 1.3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in [16040].
See the bug in action!