Opened 12 years ago

Closed 11 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)

dojo-fx-bug.html (934 bytes) - added by guest 12 years ago.
See the bug in action!

Download all attachments as: .zip

Change History (12)

Changed 12 years ago by guest

Attachment: dojo-fx-bug.html added

See the bug in action!

comment:1 Changed 12 years ago by guest

I've posted the bug online so you can see it "work", not just the src in trac.

http://stilleye.com/z/dojo-fx-bug.html

comment:2 Changed 11 years ago by bill

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 11 years ago by bitranch

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 11 years ago by dylan

Milestone: tbd1.2

comment:5 Changed 11 years ago by bill

Milestone: 1.21.3

comment:6 Changed 11 years ago by dante

Milestone: 1.3future
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 11 years ago by ashendw

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 11 years ago by ashendw

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:9 Changed 11 years ago by Matt Sgarlata

That change works great for me. Thanks!

comment:10 Changed 11 years ago by Eugene Lazutkin

Owner: changed from eugene to Eugene Lazutkin

comment:11 Changed 11 years ago by Eugene Lazutkin

Milestone: future1.3
Resolution: fixed
Status: newclosed

Fixed in [16040].

Note: See TracTickets for help on using tickets.