-- Ralf Eggert <[email protected]> wrote
(on Wednesday, 22 September 2010, 11:35 AM +0200):
> I have a serious problem with blank screens in Firefox while using Dojo
> for my forms and stuff. The problem only occurs on the live server not
> on my development machine. From 10 times reloading a page I get the
> blank screen 2 or 3 times. The page is loaded completely which means
> that the HTML head and body is transfered and after rendering the page
> through Dojo the blank screens occur occasionally which means that the
> body part is completely empty.
I've run into this before myself -- and it was similar conditions (ran
fine locally, broke when running off the QA server).
IIRC, the way I "fixed" the behavior was through some odd permutations
of dojo.addOnLoad (now dojo.ready in 1.5). However, the ultimate fix is
one that you should be doing anyways: create a custom build.
By creating a custom build, you basically eliminate the synchronous XHR
calls (yes, synchronous) used by Dojo to load modules. It also ends up
looking a lot like one of the solutions you found:
<!-- dojo.js always provides the package system and base utilities -->
<script type="text/javascript" src="/js/src/dojo/dojo.js"></script>
<!-- include the rest of the modules we need -->
<script type="text/javascript" src="/js/src/acme/mylayer.js"></script>
Custom builds are also magnitudes faster than pulling in the modules via
XHR -- not only do you eliminate the network latency, but the build
system also optimizes the code.
In the meantime, instead of echoing out $this->dojo(), build a
dojo.addOnLoad() callback that first loads the required modules, and
then queues another dojo.addOnLoad() event to trigger any other setup:
dojo.addOnLoad(function() {
dojo.require(...);
dojo.require(...);
dojo.addOnLoad() {
// do some other stuff...
}
});
This approach helps to ensure all the modules are loaded before any
other code executes -- though it will not fix issues where FF does not
find the scripts in the first place.
You can get most of what you need to build that by using the various
accessors on the dojo view helper; alternately, extend the Dojo view
helper to do this for you when you render it.
<snip>
> B) I thought maybe the brand new 1.5 version of Dojo might have a
> solution for this problem. But ZF 1.10.8 only supports the 1.4.1 version
> of Dojo.
>
> Questions for B)
>
> Are there any known issued when switching the Dojo version to 1.5 while
> still using ZF 1.10.8?
To be honest, I haven't tried using 1.5 yet, much less with ZF. That
said, when we've upgraded between versions, there have been very, very
few breakages, if any. Give it a try -- simply set the dojo version in
the view helper, and see what happens.
> Is the upcoming ZF 1.11 supporting Dojo 1.5 and if so, is there a
> planned release date yet?
This is planned, and I hope to tackle it in the next couple of weeks.
The 1.11.0 release is planned at this point for the end of October.
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc