Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13773 closed defect (fixed)

dojox.mvc._Container requires dojo.parser, so in mobile tests the dojox.mobile.parser and the dojo.parser are both used.

Reported by: Ed Chatelain Owned by: rahul
Priority: high Milestone: 1.7
Component: DojoX MVC Version: 1.7.0b1
Keywords: Cc: bill, ykami
Blocked By: Blocking:

Description

dojox.mvc._Container requires dojo.parser, so in mobile tests where the app loads the dojox.mobile.parser, both it and the dojo.parser are being loaded and called. We need a way to support only using the dojox.mobile.parser for dojox.mvc being used with mobile apps.

All of the mobile tests I have run work fine as it is now, (with the exception of one test failing on IE which does not seem to be related to this) but we should be able to avoid loading both parsers.

So I am looking for suggestions on how to prevent loading the dojo.parser in the mobile case. Thanks, Ed

Attachments (1)

mvc-13773.patch (111.1 KB) - added by Ed Chatelain 8 years ago.
Another updated patch.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by ykami

This looks like the same or similar issue to what Christophe raised here: http://thread.gmane.org/gmane.comp.web.dojo.devel/15633

If we were able to access an available (=already loaded) module's module return value, we could write the code without explicitly requiring the module, and let the user to do so.

comment:2 Changed 8 years ago by bill

The one API I know is:

try {
   // returns parser if loaded, otherwise throws
   parser = require("dojo/parser");
}catch(e){
   // if here, parser not loaded
}

We avoid this API (in particular the try/catch) when possible, but maybe it makes sense in this case, not sure.

comment:3 Changed 8 years ago by ykami

Use of try/catch for a normal control flow sounds like a pretty bad idea, but if it is ok to use, I would like to start using it too. :)

comment:4 Changed 8 years ago by Ed Chatelain

bill and ykami, thanks for the input, I was able to remove the dojo/parser from the define and add two try catch blocks to see if either parser is loaded, of course that solved the problem of both parsers getting loaded. All of the dojox/mvc tests ran successfully, but if someone had a testcase where they were not loading the parser explicitly, and were not using parseOnLoad: true, then their test would fail after this change, but I think that is ok. I can add a console.error indicating that the explicit require is needed for one of the parsers. I will attach a patch with this change. Please reply back if you see a problem with the patch, or if you think of a better way to handle this problem. Thanks Ed

Changed 8 years ago by Ed Chatelain

Attachment: mvc-13773.patch added

Another updated patch.

comment:5 Changed 8 years ago by Chris Mitchell

Resolution: fixed
Status: newclosed

In [26566]:

fixes #13773 allow use of mobile parser with dojox.mvc, thx edchat @ ibm \!strict

comment:6 Changed 8 years ago by Chris Mitchell

In [26567]:

fixes #13773 allow use of mobile parser with dojox.mvc, thx edchat @ ibm \!strict

comment:7 Changed 8 years ago by bill

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