#1358 closed defect (invalid)
dojo.hostenv.loadPath Requires dojo.widget.* Bug
Reported by: | Owned by: | James Burke | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Loader | Version: | 0.3 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
I have this in a script block after the script blocks that load dojo and jsunit:
dojo.require('dojo.widget.*'); dojo.hostenv.loadPath("../../src/main/js/Validators.js");
Validators.js just has this in it:
dojo.declare("V", null, { });
If I comment out
dojo.require('dojo.widget.*');
I can no longer create a V class, so
function testVCreation() { v= new V; }
will not pass.
Seems like loadPath should be independent of widgets...
If you need to see template examples Just search for my name and various bug reports / enhancements will come up with the standard templates I use.
Change History (4)
comment:1 Changed 15 years ago by
Component: | General → PackageSystem |
---|---|
Milestone: | → 0.4 |
Owner: | changed from anonymous to alex |
comment:2 Changed 15 years ago by
Owner: | changed from alex to James Burke |
---|
comment:3 Changed 15 years ago by
Cc: | [email protected]… added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
It looks like you are not doing a dojo.require("dojo.lang.declare"); inside Validators.js (put it at the top of the file). dojo.declare is not something that is automatically available in dojo, you have to load the pacakge for it. By doing a dojo.require("dojo.widget.*"), that is loading dojo.lang.declare.
In general, if you call any dojo.* methods in a file, be sure to put the corresponding dojo.require() statements at the top of the file (in this case Validators.js).
Also, it is suggested that you do not call dojo.hostenv.loadPath() directly. dojo.hostenv.* methods are generally considered "private" to dojo, although this is not strictly enforced. But I suggest using the normal dojo.require/provide syntax to load the files.
Marking the bug as resolved/invalid, but feel free to add more information or reopen if doing the dojo.require("dojo.lang.declare"); does not work.
Stealing io and package bugs from Alex. Holler if you want it back.