Opened 10 years ago

Closed 10 years ago

#10951 closed defect (fixed)

dojo.parser.instantiate regression with <input dojoType="">

Reported by: attila.lendvai Owned by: bill
Priority: high Milestone: 1.5
Component: Parser Version: 1.4.0
Keywords: instantiate Cc: attila.lendvai@…
Blocked By: Blocking:

Description

this line came somwhere between 20964 and 21682:

type = obj.type || (dp._attrName in mixin ? mixin[dp._attrName] : node.getAttribute(dp._attrName))

it will pick up "text" as type on <input dojoType="dijit.foo"/> which then fails later.

changing the node to a div fixes the problem, but then no graceful fallback...

Change History (6)

comment:1 Changed 10 years ago by bill

Component: GeneralParser
Owner: changed from anonymous to bill

I've never heard of a function called dojo.instantiate(), I guess you are talking about the instantiate() method in the parser?

I can see that it will pick up the deafult text attribute but please attach a test case, using the "Attach file" button, as to how that "fails later".

comment:2 Changed 10 years ago by attila.lendvai

oh, right, it's dojo.parser.instantiate, sorry!

the change that introduced the new behavior is rev 21608

i can't easily put together a test because i don't have the environment (i'm generating everything including js from a lisp web server).

but what i do is to load dojo with:

djConfig = { parseOnLoad: false };

then render all widgets with

<input id="uniqueid1" dojoType="dijit.something">

and then render one last onload script at the end that

dojo.parser.instantiate(["uniqueid1", ...])

if you could extend one of the parser tests with this scheme i would be grateful.

comment:3 Changed 10 years ago by bill

Milestone: tbd1.5
Status: newassigned
Summary: dojo.instantiate regression with <input dojoType="">dojo.parser.instantiate regression with <input dojoType="">

Hmm, OK, so you are calling instantiate directly. I tried to maintain backwards compatibility in that method although as you point out there are no unit tests for it.

I need to know what exactly what the failure is... you seem to be implying that the programmatic instantiate() call doesn't work, but what happens exactly? It throws an exception? I guess that it's a confusion that it's trying to lookup "text" as a dojoType (like dijit.form.Button), but of course there's no such class.

comment:4 Changed 10 years ago by attila.lendvai

damn, maybe i should get some sleep... i *was* planning to paste it here :)

yes, this is the type lookup failure when called with "text".

i call instantiate programmatically because i'm sending down redrawn dirty parts of the page in ajax answers, and when they contain dijit widgets, then i need to take care of them.

Instantiating (and destroying previous versions of) the following widgets  ["_stw881"]

wui.io.process-ajax-network-error called with response  Error: Could not load class 'text'. Did you spell the name correctly and use a full path, like 'dijit.form.Button'? , ioArgs  
Object

/static/wui/dojo/dojo-21741/dojo/dojo.js.uncompressed.js:3936 Error: Could not load class 'text'. Did you spell the name correctly and use a full path, like 'dijit.form.Button'?

comment:5 Changed 10 years ago by attila.lendvai

fyi, i've switched the order of the
(or) operator to try obj.dojoType before obj.type, and things work as expected (in my case).

comment:6 Changed 10 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [21866]) fix backwards compatibility issue for dojo.parser.instantiate() on nodes that specify type (like <input type=...>), refs #10402, fixes #10951 !strict.

Note: See TracTickets for help on using tickets.