Opened 12 years ago

Closed 12 years ago

#3922 closed defect (invalid)

Parse bug on widget variables set to null

Reported by: guest Owned by: bill
Priority: high Milestone: 0.9
Component: Parser Version: 0.9
Keywords: Cc: alex
Blocked By: Blocking:

Description

There is a soft error that occurs:

SyntaxError?: missing ) in parenthetical message=missing ) in parenthetical

I've found it happens when I have a parameter set to null in the dojo.declare (widget) :

myvariable: null, more variables....,

I then tried to set that variable as a param in the HTML:

<div dojoType="foo.bar" myvariable="Text Here..."></div>

When I changed it to : myvariable: "default",

The error went away.

Change History (2)

comment:1 Changed 12 years ago by Adam Peller

I believe for properties like this that we expect the parser to handle, you're supposed to have a default of the appropriate type, so a string should be initialized to "". Working as designed?

comment:2 Changed 12 years ago by bill

Cc: alex added; alex@… removed
Resolution: invalid
Status: newclosed

Right, that's intended behavior (perhaps not well documented). If the prototype defines the variable as null the attribute is interpreted as JSON, so myvariable="[1,2,3]" or myvariable="{name: 'bill', num: 123}" is valid but myvariable="..." is not.

Note: See TracTickets for help on using tickets.