I have a script which loads the dojo toolkit, it does not run and generates an error in Firefox 2.0.0.16, i do not get this problem in any other browser (Firefox 3, IE6 & IE7).
my code is:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" media="screen"
href="__SITEURL__/css/site.css" />
<style type="text/css">
@import "__SITEURL__/js/dijit/themes/tundra/tundra.css";
@import "__SITEURL__/js/dojo/resources/dojo.css"
</style>
<script type="text/javascript" src="__SITEURL__/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="__SITEURL__/js/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" src="__SITEURL__/js/selectLayout.js"></script>
<script>
dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.InlineEditBox");
dojo.require("dijit.form.Textarea");
dojo.require("dijit.Editor");
</script>It generates this error in the console:
failed loading undefined./parser.js with error: SyntaxError: syntax error
Does anyone else have this problem and does anyone know a way i could fix it? Thanks.

I get it in Firefox 3
I'm getting a similar error in Firefox 3: failed loading undefined./parser.js with error: TypeError: this._getText is not a function
However, if I do a shift-reload, it works. Plus it works fine locally, it's only on the remote server where it fails. This suggests a timing problem, which would explain why only some people would see it.
Gary
[edited to clarify that it's not the identical error]
It is hard to tell -- does
It is hard to tell -- does not sound like a known issue. If you use Firebug's Net tab, does that indicate any network loading errors? Do the paths for the loaded files look right?
Actually, the .Net tab
Actually, the .Net tab doesn't show any of the .js files even when it 's working, but the Console does. On the other hand, when it doesn't work, there are no GETs logged in the console.
The file path does look suspicious: undefined./parser.js . Both the 'undefined' and the period between the 'undefined' and / seem questionable.
I've tried debugging using
I've tried debugging using console.log statements in dojo.js.uncompressed.js, and it appears that it's trying to execute the dojo.require before dojo.js has finished executing, and in particular, before the function that adds _getText to the dojo object has finished.
Specifically, I added log messages here, starting at line 1254 (version 1.1.1):
if(typeof window != 'undefined'){ dojo.isBrowser = true; dojo._name = "browser"; console.log("window is defined"); // attempt to figure out the path to dojo if it isn't set in the config (function(){ var d = dojo; // this is a scope protection closure. We set browser versions and grab // the URL we were loaded from here. console.log("in defined window anonymous function"); if(document && document.getElementsByTagName){ ..... } d.baseUrl = d.config.baseUrl; console.log("computed base url = " + d.baseUrl); // fill in the rendering support information in dojo.render.*and the console log shows:
I don't know whether the order of messages is reliable, but they're certainly consistent with the conjecture that the dojo.require is being executed too soon.
what mime type are you serving the page with?
"application/xhtml+xml" is known to, well, suck. What mimetype are you serving the page with?
My main page is text/html ,
My main page is text/html , while the javascript pages are application/x-javascript, I think.
I am also getting the
I am also getting the parser/getText() error described by GaryFX periodically with firefox.
I am using a local deployment of dojo 1.1.1 and have received it on both Firefox 2 and 3.
Like the other comments, refreshing the page will resolve the error...
So do I..
I know the only way to avoid such error.
Load dojo libs throw o.aolcdn.com server, not locally.
<_script type="text/javascript" src="http://o.aolcdn.com/dojo/1.1.1/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
and so on...
same here
I share this problem with you guys - is this worth a word to the developers ?
For me it looks like a common problem, so it should be solved for all.
Is it a 1.1.1 issue only?
I believe I have just encountered this issue with 1.1.1...
I have been using dojo for some time and the error just recently started occurring. Has anyone had this problem with an earlier version of dojo?
It is very annoying, as sometimes I will have to refresh the page two or three times before the error goes away. I think it has caused problems during users' testing too (hard to tell...since it's intermittent and they're not net-savvy enough to check a firebug console...)
It would be good to get a
It would be good to get a complete test case: actually, a complete HTML page that runs with a built version of dojo. Feel free to attach the HTML test case to a ticket you can open at http://bugs.dojotoolkit.org.
It seems like there may be a problem involved, but it is hard to pinpoint without an HTML test case I can run. Note that the HTML test case should be standalone-it should not depend on any type of server to generate the HTML. I should be able to run the static HTML and see the problem.
Are you all using tiny_mce.js? I wonder if moving that after Dojo makes a difference, or if it is interfering somehow with Dojo's initialization code.
It's more complicated than
It's more complicated than that, since this appears to be a timing problem. I can see the problem on my test server but not my development server, for example. Also, since it may be related to browser caching and (at least for me) it's a server-generated file, you need to make sure that the server never returns a 304 for the main page. Another complication is that I have a handful of Firefox extensions called (some of which occasionally insert messages into the console for no good reason). It's entirely possible this is a bug in Firefox's synchronization of JavaScript code and not Dojo.
I may have time next week to try stripping out the proprietary stuff from my sample, but I fear that it would be a lot of work and that the result would no longer trigger the problem.
For the record, I'm not using tiny_mce. I'm only using Dojo Buttons and Trees (with a custom model for the tree). I am using symfony, and in particular the symfony debug toolbar which has its own set of JavaScript. (I'm not sure if it uses Prototype for it).
While I understand the desire to find the specific cause, I'd be tempted to approach it from the opposite direction. Specifically, see if there's a way to construct the dojo object all in one step, instead of the multiple steps currently used.
I just found this:
I just found this: http://dojotoolkit.org/forum/dojo-foundation/general-discussion/firefox-... , which I suspect is the same problem we're seeing, along with the cause.
That seems to fit
I encountered the error in a JSP application which has several similar pages and one displays this error while the others do not. After reading the discussion about Firefox firing the DomContentLoaded event prematurely, I immediately spotted the difference. While each page uses JSTL forEach loops to fill lists, the others have a few dozen list items while the one with the error has hundreds. Taking out the JSTL tag that creates the list items makes the error disappear. Putting it back in makes it reappear.
I was planning to populate the lists dynamically from XML -- guess I'll do this one first.