Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14567 closed defect (fixed)

dojox.mobile.parser handles arrays differently than dojo.parser

Reported by: Javier Pedemonte Owned by: ykami
Priority: high Milestone: 1.8
Component: DojoX Mobile Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

dojo.parser expects array attributes in the form of "'A','B','C','D','E'", using split() to generate the array.

On the other hand, dojox.mobile.parser expects array attrs in the form of "['A','B','C','D','E']", using fromJson() to generate the array.

This leads to an issue when trying to load a SpinWheel. To see for yourself, edit the test_SpinWheel-custom.html file and replace "dojox.mobile.parser" with "dojo.parser". Load and you'll see that the some of the SpinWheelSlots are rendered incorrectly.

Change History (8)

comment:1 Changed 8 years ago by bill

Description: modified (diff)

Are you talking about the slotClasses and slotProps parameters?

comment:2 Changed 8 years ago by Javier Pedemonte

The labels attribute to SpinWheelSlot?.

comment:3 Changed 8 years ago by bill

Ah I see. Since it's declared as an array (ie, default value is []), I'd say that dojox.mobile.parser needs to be updated to work like dojo.parser.

If it was declared as null then JSON for the value would be appropriate.

comment:4 Changed 8 years ago by ykami

Bill, I tried "'A','B','C','D','E'" using dojo.parser. But the resulted value seems to be ["'A'","'B'","'C'","'D'","'E'"]. (Looks like we need to give "A,B,C,D,E" to get our expected ['A','B','C','D','E']) Is it the expected behavior?

jhpedemonte, I recommend you specify like this:

data-dojo-props="labels:['A','B','C','D','E']"

Both parsers should handle it in the same way.

comment:5 Changed 8 years ago by Javier Pedemonte

The problem isn't with which array format I'm using. The problem is that all the docs for SpinWheel? and SpinWheelSlot? show an array format for labels that works with dojox.mobile.parser but not with dojo.parser.

ykami, if that is the answer, then that means you guys have to update the mobile documentation with the correct array format.

comment:6 in reply to:  4 Changed 8 years ago by bill

Replying to ykami:

Bill, I tried "'A','B','C','D','E'" using dojo.parser. But the resulted value seems to be ["'A'","'B'","'C'","'D'","'E'"]. (Looks like we need to give "A,B,C,D,E" to get our expected ['A','B','C','D','E']) Is it the expected behavior?

Yup, that's the expected behavior. All dojo.parser supports (outside of data-dojo-props) is arrays of simple strings (i.e. strings that don't contain commas).

Last edited 8 years ago by bill (previous) (diff)

comment:7 Changed 8 years ago by ykami

Resolution: fixed
Status: newclosed

In [27511]:

Fixes #14567 !strict Array type property value should be like "A,B,C", not ['A','B','C']. Thanks, jhpedemonte and Bill.

comment:8 Changed 8 years ago by ykami

Milestone: tbd1.8
Note: See TracTickets for help on using tickets.