This project is archived and is in readonly mode.

#168 ✓wontfix
Yoritomo

domready event and IE

Reported by Yoritomo | June 26th, 2008 @ 01:28 PM | in 2.0 (closed)

Apparently for IE6 and IE7, the domready event fires before the dom is ready, raising the "Operation aborted" error on heavy pages when using the "document.body".

I found a description of this problem at http://channel9.msdn.com/wiki/in...

Workaround: I replaced the following code in Domready.js:

case 'trident':

var temp = document.createElement('div');

(function(){

($try(function(){

temp.doScroll('left');

return $(temp).inject(document.body).set('html', 'temp').dispose();

})) ? domready() : arguments.callee.delay(50);

})();

break;

by

case 'trident':

if (window.addEventListener)

window.addEventListener("load",domready,false);

else if (window.attachEvent)

window.attachEvent("onload",domready);

break;

and now it works ...

Comments and changes to this ticket

  • morganizeit

    morganizeit July 14th, 2008 @ 03:46 PM

    I'm getting reports of this issue from users in our production environment. I don't want to do the patch above which makes IE use the onload event.

    I had previously noticed that the new implementation causes a visible "jump" in Explorer when the page loads and JavaScript manipulates the appearance of things.

    I'm planning to patch in the old MooTools 1.1 domReady implementation. This old version worked really well, but I think there were concerns about the way it used document.write to insert a script tag in IE? E.g. not very unobtrusive and broken for application/xhtml mime types. (which IE doesn't support anyway)

    In any case, I'm going to override domReady with the old implementation for now and then keep an eye on this ticket to see if a better fix is developed.

  • morganizeit

    morganizeit July 14th, 2008 @ 05:01 PM

    In case you're interested in doing the same, here's what I changed in order to revert to the previous domReady implementation in IE. I'd attach a patch but I don't grock git yet.

    In the full distro of mootools core search for "domready". At about line 2715 replace the "trident" block in the case statement with this:

    case 'trident':

    if (!$('ie_ready')){

    var src = (window.location.protocol == 'https:') ? '://0' : 'javascript:void(0)';

    document.write('

    $('ie_ready').onreadystatechange = function(){

    if (this.readyState == 'complete') domready();

    };

    }

    /*

    var temp = document.createElement('div');

    (function(){

    ($try(function(){

    temp.doScroll('left');

    return $(temp).inject(document.body).set('html', 'temp').dispose();

    })) ? domready() : arguments.callee.delay(50);

    })();

    */

    break;

    I left the original implementation in place but commented so I can keep an eye on possible improvements that may be released.

  • Tom Occhino

    Tom Occhino October 3rd, 2008 @ 05:53 AM

    • State changed from “new” to “hold”
    • Tag changed from 1.2, events, ie, patch to events, ie
  • Christoph Pojer

    Christoph Pojer November 9th, 2010 @ 07:25 PM

    • State changed from “hold” to “wontfix”
    • Milestone order changed from “0” to “0”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Tags

Pages