#10159 closed defect (fixed)
baseUrl not discovered on dynamic load of dojo
Reported by: | Mike Wilson | Owned by: | James Burke |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Loader | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
When adding Dojo after page load (through head.appendChild(script)) and running from source, dojo.require() fails because dojo.baseDir is undefined. Typically this results in a 404 on dojo._base.lang which is the first required() resource.
The bug is reproducable with the following example from http://docs.dojocampus.org/djConfig#id8:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title></title> </head> <body> <script type="text/javascript"> var djConfig = { afterOnLoad: true }; window.onload = function(){ var d = document.getElementsByTagName("head")[0].appendChild(document.createElement('script')); d.src = "dojo-1.3.2-src/dojo/dojo.js"; d.type = "text/javascript"; } </script> </body> </html>
The bug applies both to 1.3.2 and HEAD.
Change History (6)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Owner: | changed from alex to James Burke |
---|
comment:3 Changed 11 years ago by
djConfig.afterOnLoad was not designed to work with a non-built dojo.js file. I just updated the dojocampus docs to add that to the djConfig.afterOnLoad section and will update the API docs in source now, then close out the ticket.
comment:4 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|
comment:6 Changed 11 years ago by
It would be a great usability aid (that saves analysis time) if a "source" Dojo would show an error message when it is supplied options only relevant for built versions. And adding this check to SVN/dojo/dojo.js would only increase the footprint of source versions, not built versions.
After some investigation this seems to be caused by a bug that wipes out the document, including the "dojo.js" script tag. This is happening on SVN/dojo/dojo.js:210:
which is called even though djConfig.afterOnLoad has been specified. I'm assuming a script tag should be created and appended instead of writing to the document. I've tried that and it seems to work, but there are still problems, as a load callback specified in:
isn't being called as it should.