Changes between Initial Version and Version 2 of Ticket #3395


Ignore:
Timestamp:
Jun 13, 2007, 4:32:59 AM (13 years ago)
Author:
bradneuberg
Comment:

The dojo.addOnLoad() method claims that it will not get fired unless both the page is finished loading AND the widget system is ready to go and parsed:

summary:

Registers a function to be triggered after the DOM has finished loading and widgets declared in markup have been instantiated. Images and CSS files may or may not have finished downloading when the specified function is called. (Note that widgets' CSS and HTML code is guaranteed to be downloaded before said widgets are instantiated.)

However, if you go through the dojo.addOnLoad method inside of loader.js you find that this is not true.

This creates a bug for me in Moxie, since the page load event fires _before_ my RichText? widget is ready to go, creating exceptions since the RichText? widget isn't initialized correctly.

Assigning severity 'major' because this will trip up lots of users waiting to work with the Dijit widgets they just put on the page.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3395

    • Property Summary changed from Page load event being fired by Dojo even though widgets aren't ready to go to RichText widget has several bugs related to the page loading
  • Ticket #3395 – Description

    initial v2  
    1 The dojo.addOnLoad() method claims that it will not get fired unless both the page is finished loading AND the widget system is ready to go and parsed:
     1This bug is caused by three issues in the RichText widget; I don't have a fix though.
    22
    3 // summary:
    4         //              Registers a function to be triggered after the DOM has finished
    5         //              loading and widgets declared in markup have been instantiated.
    6         //              Images and CSS files may or may not have finished downloading when
    7         //              the specified function is called.  (Note that widgets' CSS and HTML
    8         //              code is guaranteed to be downloaded before said widgets are
    9         //              instantiated.)
     31) On line 577:
    104
    11 However, if you go through the dojo.addOnLoad method inside of loader.js you find that this is not true.
     5// detect firefox < 1.5, which has some iframe loading issues
     6                        var oldMoz = Boolean(dojo.isMoz && (typeof window.XML == 'undefined'));
    127
    13 This creates a bug for me in Moxie, since the page load event fires _before_ my RichText widget is ready to go, creating exceptions since the RichText widget isn't initialized correctly.
     8this flag is set for versions of Firefox older than 1.5. Then, on line 702 we have the following:
    149
    15 Assigning severity 'major' because this will trip up lots of users waiting to work with the Dijit widgets they just put on the page.
     10if(this.editNode){
     11                                ifrFunc(); // iframe already exists, just set content
     12                        }else if(dojo.isMoz){
     13//                              // FIXME: if we put this on a delay, we get a height of 20px.
     14//                              // Otherwise we get the correctly specified minHeight value.
     15                                setTimeout(ifrFunc, 250);
     16                        }else{ // new mozillas, opera, safari
     17                                ifrFunc();
     18                        }
     19
     20The second if/else, which has if(dojo.isMoz), I believe should be if(oldMoz) so that things happen on a setTimeout. I am using Firefox 2, so I believe that setTimeout should never have been called for me.
     21
     222) If we have a setTimeout(), for older versions of Firefox, then what happens is the widget initialization continues and the widget system 'incorrectly' thinks the widget system is initialized, which means the page's onLoad event gets fired before the widget is truly finished initializing. This can lead to bugs in developer code which starts accessing this widget, but it is not available yet.
     23
     243) If we fall to the third if/else, and just execute ifrFunc() immediately, then what happens is we get an error on line 669:
     25
     26this.document.body.innerHTML = html;
     27
     28However, we don't have a document.body yet since the page isn't finished loading.