dojo / dojox

Dojo 1 - extras library. Please submit bugs to https://bugs.dojotoolkit.org/
https://dojotoolkit.org/
Other
151 stars 229 forks source link

series.kwArgs is undefined in charting/widget/Chart #303

Open divido opened 5 years ago

divido commented 5 years ago

I believe this is a duplicate of https://bugs.dojotoolkit.org/ticket/19029

However, I wanted to add a few comments. (Sorry if this isn't the right forum for these comments).

First, I use programmatic style, and the bug exists there as well (not only declarative style, as the trac ticket suggests). Furthermore, the root of the cause was introduced by dojo 1.11, _base/lang.js. In there, the definition of "isArray" was altered to use the built in Array.isArray method instead of the old way that checked for "instanceof Array".

This new technique of checking for Arrays means that NodeLists are not considered arrays. When charting/widget/Chart.js's buildRendering() is invoked, it scans for data series using dojo/query. Later, it will "foldl" those elements. foldl (dojox/lang/functional/fold.js) does a different behavior for arrays vs. objects. As of v1.11, NodeLists (as returned by query) are considered objects. It therefore invokes the callback with 0 (the value of the length attribute). Chart does not expect this.

I'm using firefox 60.3 on Windows 7.

jason0x43 commented 4 years ago

Updating foldl to use lang.isArrayLike rather than lang.isArray looks like a possible fix.