#3338 closed defect (fixed)
dojo.fadeOut and dojo.fadeIn have incorrect documentation and incorrect internal implementation for array of DOM nodes
Reported by: | bradneuberg | Owned by: | Bryan Forbes |
---|---|---|---|
Priority: | high | Milestone: | 0.9beta |
Component: | lfx | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I am porting the Dojo Storage test page, at dojox/storage/tests/test_storage.html to the new Dojo 0.9 system. I use the following call:
dojo.fadeOut({nodes: status, duration: 2000}).play()
which results in the following exception:
Object cannot be created in this context" code: "9 undefined
The problem comes down to this call in the Dojo FX code:
this.fire("beforeBegin");
in the method dojo._Animation.play(). The exact issue is inside the fire method:
if(this[evt]){
this[evt].apply(this, args []);
}
Where we have an evt, "beforeBegin", but 'args' is undefined. I believe the apply method calls through to a listener, but we never defined a beforeBegin callback in my Test Storage page.
Attachments (1)
Change History (6)
comment:1 Changed 13 years ago by
Summary: | dojo.fadeOut throws exception → dojo.fadeOut and dojo.fadeIn have incorrect documentation and incorrect internal implementation for array of DOM nodes |
---|
comment:2 follow-up: 3 Changed 13 years ago by
Component: | Core → lfx |
---|---|
Milestone: | → 0.9beta |
Owner: | changed from anonymous to Bryan Forbes |
Changed 13 years ago by
Attachment: | fx-inline-doc.patch added |
---|
patch to mirror _current_ behavior of _base fx and dojo.fx with inline docs
comment:3 Changed 13 years ago by
Replying to peller:
actually, all the FX functions still refer to Nodes but use a unified args object for mixins.
patch submitted [cla, phiggins] to fix inline docs.
comment:4 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The actual source of this bug is either an error in documentation or an error in implementation. In the method dojo.fadeOut, the documentation says the following for the 'nodes' property that can be passed in:
dojo.fadeOut = function(/*Object*/ args){
It says to pass in 'nodes' as an individual DOM node or an array of DOM Nodes. However, if we dig down into the dojo._fade method, we see the following:
args.node = dojo.byId(args.node);
Notice that it is 'args.node' not 'args.nodes'; this also holds true for the dojo.connect on beforeBegin, which uses 'fArgs.node' not 'fArgs.nodes'.
So, internally the system looks like it knows how to work with just one DOM Node, and the way you pass things in is with the argument 'node' not 'nodes' plural. I don't want to just change the word to be plural, because I also suspect that the internal machinery doesn't know how to deal with an array, which needs to be baked in.
Note that the dojo.fadeIn bugs suffers from the same issues.
Changing title of bug.